diff --git a/server/ControlScripts/SpotlightsScope.php b/server/ControlScripts/SpotlightsScope.php index c24ce05..5c38778 100644 --- a/server/ControlScripts/SpotlightsScope.php +++ b/server/ControlScripts/SpotlightsScope.php @@ -16,7 +16,7 @@ "description" => "Включить все прожекторы", "author" => "Eugene Sukhodolskiy" ], function($params) { - return $this -> all_spotlight_toggle(true); + return $this -> all_spotlight_switch(true); }); $this -> add_action_script([ @@ -25,7 +25,7 @@ "description" => "Выключить все прожекторы", "author" => "Eugene Sukhodolskiy" ], function($params) { - return $this -> all_spotlight_toggle(false); + return $this -> all_spotlight_switch(false); }); } @@ -42,29 +42,14 @@ $limit = new \DateTime('9:00', $tz); if ($now >= $limit) { - try { - $relay_api = $this -> devices() -> by_alias("spotlight_main_back_2") -> device_api(); - if($relay_api instanceof \SHServ\Tools\DeviceAPI\Relay) { - $relay_api -> set_state(false); - } - - // if($btn_api instanceof \SHServ\Tools\DeviceAPI\Button) { - // if(($btn_api -> get_status())["channels"][2]["indicator"] != "error") { - // $btn_api -> set_channel_state("error", 2); - // } else { - // $btn_api -> set_channel_state("mute", 2); - // } - // } - } catch(\Exception $e) { - echo $e -> getMessage(); - } + $this -> all_spotlight_switch(false); } }); } // ACTIONS - protected function all_spotlight_toggle(Bool $state = false): Array { + protected function all_spotlight_switch(Bool $state = false): Array { $aliases = [ "spotlight_main_back_1", "spotlight_main_back_2",