diff --git a/server/ControlScripts/Common.php b/server/ControlScripts/Common.php
index 8903bf3..c15cf4b 100644
--- a/server/ControlScripts/Common.php
+++ b/server/ControlScripts/Common.php
@@ -10,7 +10,7 @@
["type" => "relay", "alias" => "spotlight_main_back_1", "channel" => 0],
["type" => "button", "alias" => "buttons_backdoor", "channel" => 2],
["type" => "button", "alias" => "master_door_btns", "channel" => 1],
- ["type" => "button", "alias" => "bed_btns_left", "channel" => 1],
+ ["type" => "button", "alias" => "bed_btns_left", "channel" => 0],
]);
$this -> add_sync_connection([
@@ -83,6 +83,42 @@
["type" => "relay", "alias" => "server_room_light", "channel" => 0],
["type" => "button", "alias" => "btns_hall2_1", "channel" => 1],
]);
+
+
+
+
+ // ---
+
+ $this -> add_sync_connection([
+ ["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 0],
+ ["type" => "button", "alias" => "kitchen_buttons_1", "channel" => 0],
+ ["type" => "button", "alias" => "kitchen_buttons_2", "channel" => 0],
+ ]);
+
+ $this -> add_sync_connection([
+ ["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 1],
+ ["type" => "button", "alias" => "kitchen_buttons_1", "channel" => 1],
+ ["type" => "button", "alias" => "kitchen_buttons_2", "channel" => 1],
+ ]);
+
+ // ---
+
+ $this -> add_sync_connection([
+ ["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 2],
+ ["type" => "button", "alias" => "first_hall_buttons1", "channel" => 0],
+ ]);
+
+ $this -> add_sync_connection([
+ ["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 3],
+ ["type" => "button", "alias" => "first_hall_buttons1", "channel" => 1],
+ ["type" => "button", "alias" => "first_hall_buttons2", "channel" => 0],
+ ]);
+
+ $this -> add_sync_connection([
+ ["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 4],
+ ["type" => "button", "alias" => "first_hall_buttons1", "channel" => 2],
+ ["type" => "button", "alias" => "first_hall_buttons2", "channel" => 1],
+ ]);
}
diff --git a/server/ControlScripts/Scopes/LightHubScope.php b/server/ControlScripts/Scopes/LightHubScope.php
index ae1848d..de9da3b 100644
--- a/server/ControlScripts/Scopes/LightHubScope.php
+++ b/server/ControlScripts/Scopes/LightHubScope.php
@@ -18,11 +18,21 @@
$this -> btn_on_online("hall_secondary");
$this -> btn_on_online("bed_btns_right_1");
$this -> btn_on_online("bed_btns_left");
+ $this -> btn_on_online("kitchen_buttons_1");
+ $this -> btn_on_online("kitchen_buttons_2");
+ $this -> btn_on_online("first_hall_buttons1", [3]);
+ $this -> btn_on_online("first_hall_buttons2");
$this -> set_btns_click_handlers("master_room_btns");
$this -> set_btns_click_handlers("btns_hall2_1");
$this -> set_btns_click_handlers("hall_secondary");
$this -> set_btns_click_handlers("bed_btns_right_1");
$this -> set_btns_click_handlers("bed_btns_left");
+ $this -> set_btns_click_handlers("kitchen_buttons_1");
+ $this -> set_btns_click_handlers("kitchen_buttons_2");
+ $this -> set_btns_click_handlers("first_hall_buttons1");
+ $this -> set_btns_click_handlers("first_hall_buttons2");
+
+
$this -> btn_on_online("plants_room_btns", [1]);
@@ -60,6 +70,52 @@
], function($params) {
return $this -> lamp_switch("light_hub_1", 3);
});
+
+ // ---
+
+ $this -> add_action_script([
+ "alias" => "hall1_light_switcher",
+ "name" => "Свет в прихожей",
+ "icon" => '',
+ "description" => "Включить/выключить свет в прихожей",
+ "author" => "Eugene Sukhodolskiy"
+ ], function($params) {
+ return
+ $this -> lamp_switch("fisrt_floor_big_relay", 3) and $this -> lamp_switch("fisrt_floor_big_relay", 4);
+ });
+
+ $this -> add_action_script([
+ "alias" => "kitchen_light_switcher",
+ "name" => "Полный свет на кухне",
+ "icon" => '',
+ "description" => "Включить/выключить весь имеющийся свет на кухне",
+ "author" => "Eugene Sukhodolskiy"
+ ], function($params) {
+ return
+ $this -> lamp_switch("fisrt_floor_big_relay", 0) and $this -> lamp_switch("fisrt_floor_big_relay", 1);
+ });
+
+ $this -> add_action_script([
+ "alias" => "hatch_open",
+ "name" => "Открыть люк",
+ "icon" => '',
+ "description" => "Открыть люк на кухне",
+ "author" => "Eugene Sukhodolskiy"
+ ], function($params) {
+ return
+ $this -> hatch_open("kitchen_hatch", 100);
+ });
+
+ $this -> add_action_script([
+ "alias" => "hatch_close",
+ "name" => "Закрыть люк",
+ "icon" => '',
+ "description" => "Закрыть люк на кухне",
+ "author" => "Eugene Sukhodolskiy"
+ ], function($params) {
+ return
+ $this -> hatch_close("kitchen_hatch", 100);
+ });
}
public function register_regular_scripts(): void {
@@ -80,5 +136,29 @@
"result" => $result
];
}
+
+ protected function hatch_do(String $hatch_alias, String $operation = "open", int $percent = 100): Array | bool {
+ $hatch_api = $this -> devices() -> by_alias($hatch_alias) -> device_api();
+
+ $result = false;
+ if($hatch_api instanceof \SHServ\Tools\DeviceAPI\Hatch) {
+ switch($operation) {
+ case "open": $result = $hatch_api -> open($percent);
+ break;
+ case "close": $result = $hatch_api -> close($percent);
+ break;
+ }
+ }
+
+ return $result;
+ }
+
+ protected function hatch_open(String $hatch_alias, int $percent = 100) {
+ return $this -> hatch_do($hatch_alias, "open", $percent);
+ }
+
+ protected function hatch_close(String $hatch_alias, int $percent = 100) {
+ return $this -> hatch_do($hatch_alias, "close", $percent);
+ }
}
diff --git a/server/ControlScripts/Scopes/OfficeRoomScope.php b/server/ControlScripts/Scopes/OfficeRoomScope.php
index 9b5dc93..63dc8df 100644
--- a/server/ControlScripts/Scopes/OfficeRoomScope.php
+++ b/server/ControlScripts/Scopes/OfficeRoomScope.php
@@ -30,7 +30,7 @@
$this -> add_action_script([
"alias" => "craft_table_lamp_switch",
"name" => "Крафт. лампа",
- "icon" => '>',
+ "icon" => '',
"description" => "Вкл/Выкл. настольную лампу на столе для крафта",
"author" => "Eugene Sukhodolskiy"
], function($params) {