Skip to content

Commit

Permalink
Fix Dimmer PM SwitchMode & SetBrightness
Browse files Browse the repository at this point in the history
  • Loading branch information
Schnittcher committed Aug 2, 2024
1 parent fe1f47d commit 963fdb4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ShellyProDimmerPM/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,14 @@ public function SetBrightness(int $id, int $brightness, int $transition = 0, int

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['params'] = ['id' => $id, 'brightness' => $brightness, 'transition' => $transition, 'toggle_after' => $toggle_after];
$Payload['method'] = 'Light.Set';
$Payload['params'] = ['id' => $id, 'on' => true, 'brightness' => $brightness];
if ($toggle_after != 0) {
$Payload['params']['toggle_after'] = $toggle_after;
}
if ($transition != 0) {
$Payload['params']['transition_duration'] = $transition;
}

$this->sendMQTT($Topic, json_encode($Payload));
}
Expand All @@ -227,7 +233,7 @@ private function SwitchMode(int $id, bool $value)

$Payload['id'] = 1;
$Payload['src'] = 'user_1';
$Payload['method'] = 'Switch.Set';
$Payload['method'] = 'Light.Set';
$Payload['params'] = ['id' => $id, 'on' => $value];

$this->sendMQTT($Topic, json_encode($Payload));
Expand Down

0 comments on commit 963fdb4

Please sign in to comment.