Bladeren bron

Bluetooth Belkin adapter added (powerplug and amoplifier source selection)

master
Dirk Alders 1 maand geleden
bovenliggende
commit
9fee0fc216
2 gewijzigde bestanden met toevoegingen van 14 en 7 verwijderingen
  1. 13
    7
      function/ground_floor_west.py
  2. 1
    0
      topics.py

+ 13
- 7
function/ground_floor_west.py Bestand weergeven

@@ -103,7 +103,7 @@ class ground_floor_west_dirk(room):
103 103
     AUDIO_SOURCE_PC = 0
104 104
     AUDIO_SOURCE_CD = 1
105 105
     AUDIO_SOURCE_RASPI = 2
106
-    AUDIO_SOURCE_PHONO = 3
106
+    AUDIO_SOURCE_BT = 3
107 107
 
108 108
     def __init__(self, mqtt_client, pd, vd):
109 109
         roo = props.ROO_DIR
@@ -119,6 +119,7 @@ class ground_floor_west_dirk(room):
119 119
         self.KEY_POWERPLUG_AMPLIFIER = self.powerplug_common.KEY_OUTPUT_0
120 120
         self.KEY_POWERPLUG_PHONO = self.powerplug_common.KEY_OUTPUT_1
121 121
         self.KEY_POWERPLUG_CD_PLAYER = self.powerplug_common.KEY_OUTPUT_2
122
+        self.KEY_POWERPLUG_BT = self.powerplug_common.KEY_OUTPUT_3
122 123
         # dock
123 124
         self.dock_tradfri = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
124 125
         # desk light
@@ -160,13 +161,14 @@ class ground_floor_west_dirk(room):
160 161
         # Mediaplayer - Amplifier auto on
161 162
         self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, None, self.powerplug_common.set_output_0_mcb, True)
162 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 165
         self.spotify_state.add_callback(self.spotify_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
164 166
         self.mpd_state.add_callback(self.mpd_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
165 167
         self.bt_state.add_callback(self.bt_state.KEY_STATE, None, self.powerplug_common.set_output_0_mcb, True)
166 168
         # Mediaplayer - Audio source selection
167 169
         self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, True, self.audio_source_selector, True)
168 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 172
         self.spotify_state.add_callback(self.spotify_state.KEY_STATE, True, self.audio_source_selector, True)
171 173
         self.mpd_state.add_callback(self.mpd_state.KEY_STATE, True, self.audio_source_selector, True)
172 174
         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):
207 209
             mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV,
208 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 216
         self.pc_dock_videv = videv_switching(
211 217
             mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_VIDEV,
212 218
             self.dock_tradfri, self.dock_tradfri.KEY_OUTPUT_0
@@ -232,9 +238,9 @@ class ground_floor_west_dirk(room):
232 238
         if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
233 239
             # switch on of cd player
234 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 244
         elif device in [self.spotify_state, self.mpd_state, self.bt_state]:
239 245
             # switch on raspi-source
240 246
             self.audio_source = self.AUDIO_SOURCE_RASPI
@@ -249,8 +255,8 @@ class ground_floor_west_dirk(room):
249 255
         elif self.audio_source == self.AUDIO_SOURCE_CD:
250 256
             logger.info("Sending IR command to change audio source to cd")
251 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 260
             self.remote_amplifier.set_line2()
255 261
         elif self.audio_source == self.AUDIO_SOURCE_RASPI:
256 262
             logger.info("Sending IR command to change audio source to raspi")

+ 1
- 0
topics.py Bestand weergeven

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

Laden…
Annuleren
Opslaan