Skip to content

Commit

Permalink
Fix Gen3 Shellies
Browse files Browse the repository at this point in the history
  • Loading branch information
Schnittcher committed Aug 3, 2024
1 parent a4c2d67 commit 899afd0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
34 changes: 17 additions & 17 deletions Gen3Shelly1/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ public function ReceiveData($JSONString)
}
}
}
if (fnmatch('*/status/switch:0', $Buffer['Topic'])) {
if (array_key_exists('output', $Payload)) {
$this->SetValue('State', $Payload['output']);
}
if (array_key_exists('apower', $Payload)) {
$this->SetValue('Power', $Payload['apower']);
}
if (array_key_exists('voltage', $Payload)) {
$this->SetValue('Voltage', $Payload['voltage']);
}
if (array_key_exists('current', $Payload)) {
$this->SetValue('Current', $Payload['current']);
}
if (array_key_exists('aenergy', $Payload)) {
if (array_key_exists('total', $Payload['aenergy'])) {
$this->SetValue('TotalEnergy', $Payload['aenergy']['total'] / 1000);
}
}
if (fnmatch('*/status/switch:0', $Buffer['Topic'])) {
if (array_key_exists('output', $Payload)) {
$this->SetValue('State', $Payload['output']);
}
if (array_key_exists('apower', $Payload)) {
$this->SetValue('Power', $Payload['apower']);
}
if (array_key_exists('voltage', $Payload)) {
$this->SetValue('Voltage', $Payload['voltage']);
}
if (array_key_exists('current', $Payload)) {
$this->SetValue('Current', $Payload['current']);
}
if (array_key_exists('aenergy', $Payload)) {
if (array_key_exists('total', $Payload['aenergy'])) {
$this->SetValue('TotalEnergy', $Payload['aenergy']['total'] / 1000);
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions Gen3Shelly1Mini/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,29 @@ public function ReceiveData($JSONString)
}
}
}
if (fnmatch('*/status/switch:0', $Buffer['Topic'])) {
if (array_key_exists('output', $Payload)) {
$this->SetValue('State', $Payload['output']);
}
if (array_key_exists('apower', $Payload)) {
$this->SetValue('Power', $Payload['apower']);
}
if (array_key_exists('voltage', $Payload)) {
$this->SetValue('Voltage', $Payload['voltage']);
}
if (array_key_exists('current', $Payload)) {
$this->SetValue('Current', $Payload['current']);
}
if (array_key_exists('aenergy', $Payload)) {
if (array_key_exists('total', $Payload['aenergy'])) {
$this->SetValue('TotalEnergy', $Payload['aenergy']['total'] / 1000);
}
if (fnmatch('*/status/switch:0', $Buffer['Topic'])) {
if (array_key_exists('output', $Payload)) {
$this->SetValue('State', $Payload['output']);
}
if (array_key_exists('apower', $Payload)) {
$this->SetValue('Power', $Payload['apower']);
}
if (array_key_exists('voltage', $Payload)) {
$this->SetValue('Voltage', $Payload['voltage']);
}
if (array_key_exists('current', $Payload)) {
$this->SetValue('Current', $Payload['current']);
}
if (array_key_exists('aenergy', $Payload)) {
if (array_key_exists('total', $Payload['aenergy'])) {
$this->SetValue('TotalEnergy', $Payload['aenergy']['total'] / 1000);
}
}
}
}
}
}
}
}

public function ToggleAfter(int $switch, bool $value, int $toggle_after)
{
Expand Down

0 comments on commit 899afd0

Please sign in to comment.