From 841e191ee57f0c3263d4b90af9b5318cb11d1449 Mon Sep 17 00:00:00 2001 From: Striker72rus Date: Wed, 25 Mar 2026 14:03:12 +0300 Subject: [PATCH] - --- lib/config.php | 19 ++++++++++--------- storage/popup_state.json | 6 +++--- wall_panel/config.yaml | 4 ++-- wall_panel/lib/config.php | 18 +++++++++--------- wall_panel/run.sh | 2 +- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/lib/config.php b/lib/config.php index a145670..0c60441 100755 --- a/lib/config.php +++ b/lib/config.php @@ -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'); diff --git a/storage/popup_state.json b/storage/popup_state.json index 0bf47ef..38602d9 100755 --- a/storage/popup_state.json +++ b/storage/popup_state.json @@ -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 } diff --git a/wall_panel/config.yaml b/wall_panel/config.yaml index 3afff4c..2d46fe3 100755 --- a/wall_panel/config.yaml +++ b/wall_panel/config.yaml @@ -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: diff --git a/wall_panel/lib/config.php b/wall_panel/lib/config.php index 6d78d6e..0c60441 100755 --- a/wall_panel/lib/config.php +++ b/wall_panel/lib/config.php @@ -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'); diff --git a/wall_panel/run.sh b/wall_panel/run.sh index 60ea168..0a1153f 100755 --- a/wall_panel/run.sh +++ b/wall_panel/run.sh @@ -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"