From 2afc09b644ee7161bf425accf9548f9e26bcbf77 Mon Sep 17 00:00:00 2001 From: Striker72rus Date: Wed, 25 Mar 2026 15:48:04 +0300 Subject: [PATCH] - --- lib/config.php | 16 +++++++++++++++- storage/popup_state.json | 2 +- wall_panel/config.yaml | 2 +- wall_panel/lib/config.php | 16 +++++++++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/lib/config.php b/lib/config.php index 27faf41..4828f93 100755 --- a/lib/config.php +++ b/lib/config.php @@ -73,6 +73,11 @@ function app_storage_path(string $file): string return $base . '/' . ltrim($file, '/'); } +function app_log(string $message): void +{ + error_log('[wall_panel] ' . $message); +} + function app_ensure_directory(string $path): void { if (!is_dir($path)) { @@ -287,6 +292,7 @@ function app_supervisor_ingress_url(): string { $token = trim((string)getenv('SUPERVISOR_TOKEN')); if ($token === '') { + app_log('SUPERVISOR_TOKEN is missing'); return ''; } @@ -296,10 +302,16 @@ function app_supervisor_ingress_url(): string ], null, 10, false, false); if (!is_array($response)) { + app_log('failed to fetch addon info from Supervisor'); return ''; } - return trim((string)($response['ingress_url'] ?? '')); + $ingressUrl = trim((string)($response['ingress_url'] ?? '')); + if ($ingressUrl === '') { + app_log('Supervisor returned empty ingress_url'); + } + + return $ingressUrl; } function app_register_ingress_url(array $config): bool @@ -345,6 +357,7 @@ function app_register_ingress_url(array $config): bool ); if (is_array($response) && (bool)($response['ok'] ?? false)) { + app_log('ingress registered: ' . $ingressUrl); app_save_json_file($cachePath, [ 'cache_key' => $cacheKey, 'ingress_url' => $ingressUrl, @@ -353,6 +366,7 @@ function app_register_ingress_url(array $config): bool return true; } + app_log('failed to register ingress at HA endpoint'); return false; } diff --git a/storage/popup_state.json b/storage/popup_state.json index 47e8779..63dec22 100755 --- a/storage/popup_state.json +++ b/storage/popup_state.json @@ -1,6 +1,6 @@ { "active": false, "sensor_entity_id": "binary_sensor.barn_all_occupancy", - "opened_at": 1774442675, + "opened_at": 1774442799, "expires_at": null } diff --git a/wall_panel/config.yaml b/wall_panel/config.yaml index 4b84b97..7156405 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.13" +version: "1.0.15" slug: wall_panel url: https://git.striker72rus.ru/PHP/wallpanell.git init: false diff --git a/wall_panel/lib/config.php b/wall_panel/lib/config.php index acccdc6..ad1c28f 100755 --- a/wall_panel/lib/config.php +++ b/wall_panel/lib/config.php @@ -73,6 +73,11 @@ function app_storage_path(string $file): string return $base . '/' . ltrim($file, '/'); } +function app_log(string $message): void +{ + error_log('[wall_panel] ' . $message); +} + function app_ensure_directory(string $path): void { if (!is_dir($path)) { @@ -277,6 +282,7 @@ function app_supervisor_ingress_url(): string { $token = trim((string)getenv('SUPERVISOR_TOKEN')); if ($token === '') { + app_log('SUPERVISOR_TOKEN is missing'); return ''; } @@ -286,10 +292,16 @@ function app_supervisor_ingress_url(): string ], null, 10, false, false); if (!is_array($response)) { + app_log('failed to fetch addon info from Supervisor'); return ''; } - return trim((string)($response['ingress_url'] ?? '')); + $ingressUrl = trim((string)($response['ingress_url'] ?? '')); + if ($ingressUrl === '') { + app_log('Supervisor returned empty ingress_url'); + } + + return $ingressUrl; } function app_addon_register_panel_url(): string @@ -345,6 +357,7 @@ function app_register_ingress_url(array $config): bool ); if (is_array($response) && (bool)($response['ok'] ?? false)) { + app_log('ingress registered: ' . $ingressUrl); app_save_json_file($cachePath, [ 'cache_key' => $cacheKey, 'ingress_url' => $ingressUrl, @@ -353,6 +366,7 @@ function app_register_ingress_url(array $config): bool return true; } + app_log('failed to register ingress at HA endpoint'); return false; }