|
|
|
|
103
|
AUDIO_SOURCE_PC = 0
|
103
|
AUDIO_SOURCE_PC = 0
|
104
|
AUDIO_SOURCE_CD = 1
|
104
|
AUDIO_SOURCE_CD = 1
|
105
|
AUDIO_SOURCE_RASPI = 2
|
105
|
AUDIO_SOURCE_RASPI = 2
|
106
|
- AUDIO_SOURCE_PHONO = 3
|
|
|
|
|
106
|
+ AUDIO_SOURCE_BT = 3
|
107
|
|
107
|
|
108
|
def __init__(self, mqtt_client, pd, vd):
|
108
|
def __init__(self, mqtt_client, pd, vd):
|
109
|
roo = props.ROO_DIR
|
109
|
roo = props.ROO_DIR
|
|
|
|
|
119
|
self.KEY_POWERPLUG_AMPLIFIER = self.powerplug_common.KEY_OUTPUT_0
|
119
|
self.KEY_POWERPLUG_AMPLIFIER = self.powerplug_common.KEY_OUTPUT_0
|
120
|
self.KEY_POWERPLUG_PHONO = self.powerplug_common.KEY_OUTPUT_1
|
120
|
self.KEY_POWERPLUG_PHONO = self.powerplug_common.KEY_OUTPUT_1
|
121
|
self.KEY_POWERPLUG_CD_PLAYER = self.powerplug_common.KEY_OUTPUT_2
|
121
|
self.KEY_POWERPLUG_CD_PLAYER = self.powerplug_common.KEY_OUTPUT_2
|
|
|
122
|
+ self.KEY_POWERPLUG_BT = self.powerplug_common.KEY_OUTPUT_3
|
122
|
# dock
|
123
|
# dock
|
123
|
self.dock_tradfri = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
|
124
|
self.dock_tradfri = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
|
124
|
# desk light
|
125
|
# desk light
|
|
|
|
|
160
|
# Mediaplayer - Amplifier auto on
|
161
|
# Mediaplayer - Amplifier auto on
|
161
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, None, self.powerplug_common.set_output_0_mcb, True)
|
162
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, None, self.powerplug_common.set_output_0_mcb, True)
|
162
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, None, self.powerplug_common.set_output_0_mcb, True)
|
163
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, None, self.powerplug_common.set_output_0_mcb, True)
|
|
|
164
|
+ self.powerplug_common.add_callback(self.KEY_POWERPLUG_BT, None, self.powerplug_common.set_output_0_mcb, True)
|
163
|
self.spotify_state.add_callback(self.spotify_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
|
165
|
self.spotify_state.add_callback(self.spotify_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
|
164
|
self.mpd_state.add_callback(self.mpd_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
|
166
|
self.mpd_state.add_callback(self.mpd_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
|
165
|
self.bt_state.add_callback(self.bt_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
|
167
|
self.bt_state.add_callback(self.bt_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
|
166
|
# Mediaplayer - Audio source selection
|
168
|
# Mediaplayer - Audio source selection
|
167
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, True, self.audio_source_selector, True)
|
169
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, True, self.audio_source_selector, True)
|
168
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, True, self.audio_source_selector, True)
|
170
|
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, True, self.audio_source_selector, True)
|
169
|
- self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, True, self.audio_source_selector, True)
|
|
|
|
|
171
|
+ self.powerplug_common.add_callback(self.KEY_POWERPLUG_BT, True, self.audio_source_selector, True)
|
170
|
self.spotify_state.add_callback(self.spotify_state.KEY_STATE, True, self.audio_source_selector, True)
|
172
|
self.spotify_state.add_callback(self.spotify_state.KEY_STATE, True, self.audio_source_selector, True)
|
171
|
self.mpd_state.add_callback(self.mpd_state.KEY_STATE, True, self.audio_source_selector, True)
|
173
|
self.mpd_state.add_callback(self.mpd_state.KEY_STATE, True, self.audio_source_selector, True)
|
172
|
self.bt_state.add_callback(self.bt_state.KEY_STATE, True, self.audio_source_selector, True)
|
174
|
self.bt_state.add_callback(self.bt_state.KEY_STATE, True, self.audio_source_selector, True)
|
|
|
|
|
207
|
mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV,
|
209
|
mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV,
|
208
|
self.powerplug_common, self.KEY_POWERPLUG_CD_PLAYER
|
210
|
self.powerplug_common, self.KEY_POWERPLUG_CD_PLAYER
|
209
|
)
|
211
|
)
|
|
|
212
|
+ self.bt_videv = videv_switching(
|
|
|
213
|
+ mqtt_client, config.TOPIC_GFW_DIRK_BT_VIDEV,
|
|
|
214
|
+ self.powerplug_common, self.KEY_POWERPLUG_BT
|
|
|
215
|
+ )
|
210
|
self.pc_dock_videv = videv_switching(
|
216
|
self.pc_dock_videv = videv_switching(
|
211
|
mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV,
|
217
|
mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV,
|
212
|
self.dock_tradfri, self.dock_tradfri.KEY_OUTPUT_0
|
218
|
self.dock_tradfri, self.dock_tradfri.KEY_OUTPUT_0
|
|
|
|
|
232
|
if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
|
238
|
if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
|
233
|
# switch on of cd player
|
239
|
# switch on of cd player
|
234
|
self.audio_source = self.AUDIO_SOURCE_CD
|
240
|
self.audio_source = self.AUDIO_SOURCE_CD
|
235
|
- elif device == self.powerplug_common and key == self.KEY_POWERPLUG_PHONO:
|
|
|
236
|
- # switch on of phono
|
|
|
237
|
- self.audio_source = self.AUDIO_SOURCE_PHONO
|
|
|
|
|
241
|
+ elif device == self.powerplug_common and key == self.KEY_POWERPLUG_BT:
|
|
|
242
|
+ # switch on of bluetooth
|
|
|
243
|
+ self.audio_source = self.AUDIO_SOURCE_BT
|
238
|
elif device in [self.spotify_state, self.mpd_state, self.bt_state]:
|
244
|
elif device in [self.spotify_state, self.mpd_state, self.bt_state]:
|
239
|
# switch on raspi-source
|
245
|
# switch on raspi-source
|
240
|
self.audio_source = self.AUDIO_SOURCE_RASPI
|
246
|
self.audio_source = self.AUDIO_SOURCE_RASPI
|
|
|
|
|
249
|
elif self.audio_source == self.AUDIO_SOURCE_CD:
|
255
|
elif self.audio_source == self.AUDIO_SOURCE_CD:
|
250
|
logger.info("Sending IR command to change audio source to cd")
|
256
|
logger.info("Sending IR command to change audio source to cd")
|
251
|
self.remote_amplifier.set_cd()
|
257
|
self.remote_amplifier.set_cd()
|
252
|
- elif self.audio_source == self.AUDIO_SOURCE_PHONO:
|
|
|
253
|
- logger.info("Sending IR command to change audio source to phono")
|
|
|
|
|
258
|
+ elif self.audio_source == self.AUDIO_SOURCE_BT:
|
|
|
259
|
+ logger.info("Sending IR command to change audio source to tuner")
|
254
|
self.remote_amplifier.set_line2()
|
260
|
self.remote_amplifier.set_line2()
|
255
|
elif self.audio_source == self.AUDIO_SOURCE_RASPI:
|
261
|
elif self.audio_source == self.AUDIO_SOURCE_RASPI:
|
256
|
logger.info("Sending IR command to change audio source to raspi")
|
262
|
logger.info("Sending IR command to change audio source to raspi")
|