This commit is contained in:
Striker72rus 2026-03-25 15:48:04 +03:00
parent 854ed61add
commit 2afc09b644
4 changed files with 32 additions and 4 deletions

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
{
"active": false,
"sensor_entity_id": "binary_sensor.barn_all_occupancy",
"opened_at": 1774442675,
"opened_at": 1774442799,
"expires_at": null
}

View File

@ -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

View File

@ -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;
}