Bluetooth Belkin adapter added (powerplug and amoplifier source selection)

This commit is contained in:
Dirk Alders 2024-11-10 15:29:30 +01:00
parent 4a104a5034
commit 9fee0fc216
2 changed files with 14 additions and 7 deletions

View File

@ -103,7 +103,7 @@ class ground_floor_west_dirk(room):
AUDIO_SOURCE_PC = 0
AUDIO_SOURCE_CD = 1
AUDIO_SOURCE_RASPI = 2
AUDIO_SOURCE_PHONO = 3
AUDIO_SOURCE_BT = 3
def __init__(self, mqtt_client, pd, vd):
roo = props.ROO_DIR
@ -119,6 +119,7 @@ class ground_floor_west_dirk(room):
self.KEY_POWERPLUG_AMPLIFIER = self.powerplug_common.KEY_OUTPUT_0
self.KEY_POWERPLUG_PHONO = self.powerplug_common.KEY_OUTPUT_1
self.KEY_POWERPLUG_CD_PLAYER = self.powerplug_common.KEY_OUTPUT_2
self.KEY_POWERPLUG_BT = self.powerplug_common.KEY_OUTPUT_3
# dock
self.dock_tradfri = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
# desk light
@ -160,13 +161,14 @@ class ground_floor_west_dirk(room):
# Mediaplayer - Amplifier auto on
self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, None, self.powerplug_common.set_output_0_mcb, True)
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, None, self.powerplug_common.set_output_0_mcb, True)
self.powerplug_common.add_callback(self.KEY_POWERPLUG_BT, None, self.powerplug_common.set_output_0_mcb, True)
self.spotify_state.add_callback(self.spotify_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
self.mpd_state.add_callback(self.mpd_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
self.bt_state.add_callback(self.bt_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
# Mediaplayer - Audio source selection
self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, True, self.audio_source_selector, True)
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, True, self.audio_source_selector, True)
self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, True, self.audio_source_selector, True)
self.powerplug_common.add_callback(self.KEY_POWERPLUG_BT, True, self.audio_source_selector, True)
self.spotify_state.add_callback(self.spotify_state.KEY_STATE, True, self.audio_source_selector, True)
self.mpd_state.add_callback(self.mpd_state.KEY_STATE, True, self.audio_source_selector, True)
self.bt_state.add_callback(self.bt_state.KEY_STATE, True, self.audio_source_selector, True)
@ -207,6 +209,10 @@ class ground_floor_west_dirk(room):
mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV,
self.powerplug_common, self.KEY_POWERPLUG_CD_PLAYER
)
self.bt_videv = videv_switching(
mqtt_client, config.TOPIC_GFW_DIRK_BT_VIDEV,
self.powerplug_common, self.KEY_POWERPLUG_BT
)
self.pc_dock_videv = videv_switching(
mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV,
self.dock_tradfri, self.dock_tradfri.KEY_OUTPUT_0
@ -232,9 +238,9 @@ class ground_floor_west_dirk(room):
if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
# switch on of cd player
self.audio_source = self.AUDIO_SOURCE_CD
elif device == self.powerplug_common and key == self.KEY_POWERPLUG_PHONO:
# switch on of phono
self.audio_source = self.AUDIO_SOURCE_PHONO
elif device == self.powerplug_common and key == self.KEY_POWERPLUG_BT:
# switch on of bluetooth
self.audio_source = self.AUDIO_SOURCE_BT
elif device in [self.spotify_state, self.mpd_state, self.bt_state]:
# switch on raspi-source
self.audio_source = self.AUDIO_SOURCE_RASPI
@ -249,8 +255,8 @@ class ground_floor_west_dirk(room):
elif self.audio_source == self.AUDIO_SOURCE_CD:
logger.info("Sending IR command to change audio source to cd")
self.remote_amplifier.set_cd()
elif self.audio_source == self.AUDIO_SOURCE_PHONO:
logger.info("Sending IR command to change audio source to phono")
elif self.audio_source == self.AUDIO_SOURCE_BT:
logger.info("Sending IR command to change audio source to tuner")
self.remote_amplifier.set_line2()
elif self.audio_source == self.AUDIO_SOURCE_RASPI:
logger.info("Sending IR command to change audio source to raspi")

View File

@ -19,6 +19,7 @@ TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV = "videv/gfw/dirk/desk_light"
TOPIC_GFW_DIRK_AMPLIFIER_VIDEV = "videv/gfw/dirk/amplifier"
TOPIC_GFW_DIRK_PHONO_VIDEV = "videv/gfw/dirk/phono"
TOPIC_GFW_DIRK_CD_PLAYER_VIDEV = "videv/gfw/dirk/cd_player"
TOPIC_GFW_DIRK_BT_VIDEV = "videv/gfw/dirk/bt"
TOPIC_GFW_DIRK_PC_DOCK_VIDEV = "videv/gfw/dirk/pc_dock"
TOPIC_GFW_DIRK_ACTIVE_BRIGHTNESS_DEVICE_VIDEV = "videv/gfw/dirk/active_brightness_device"
TOPIC_GFW_DIRK_AUDIO_PLAYER_VIDEV = "videv/gfw/dirk/audio_player"