|
@@ -24,6 +24,9 @@ class all_functions(object):
|
24
|
24
|
self.mqtt_client = mqtt_client
|
25
|
25
|
#
|
26
|
26
|
self.__devices__ = None
|
|
27
|
+ #
|
|
28
|
+ # Rooms
|
|
29
|
+ #
|
27
|
30
|
# stairway
|
28
|
31
|
self.stw_stairway = stairway(self.mqtt_client)
|
29
|
32
|
# ground floor west
|
|
@@ -49,7 +52,16 @@ class all_functions(object):
|
49
|
52
|
# Off Buttons
|
50
|
53
|
self.init_off_functionality()
|
51
|
54
|
|
|
55
|
+ def init_cross_room_interactions(self):
|
|
56
|
+ # shelly dirk input 1
|
|
57
|
+ self.last_gfw_dirk_input_1 = None
|
|
58
|
+ self.gfw_dirk.main_light_shelly.add_callback(devices.shelly.KEY_INPUT_1, None, self.gfw_dirk_input_1)
|
|
59
|
+ # tradfri button ffe_sleep right click
|
|
60
|
+ self.ffe_sleep.button_tradfri.add_callback(devices.tradfri_button.KEY_ACTION,
|
|
61
|
+ devices.tradfri_button.ACTION_RIGHT, self.ffe_floor.main_light_shelly.toggle_output_0_mcb)
|
|
62
|
+
|
52
|
63
|
def init_off_functionality(self):
|
|
64
|
+ ##### TEMPORARY ###################################################################################################################
|
53
|
65
|
# Off Buttons
|
54
|
66
|
self.gui_button_all_off = devices.nodered_gui_button(self.mqtt_client, "gui/all/common/off/button")
|
55
|
67
|
self.gui_button_gfw_off = devices.nodered_gui_button(self.mqtt_client, "gui/gfw/common/off/button")
|
|
@@ -60,15 +72,25 @@ class all_functions(object):
|
60
|
72
|
self.gui_button_gfw_off.add_callback(devices.nodered_gui_button.KEY_STATE, True, self.gfw_off)
|
61
|
73
|
self.gui_button_ffw_off.add_callback(devices.nodered_gui_button.KEY_STATE, True, self.ffw_off)
|
62
|
74
|
self.gui_button_ffe_off.add_callback(devices.nodered_gui_button.KEY_STATE, True, self.ffe_off)
|
63
|
|
- # Long push ffe_floor
|
64
|
|
- self.ffe_floor.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.ffe_floor.all_off_feedback)
|
65
|
|
- self.ffe_floor.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.ffe_off)
|
66
|
|
- # Long push stairway
|
67
|
|
- self.stw_stairway.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.stw_stairway.all_off_feedback)
|
|
75
|
+ ##### TEMPORARY ###################################################################################################################
|
|
76
|
+
|
|
77
|
+ # ALL OFF - Long push stairway
|
|
78
|
+ self.stw_stairway.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.stw_stairway.main_light_shelly.flash_0_mcb)
|
68
|
79
|
self.stw_stairway.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.all_off)
|
69
|
|
- # Long push input device
|
|
80
|
+
|
|
81
|
+ # FFE ALL OFF - Long push ffe_floor
|
|
82
|
+ self.ffe_floor.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.ffe_floor.main_light_shelly.flash_0_mcb)
|
|
83
|
+ self.ffe_floor.main_light_shelly.add_callback(devices.shelly.KEY_LONGPUSH_0, True, self.ffe_off)
|
|
84
|
+
|
|
85
|
+ # FFE ALL OFF - Long push input device
|
70
|
86
|
self.ffe_sleep.button_tradfri.add_callback(devices.tradfri_button.KEY_ACTION, devices.tradfri_button.ACTION_RIGHT_LONG, self.ffe_off)
|
71
|
87
|
|
|
88
|
+ def gfw_dirk_input_1(self, device, key, data):
|
|
89
|
+ if self.last_gfw_dirk_input_1 is not None:
|
|
90
|
+ if self.last_gfw_dirk_input_1 != data:
|
|
91
|
+ self.gfw_floor.main_light_shelly.toggle_output_0_mcb(device, key, data)
|
|
92
|
+ self.last_gfw_dirk_input_1 = data
|
|
93
|
+
|
72
|
94
|
def getmembers(self, prefix):
|
73
|
95
|
rv = []
|
74
|
96
|
for name, obj in inspect.getmembers(self):
|
|
@@ -96,25 +118,17 @@ class all_functions(object):
|
96
|
118
|
for ffe in self.getmembers('ffe'):
|
97
|
119
|
ffe.all_off()
|
98
|
120
|
|
|
121
|
+ def stw_off(self, device=None, key=None, data=None):
|
|
122
|
+ logger.info("Switching \"stairway\" off.")
|
|
123
|
+ for stw in self.getmembers('stw'):
|
|
124
|
+ stw.all_off()
|
|
125
|
+
|
99
|
126
|
def all_off(self, device=None, key=None, data=None):
|
100
|
127
|
self.common_off(device, key, data)
|
101
|
128
|
self.gfw_off(device, key, data)
|
102
|
129
|
self.ffw_off(device, key, data)
|
103
|
130
|
self.ffe_off(device, key, data)
|
104
|
|
-
|
105
|
|
- def init_cross_room_interactions(self):
|
106
|
|
- # shelly dirk input 1
|
107
|
|
- self.last_gfw_dirk_input_1 = None
|
108
|
|
- self.gfw_dirk.main_light_shelly.add_callback(devices.shelly.KEY_INPUT_1, None, self.gfw_dirk_input_1)
|
109
|
|
- # tradfri button ffe_sleep right click
|
110
|
|
- self.ffe_sleep.button_tradfri.add_callback(devices.tradfri_button.KEY_ACTION,
|
111
|
|
- devices.tradfri_button.ACTION_RIGHT, self.ffe_floor.main_light_shelly.toggle_output_0_mcb)
|
112
|
|
-
|
113
|
|
- def gfw_dirk_input_1(self, device, key, data):
|
114
|
|
- if self.last_gfw_dirk_input_1 is not None:
|
115
|
|
- if self.last_gfw_dirk_input_1 != data:
|
116
|
|
- self.gfw_floor.main_light_shelly.toggle_output_0_mcb(device, key, data)
|
117
|
|
- self.last_gfw_dirk_input_1 = data
|
|
131
|
+ self.stw_off(device, key, data)
|
118
|
132
|
|
119
|
133
|
def devicelist(self):
|
120
|
134
|
if self.__devices__ is None:
|