-
This commit is contained in:
parent
854ed61add
commit
2afc09b644
@ -73,6 +73,11 @@ function app_storage_path(string $file): string
|
|||||||
return $base . '/' . ltrim($file, '/');
|
return $base . '/' . ltrim($file, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function app_log(string $message): void
|
||||||
|
{
|
||||||
|
error_log('[wall_panel] ' . $message);
|
||||||
|
}
|
||||||
|
|
||||||
function app_ensure_directory(string $path): void
|
function app_ensure_directory(string $path): void
|
||||||
{
|
{
|
||||||
if (!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
@ -287,6 +292,7 @@ function app_supervisor_ingress_url(): string
|
|||||||
{
|
{
|
||||||
$token = trim((string)getenv('SUPERVISOR_TOKEN'));
|
$token = trim((string)getenv('SUPERVISOR_TOKEN'));
|
||||||
if ($token === '') {
|
if ($token === '') {
|
||||||
|
app_log('SUPERVISOR_TOKEN is missing');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,10 +302,16 @@ function app_supervisor_ingress_url(): string
|
|||||||
], null, 10, false, false);
|
], null, 10, false, false);
|
||||||
|
|
||||||
if (!is_array($response)) {
|
if (!is_array($response)) {
|
||||||
|
app_log('failed to fetch addon info from Supervisor');
|
||||||
return '';
|
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
|
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)) {
|
if (is_array($response) && (bool)($response['ok'] ?? false)) {
|
||||||
|
app_log('ingress registered: ' . $ingressUrl);
|
||||||
app_save_json_file($cachePath, [
|
app_save_json_file($cachePath, [
|
||||||
'cache_key' => $cacheKey,
|
'cache_key' => $cacheKey,
|
||||||
'ingress_url' => $ingressUrl,
|
'ingress_url' => $ingressUrl,
|
||||||
@ -353,6 +366,7 @@ function app_register_ingress_url(array $config): bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app_log('failed to register ingress at HA endpoint');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"active": false,
|
"active": false,
|
||||||
"sensor_entity_id": "binary_sensor.barn_all_occupancy",
|
"sensor_entity_id": "binary_sensor.barn_all_occupancy",
|
||||||
"opened_at": 1774442675,
|
"opened_at": 1774442799,
|
||||||
"expires_at": null
|
"expires_at": null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: Wall Panel
|
name: Wall Panel
|
||||||
description: Wall Panel PHP interface as a Home Assistant add-on
|
description: Wall Panel PHP interface as a Home Assistant add-on
|
||||||
version: "1.0.13"
|
version: "1.0.15"
|
||||||
slug: wall_panel
|
slug: wall_panel
|
||||||
url: https://git.striker72rus.ru/PHP/wallpanell.git
|
url: https://git.striker72rus.ru/PHP/wallpanell.git
|
||||||
init: false
|
init: false
|
||||||
|
|||||||
@ -73,6 +73,11 @@ function app_storage_path(string $file): string
|
|||||||
return $base . '/' . ltrim($file, '/');
|
return $base . '/' . ltrim($file, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function app_log(string $message): void
|
||||||
|
{
|
||||||
|
error_log('[wall_panel] ' . $message);
|
||||||
|
}
|
||||||
|
|
||||||
function app_ensure_directory(string $path): void
|
function app_ensure_directory(string $path): void
|
||||||
{
|
{
|
||||||
if (!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
@ -277,6 +282,7 @@ function app_supervisor_ingress_url(): string
|
|||||||
{
|
{
|
||||||
$token = trim((string)getenv('SUPERVISOR_TOKEN'));
|
$token = trim((string)getenv('SUPERVISOR_TOKEN'));
|
||||||
if ($token === '') {
|
if ($token === '') {
|
||||||
|
app_log('SUPERVISOR_TOKEN is missing');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,10 +292,16 @@ function app_supervisor_ingress_url(): string
|
|||||||
], null, 10, false, false);
|
], null, 10, false, false);
|
||||||
|
|
||||||
if (!is_array($response)) {
|
if (!is_array($response)) {
|
||||||
|
app_log('failed to fetch addon info from Supervisor');
|
||||||
return '';
|
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
|
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)) {
|
if (is_array($response) && (bool)($response['ok'] ?? false)) {
|
||||||
|
app_log('ingress registered: ' . $ingressUrl);
|
||||||
app_save_json_file($cachePath, [
|
app_save_json_file($cachePath, [
|
||||||
'cache_key' => $cacheKey,
|
'cache_key' => $cacheKey,
|
||||||
'ingress_url' => $ingressUrl,
|
'ingress_url' => $ingressUrl,
|
||||||
@ -353,6 +366,7 @@ function app_register_ingress_url(array $config): bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app_log('failed to register ingress at HA endpoint');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user