diff --git a/server/ControlScripts/SpotlightsScope.php b/server/ControlScripts/SpotlightsScope.php index 66f0d90..ea020fb 100644 --- a/server/ControlScripts/SpotlightsScope.php +++ b/server/ControlScripts/SpotlightsScope.php @@ -12,6 +12,7 @@ ]; public function register_events_handlers(): void { + $this -> backdoor_btns_online(); $this -> backdoor_btns_handlers(); } @@ -101,6 +102,19 @@ ); } + protected function backdoor_btns_online() { + $this -> add_event_handler("button@buttons_backdoor.online", function(Device $btns_block, Array $data) { + $btns_block -> device_ip = $data["data"]["device_ip"]; + $btns_block -> description = $btns_block -> description . "\n" . json_encode($data); + $btns_block -> update(); + + $btns_block_api = $btns_block -> device_api(); + if($btns_block_api instanceof \SHServ\Tools\DeviceAPI\Button) { + $btns_block_api -> set_channel_state("mute", 3); + } + }); + } + protected function backdoor_btns_handlers() { foreach($this -> aliases as $btn_channel => $relay_alias) { $this -> add_event_handler("button@buttons_backdoor({$btn_channel}).press", function(Device $btns_block, Array $data) use ($btn_channel, $relay_alias) {