no message

This commit is contained in:
dh
2025-11-14 10:45:23 +01:00
parent 964c882a6d
commit 25225734f3
2 changed files with 83 additions and 86 deletions
+5 -9
View File
@@ -30,7 +30,7 @@ class ShellyParser
* - output (bool)
* - temperature (float, inkl. tC)
*/
public static function MapParams(array $params): array
public static function MapParams(array $params): array
{
$mapped = [
'outputs' => [], // switch:x → output
@@ -40,9 +40,7 @@ class ShellyParser
foreach ($params as $key => $value) {
// -----------------------------
// OUTPUTS (switch:0 → output)
// -----------------------------
// OUTPUTS (switch:0.output)
if (str_starts_with($key, 'switch:') && is_array($value)) {
$index = (int)substr($key, 7);
@@ -51,15 +49,13 @@ class ShellyParser
$mapped['outputs'][$index] = (bool)$value['output'];
}
// Gen4 Input in switch
// Gen4 / Pro input in switch
if (isset($value['input'])) {
$mapped['inputs'][$index] = (bool)$value['input'];
}
}
// -----------------------------
// INPUTS (input:0 → state)
// -----------------------------
// INPUTS (input:0.state)
if (str_starts_with($key, 'input:') && is_array($value)) {
$index = (int)substr($key, 6);
@@ -70,7 +66,7 @@ class ShellyParser
}
}
// Temperatur (verschachtelt)
// Temperatur tief suchen
self::ExtractRecursive($params, $mapped);
return $mapped;