diff --git a/server/ControlScripts/SpotlightsScope.php b/server/ControlScripts/SpotlightsScope.php index 8318ad1..d6cb112 100644 --- a/server/ControlScripts/SpotlightsScope.php +++ b/server/ControlScripts/SpotlightsScope.php @@ -98,7 +98,6 @@ // ACTIONS protected function spotlight_switch(String $relay_alias, Bool $state = false) { - $btns_block_api = $this -> devices() -> by_alias("buttons_backdoor") -> device_api(); $device_entries = $this -> helper() -> get_sync_entries_by_type($this -> sync_map, "relay"); $relay_api = $this -> devices() -> by_alias($relay_alias) -> device_api(); @@ -115,17 +114,17 @@ protected function all_spotlight_switch(Bool $state = false): Array { $results = []; - $btns_block_api = $this -> devices() -> by_alias("buttons_backdoor") -> device_api(); $device_entries = $this -> helper() -> get_sync_entries_by_type($this -> sync_map, "relay"); foreach($device_entries as $device_entry) { $relay_api = $this -> devices() -> by_alias($device_entry["alias"]) -> device_api(); $result = false; + $ch = $device_entry["channel"]; if($relay_api instanceof \SHServ\Tools\DeviceAPI\Relay) { $status = $relay_api -> get_status(); - if(isset($status["channels"][0]["state"]) and $status["channels"][0]["state"] != ($state ? "on" : "off")) { + if(isset($status["channels"][$ch]["state"]) and $status["channels"][$ch]["state"] != ($state ? "on" : "off")) { $result = $relay_api -> set_state($state); } }