fix: restore Symcon instance discovery

This commit is contained in:
jhartworks committed 2026-11-09 11:00:00 +01:00
1 parent 2a81b4a502
commit 4a875aa8ea
10 files changed
+146 -10

No files matched your search

+7 -2
View File
@@ -11,7 +11,6 @@ declare(strict_types=1);
*/
class NextFloor extends IPSModuleStrict
{
private const VERSION = '0.1.0';
private const MAX_BUILDING_BYTES = 8_000_000;
private const MAX_IMAGE_BYTES = 8_000_000;
private const MAX_HISTORY = 20;
@@ -206,7 +205,7 @@ class NextFloor extends IPSModuleStrict
$result = match ($request['action']) {
'bootstrap' => $this->bootstrap(),
'variables/snapshot' => $this->variablesSnapshot((int) ($request['revision'] ?? -1)),
'building/get' => ['building' => $this->building(), 'revision' => $this->ReadAttributeInteger('BuildingRevision'), 'version' => self::VERSION],
'building/get' => ['building' => $this->building(), 'revision' => $this->ReadAttributeInteger('BuildingRevision'), 'version' => $this->moduleVersion()],
'building/save' => ['revision' => $this->saveBuilding($this->arrayValue($request, 'building'))],
'image/get' => $this->imageGet((string) ($request['image_id'] ?? '')),
'image/set' => $this->imageSet((string) ($request['image_id'] ?? ''), (string) ($request['data'] ?? '')),
@@ -685,6 +684,12 @@ class NextFloor extends IPSModuleStrict
// --------------------------------------------------------------------- small helpers
private function moduleVersion(): string
{
$library = json_decode((string) file_get_contents(__DIR__ . '/../library.json'), true, 512, JSON_THROW_ON_ERROR);
return (string) $library['version'];
}
private function arrayValue(array $source, string $key): array
{
if (!is_array($source[$key] ?? null)) {