no message

This commit is contained in:
dh
2025-11-14 09:40:47 +01:00
parent 8c7b860b2a
commit 807cc007bc
2 changed files with 84 additions and 61 deletions
+19 -4
View File
@@ -38,14 +38,29 @@ class ShellyParser
'temperature' => null
];
// GEN3 / GEN4 Geräte → switch:0, switch:1, ...
foreach ($params as $key => $value) {
if (str_starts_with($key, 'switch:') && is_array($value)) {
// Output
if (isset($value['output'])) {
$mapped['output'] = (bool)$value['output'];
}
// Input (für Pro / Gen4 Geräte)
if (isset($value['input'])) {
$mapped['input'] = (bool)$value['input'];
}
}
}
// Temperatur suchen (beliebig tief)
self::ExtractRecursive($params, $mapped);
// null-Werte rauswerfen
return array_filter($mapped, static function ($v) {
return $v !== null;
});
return array_filter($mapped, fn($v) => $v !== null);
}
private static function ExtractRecursive(array $data, array &$mapped): void
{
foreach ($data as $key => $value) {