diff --git a/server/ControlScripts/LightHubScope.php b/server/ControlScripts/LightHubScope.php index f3c99f9..6ad4c2d 100644 --- a/server/ControlScripts/LightHubScope.php +++ b/server/ControlScripts/LightHubScope.php @@ -16,13 +16,17 @@ [ ["type" => "relay", "alias" => "light_hub_1", "channel" => 2], ["type" => "button", "alias" => "master_room_btns", "channel" => 1], + ["type" => "button", "alias" => "buttons_office_room", "channel" => 0], + ["type" => "button", "alias" => "btns_hall2_1", "channel" => 0], ], ] ]; public function register_events_handlers(): void { - $this -> on_online("master_room_btns"); + $this -> on_online("master_room_btns", [2, 3]); + $this -> on_online("btns_hall2_1", [1]); $this -> btns_click_handlers("master_room_btns"); + $this -> btns_click_handlers("btns_hall2_1"); } public function register_actions_scripts(): void { @@ -76,12 +80,13 @@ ]; } - protected function on_online($alias) { + protected function on_online($alias, Array $muted = []) { $this -> add_event_handler("button@{$alias}.online", function(Device $btns_block, Array $data) { $btns_block_api = $btns_block -> device_api(); if($btns_block_api instanceof \SHServ\Tools\DeviceAPI\Button) { - $btns_block_api -> set_channel_state("mute", 2); - $btns_block_api -> set_channel_state("mute", 3); + foreach($muted as $ch) { + $btns_block_api -> set_channel_state("mute", $ch); + } } $this -> helper() -> sync_btn_channels($this -> sync_map, $btns_block -> alias); diff --git a/server/ControlScripts/OfficeRoomScope.php b/server/ControlScripts/OfficeRoomScope.php index 222ac72..9a4b83a 100644 --- a/server/ControlScripts/OfficeRoomScope.php +++ b/server/ControlScripts/OfficeRoomScope.php @@ -25,6 +25,8 @@ [ ["type" => "relay", "alias" => "light_hub_1", "channel" => 2], ["type" => "button", "alias" => "buttons_office_room", "channel" => 0], + ["type" => "button", "alias" => "master_room_btns", "channel" => 1], + ["type" => "button", "alias" => "btns_hall2_1", "channel" => 0], ], ] ];