|
@@ -161,23 +161,23 @@ class ground_floor_west_dirk(room_shelly_tradfri_light):
|
161
|
161
|
self.gui_switch_pc_dock.set_feedback(data)
|
162
|
162
|
|
163
|
163
|
def cd_amplifier_synchronisation(self, device, key, data):
|
164
|
|
- if device == self.powerplug_common:
|
165
|
|
- if self.cvi.changed_here(device.topic, key, data):
|
166
|
|
- logger.info("Setting \"%s\" amplifier: %s", type(self).__name__, data)
|
167
|
|
- self.powerplug_common.set_output_0(data)
|
|
164
|
+ if self.cvi.changed_here(device.topic, key, data) and device.previous_value(key) is not None:
|
|
165
|
+ logger.info("Syncing \"%s\" amplifier with cd player: %s", type(self).__name__, data)
|
|
166
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_AMPLIFIER, data)
|
168
|
167
|
|
169
|
168
|
def raspi_amplifier_synchronisation(self, device, key, data):
|
170
|
|
- if self.cvi.changed_here(device.topic, key, data):
|
171
|
|
- logger.info("Setting \"%s\" amplifier: %s", type(self).__name__, data)
|
172
|
|
- self.powerplug_common.set_output_0(data)
|
|
169
|
+ if self.cvi.changed_here(device.topic, key, data) and device.previous_value(key) is not None:
|
|
170
|
+ logger.info("Syncing \"%s\" amplifier with raspi player: %s", type(self).__name__, data)
|
|
171
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_AMPLIFIER, data)
|
173
|
172
|
|
174
|
173
|
def desk_light_switch_action(self, device, key, data):
|
175
|
174
|
if device == self.button_tradfri:
|
176
|
|
- logger.info("Toggeling \"%s\" desk light to %s", type(self).__name__, not self.powerplug_common.output_1)
|
177
|
|
- self.powerplug_common.set_output_1("toggle")
|
|
175
|
+ logger.info("Toggeling \"%s\" desk light to %s", type(
|
|
176
|
+ self).__name__, not self.get(self.KEY_POWERPLUG_AMPLIFIER))
|
|
177
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_AMPLIFIER, "toggle")
|
178
|
178
|
else:
|
179
|
179
|
logger.info("Setting \"%s\" desk light: %s", type(self).__name__, data)
|
180
|
|
- self.powerplug_common.set_output_1(data)
|
|
180
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_DESK_LIGHT, data)
|
181
|
181
|
|
182
|
182
|
def desk_light_set_gui_params_action(self, device, key, data):
|
183
|
183
|
if key == devices.nodered_gui.KEY_BRIGHTNESS:
|
|
@@ -195,27 +195,30 @@ class ground_floor_west_dirk(room_shelly_tradfri_light):
|
195
|
195
|
|
196
|
196
|
def amplifier_switch_action(self, device, key, data):
|
197
|
197
|
if device == self.button_tradfri:
|
198
|
|
- logger.info("Toggeling \"%s\" amplifier to %s", type(self).__name__, not self.powerplug_common.output_0)
|
199
|
|
- self.powerplug_common.set_output_0("toggle")
|
|
198
|
+ logger.info("Toggeling \"%s\" amplifier to %s", type(self).__name__,
|
|
199
|
+ not self.powerplug_common.get(self.KEY_POWERPLUG_AMPLIFIER))
|
|
200
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_AMPLIFIER, "toggle")
|
200
|
201
|
else:
|
201
|
202
|
logger.info("Setting \"%s\" amplifier: %s", type(self).__name__, data)
|
202
|
|
- self.powerplug_common.set_output_0(data)
|
|
203
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_AMPLIFIER, data)
|
203
|
204
|
|
204
|
205
|
def cd_player_switch_action(self, device, key, data):
|
205
|
206
|
if device == self.button_tradfri:
|
206
|
|
- logger.info("Toggeling \"%s\" cd_player to %s", type(self).__name__, not self.powerplug_common.output_2)
|
207
|
|
- self.powerplug_common.set_output_2("toggle")
|
|
207
|
+ logger.info("Toggeling \"%s\" cd_player to %s", type(self).__name__,
|
|
208
|
+ not self.powerplug_common.get(self.KEY_POWERPLUG_CD_PLAYER))
|
|
209
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_CD_PLAYER, "toggle")
|
208
|
210
|
else:
|
209
|
211
|
logger.info("Setting \"%s\" cd_player: %s", type(self).__name__, data)
|
210
|
|
- self.powerplug_common.set_output_2(data)
|
|
212
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_CD_PLAYER, data)
|
211
|
213
|
|
212
|
214
|
def pc_dock_switch_action(self, device, key, data):
|
213
|
215
|
if device == self.button_tradfri:
|
214
|
|
- logger.info("Toggeling \"%s\" pc_dock to %s", type(self).__name__, not self.powerplug_common.output_3)
|
215
|
|
- self.powerplug_common.set_output_3("toggle")
|
|
216
|
+ logger.info("Toggeling \"%s\" pc_dock to %s", type(self).__name__,
|
|
217
|
+ not self.powerplug_common.get(self.KEY_POWERPLUG_PC_DOCK))
|
|
218
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_PC_DOCK, "toggle")
|
216
|
219
|
else:
|
217
|
220
|
logger.info("Setting \"%s\" pc_dock: %s", type(self).__name__, data)
|
218
|
|
- self.powerplug_common.set_output_3(data)
|
|
221
|
+ self.powerplug_common.set_output(self.KEY_POWERPLUG_PC_DOCK, data)
|
219
|
222
|
|
220
|
223
|
def device_chooser_action(self, device, key, data):
|
221
|
224
|
if device == self.main_light_shelly:
|
|
@@ -243,9 +246,9 @@ class ground_floor_west_dirk(room_shelly_tradfri_light):
|
243
|
246
|
if state == self.STATE_ACTIVE_DEVICE_MAIN_LIGHT:
|
244
|
247
|
return self.main_light_shelly.output_0
|
245
|
248
|
elif state == self.STATE_ACTIVE_DEVICE_DESK_LIGHT:
|
246
|
|
- return self.powerplug_common.output_1
|
|
249
|
+ return self.powerplug_common.get(self.KEY_POWERPLUG_DESK_LIGHT)
|
247
|
250
|
elif state == self.STATE_ACTIVE_DEVICE_AMPLIFIER:
|
248
|
|
- return self.powerplug_common.output_0
|
|
251
|
+ return self.powerplug_common.get(self.KEY_POWERPLUG_AMPLIFIER)
|
249
|
252
|
|
250
|
253
|
def choose_next_device(self, device=None, key=None, data=None):
|
251
|
254
|
if self.active_device_state is not None:
|