Skip to content

Commit

Permalink
Neu: Shelly Plus Uni um Prozent100 und Xpercent100 erweitert.
Browse files Browse the repository at this point in the history
  • Loading branch information
Schnittcher committed Aug 21, 2024
1 parent b3f7f46 commit f877d9d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ShellyPlusUni/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"Input 2": "Eingang 2",
"Input 3 Count Total": "Eingang 3 Zähler",
"Input 3 Frequency": "Eingang 3 Frequenz",
"Xpercent 100": "Xprozent 100",
"Percent 100": "Prozent 100",
"Zeroing by unreach": "Nullung durch Unerreichbarkeit"
}
}
Expand Down
16 changes: 13 additions & 3 deletions ShellyPlusUni/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ShellyPlusUni extends ShellyModule
['Temperature104', 'External Temperature 5', VARIABLETYPE_FLOAT, '~Temperature', [], '', false, true, false],
['Humidity100', 'External Humidity', VARIABLETYPE_FLOAT, '~Humidity.F', [], '', false, true, false],
['Voltmeter100', 'External Voltmeter', VARIABLETYPE_FLOAT, '~Volt', [], '', false, true, false],
['Xpercent100', 'Xpercent 100', VARIABLETYPE_FLOAT, '', [], '', false, true, false],
['Percent100', 'Percent 100', VARIABLETYPE_FLOAT, '', [], '', false, true, false],
['Reachable', 'Reachable', VARIABLETYPE_BOOLEAN, 'Shelly.Reachable', '', '', false, true, false]
];

Expand Down Expand Up @@ -81,7 +83,6 @@ public function ReceiveData($JSONString)
$this->SetValue('Input1', $service['state']);
}
}

if (array_key_exists('input:2', $Payload['params'])) {
$service = $Payload['params']['input:2'];
if (array_key_exists('counts', $service)) {
Expand All @@ -91,7 +92,6 @@ public function ReceiveData($JSONString)
$this->SetValue('Input2Frequency', $service['freq']);
}
}
}
for ($i = 100; $i <= 104; $i++) {
$temperatureIndex = 'temperature:' . $i;
if (array_key_exists($temperatureIndex, $Payload['params'])) {
Expand All @@ -113,9 +113,19 @@ public function ReceiveData($JSONString)
$this->SetValue('Humidity100', $humidity['rh']);
}
}
if (array_key_exists('input:100', $Payload['params'])) {
$input100 = $Payload['params']['input:100'];
if (array_key_exists('xpercent', $input100)) {
$this->SetValue('Xpercent100', $input100['xpercent']);
}
if (array_key_exists('percent', $input100)) {
$this->SetValue('Percent100', $input100['percent']);
}
}
}
}
}
}
}
}

private function SwitchMode(int $switch, bool $value)
Expand Down

0 comments on commit f877d9d

Please sign in to comment.