This commit is contained in:
Striker72rus 2026-03-25 14:03:12 +03:00
parent e2d8ba78b1
commit 841e191ee5
5 changed files with 25 additions and 24 deletions

View File

@ -99,16 +99,17 @@ function app_load_config(): array
}
}
if (!$pathExists) {
$optionsPath = function_exists('app_addon_options_path')
? app_addon_options_path()
: '/data/options.json';
if (is_file($optionsPath)) {
$options = app_load_json_file($optionsPath, []);
if (is_array($options) && $options !== []) {
$config = array_replace_recursive($config, $options);
}
$optionsPath = function_exists('app_addon_options_path')
? app_addon_options_path()
: '/data/options.json';
if (app_runtime_mode() === 'addon' && is_file($optionsPath)) {
$options = app_load_json_file($optionsPath, []);
if (is_array($options) && $options !== []) {
$config = array_replace_recursive($config, $options);
}
}
if (!$pathExists || app_runtime_mode() === 'addon') {
$json = json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
if ($json === false) {
throw new RuntimeException('Failed to encode default config');

View File

@ -1,6 +1,6 @@
{
"active": false,
"active": true,
"sensor_entity_id": "binary_sensor.barn_all_occupancy",
"opened_at": 1774436133,
"expires_at": null
"opened_at": 1774436558,
"expires_at": 1774436594
}

View File

@ -1,6 +1,6 @@
name: Wall Panel
description: Wall Panel PHP interface as a Home Assistant add-on
version: "1.0.5"
version: "1.0.6"
slug: wall_panel
url: https://git.striker72rus.ru/PHP/wallpanell.git
init: false
@ -22,7 +22,7 @@ ports_description:
map:
- type: homeassistant_config
read_only: false
path: /homeassistant/wall_panel
path: /config/wall_panel
homeassistant_api: true
options:
app:

View File

@ -99,17 +99,17 @@ function app_load_config(): array
}
}
if (!$pathExists) {
$optionsPath = function_exists('app_addon_options_path')
? app_addon_options_path()
: '/data/options.json';
if (is_file($optionsPath)) {
$options = app_load_json_file($optionsPath, []);
if (is_array($options) && $options !== []) {
$config = array_replace_recursive($config, $options);
}
$optionsPath = function_exists('app_addon_options_path')
? app_addon_options_path()
: '/data/options.json';
if (app_runtime_mode() === 'addon' && is_file($optionsPath)) {
$options = app_load_json_file($optionsPath, []);
if (is_array($options) && $options !== []) {
$config = array_replace_recursive($config, $options);
}
}
if (!$pathExists || app_runtime_mode() === 'addon') {
$json = json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
if ($json === false) {
throw new RuntimeException('Failed to encode default config');

View File

@ -3,7 +3,7 @@ set -eu
DOCROOT="${WALL_PANEL_DOCROOT:-/app}"
PORT="${WALL_PANEL_PORT:-8099}"
CONFIG_PATH="${WALL_PANEL_CONFIG_PATH:-/homeassistant/wall_panel/config.json}"
CONFIG_PATH="${WALL_PANEL_CONFIG_PATH:-/config/wall_panel/config.json}"
STORAGE_DIR="${WALL_PANEL_STORAGE_DIR:-/data/wall_panel}"
mkdir -p "$(dirname "$CONFIG_PATH")" "$STORAGE_DIR"