no message
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user