Browse Source

phono added to gfw.dirk

master
Dirk Alders 5 months ago
parent
commit
d25e0167a7
3 changed files with 26 additions and 1 deletions
  1. 11
    1
      devices/mydevices.py
  2. 14
    0
      function/ground_floor_west.py
  3. 1
    0
      topics.py

+ 11
- 1
devices/mydevices.py View File

172
     """
172
     """
173
     KEY_CD = "CD"
173
     KEY_CD = "CD"
174
     KEY_LINE1 = "LINE1"
174
     KEY_LINE1 = "LINE1"
175
+    KEY_LINE2 = "LINE2"
175
     KEY_LINE3 = "LINE3"
176
     KEY_LINE3 = "LINE3"
177
+    KEY_PHONO = "PHONO"
176
     KEY_MUTE = "MUTE"
178
     KEY_MUTE = "MUTE"
177
     KEY_POWER = "POWER"
179
     KEY_POWER = "POWER"
178
     KEY_VOLDOWN = "VOLDOWN"
180
     KEY_VOLDOWN = "VOLDOWN"
181
     TX_TOPIC = ''
183
     TX_TOPIC = ''
182
     TX_TYPE = base.TX_VALUE
184
     TX_TYPE = base.TX_VALUE
183
     #
185
     #
184
-    RX_IGNORE_TOPICS = [KEY_CD, KEY_LINE1, KEY_LINE3, KEY_MUTE, KEY_POWER, KEY_VOLUP, KEY_VOLDOWN]
186
+    RX_IGNORE_TOPICS = [KEY_CD, KEY_LINE1, KEY_LINE2, KEY_LINE3, KEY_PHONO, KEY_MUTE, KEY_POWER, KEY_VOLUP, KEY_VOLDOWN]
185
 
187
 
186
     def __state_logging__(self, inst, key, data):
188
     def __state_logging__(self, inst, key, data):
187
         pass    # This is just a TX device using self.set_*
189
         pass    # This is just a TX device using self.set_*
194
         self.logger.info("Changing amplifier source to LINE1")
196
         self.logger.info("Changing amplifier source to LINE1")
195
         self.send_command(self.KEY_LINE1, None)
197
         self.send_command(self.KEY_LINE1, None)
196
 
198
 
199
+    def set_line2(self, device=None, key=None, data=None):
200
+        self.logger.info("Changing amplifier source to LINE2")
201
+        self.send_command(self.KEY_LINE2, None)
202
+
197
     def set_line3(self, device=None, key=None, data=None):
203
     def set_line3(self, device=None, key=None, data=None):
198
         self.logger.info("Changing amplifier source to LINE3")
204
         self.logger.info("Changing amplifier source to LINE3")
199
         self.send_command(self.KEY_LINE3, None)
205
         self.send_command(self.KEY_LINE3, None)
200
 
206
 
207
+    def set_phono(self, device=None, key=None, data=None):
208
+        self.logger.info("Changing amplifier source to PHONO")
209
+        self.send_command(self.KEY_PHONO, None)
210
+
201
     def set_mute(self, device=None, key=None, data=None):
211
     def set_mute(self, device=None, key=None, data=None):
202
         self.logger.info("Muting / Unmuting amplifier")
212
         self.logger.info("Muting / Unmuting amplifier")
203
         self.send_command(self.KEY_MUTE, None)
213
         self.send_command(self.KEY_MUTE, None)

+ 14
- 0
function/ground_floor_west.py View File

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
 
107
 
107
     def __init__(self, mqtt_client, pd, vd):
108
     def __init__(self, mqtt_client, pd, vd):
108
         roo = props.ROO_DIR
109
         roo = props.ROO_DIR
116
         # powerplug
117
         # powerplug
117
         self.powerplug_common = pd.get(props.STG_MYA, loc, roo, props.FUN_MPP)
118
         self.powerplug_common = pd.get(props.STG_MYA, loc, roo, props.FUN_MPP)
118
         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
119
         self.KEY_POWERPLUG_CD_PLAYER = self.powerplug_common.KEY_OUTPUT_2
121
         self.KEY_POWERPLUG_CD_PLAYER = self.powerplug_common.KEY_OUTPUT_2
120
         # dock
122
         # dock
121
         self.dock_tradfri = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
123
         self.dock_tradfri = pd.get(props.STG_ZGW, loc, roo, props.FUN_DCK)
156
                                          self.dock_tradfri.toggle_output_0_mcb)
158
                                          self.dock_tradfri.toggle_output_0_mcb)
157
 
159
 
158
         # Mediaplayer - Amplifier auto on
160
         # Mediaplayer - Amplifier auto on
161
+        self.powerplug_common.add_callback(self.KEY_POWERPLUG_PHONO, None, self.powerplug_common.set_output_0_mcb, True)
159
         self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, 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)
160
         self.spotify_state.add_callback(self.spotify_state.KEY_STATE, 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)
161
         self.mpd_state.add_callback(self.mpd_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)
163
         # Mediaplayer - Audio source selection
166
         # Mediaplayer - Audio source selection
164
         self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, True, self.audio_source_selector, True)
167
         self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, True, self.audio_source_selector, True)
165
         self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, True, self.audio_source_selector, True)
168
         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)
166
         self.spotify_state.add_callback(self.spotify_state.KEY_STATE, True, self.audio_source_selector, True)
170
         self.spotify_state.add_callback(self.spotify_state.KEY_STATE, True, self.audio_source_selector, True)
167
         self.mpd_state.add_callback(self.mpd_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)
168
         self.bt_state.add_callback(self.bt_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)
195
             mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_VIDEV,
199
             mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_VIDEV,
196
             self.powerplug_common, self.KEY_POWERPLUG_AMPLIFIER
200
             self.powerplug_common, self.KEY_POWERPLUG_AMPLIFIER
197
         )
201
         )
202
+        self.phono_videv = videv_switching(
203
+            mqtt_client, config.TOPIC_GFW_DIRK_PHONO_VIDEV,
204
+            self.powerplug_common, self.KEY_POWERPLUG_PHONO
205
+        )
198
         self.cd_player_videv = videv_switching(
206
         self.cd_player_videv = videv_switching(
199
             mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV,
207
             mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_VIDEV,
200
             self.powerplug_common, self.KEY_POWERPLUG_CD_PLAYER
208
             self.powerplug_common, self.KEY_POWERPLUG_CD_PLAYER
224
         if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
232
         if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
225
             # switch on of cd player
233
             # switch on of cd player
226
             self.audio_source = self.AUDIO_SOURCE_CD
234
             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
227
         elif device in [self.spotify_state, self.mpd_state, self.bt_state]:
238
         elif device in [self.spotify_state, self.mpd_state, self.bt_state]:
228
             # switch on raspi-source
239
             # switch on raspi-source
229
             self.audio_source = self.AUDIO_SOURCE_RASPI
240
             self.audio_source = self.AUDIO_SOURCE_RASPI
238
         elif self.audio_source == self.AUDIO_SOURCE_CD:
249
         elif self.audio_source == self.AUDIO_SOURCE_CD:
239
             logger.info("Sending IR command to change audio source to cd")
250
             logger.info("Sending IR command to change audio source to cd")
240
             self.remote_amplifier.set_cd()
251
             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")
254
+            self.remote_amplifier.set_line2()
241
         elif self.audio_source == self.AUDIO_SOURCE_RASPI:
255
         elif self.audio_source == self.AUDIO_SOURCE_RASPI:
242
             logger.info("Sending IR command to change audio source to raspi")
256
             logger.info("Sending IR command to change audio source to raspi")
243
             self.remote_amplifier.set_line1()
257
             self.remote_amplifier.set_line1()

+ 1
- 0
topics.py View File

17
 TOPIC_GFW_DIRK_MAIN_LIGHT_VIDEV = "videv/gfw/dirk/main_light"
17
 TOPIC_GFW_DIRK_MAIN_LIGHT_VIDEV = "videv/gfw/dirk/main_light"
18
 TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV = "videv/gfw/dirk/desk_light"
18
 TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV = "videv/gfw/dirk/desk_light"
19
 TOPIC_GFW_DIRK_AMPLIFIER_VIDEV = "videv/gfw/dirk/amplifier"
19
 TOPIC_GFW_DIRK_AMPLIFIER_VIDEV = "videv/gfw/dirk/amplifier"
20
+TOPIC_GFW_DIRK_PHONO_VIDEV = "videv/gfw/dirk/phono"
20
 TOPIC_GFW_DIRK_CD_PLAYER_VIDEV = "videv/gfw/dirk/cd_player"
21
 TOPIC_GFW_DIRK_CD_PLAYER_VIDEV = "videv/gfw/dirk/cd_player"
21
 TOPIC_GFW_DIRK_PC_DOCK_VIDEV = "videv/gfw/dirk/pc_dock"
22
 TOPIC_GFW_DIRK_PC_DOCK_VIDEV = "videv/gfw/dirk/pc_dock"
22
 TOPIC_GFW_DIRK_ACTIVE_BRIGHTNESS_DEVICE_VIDEV = "videv/gfw/dirk/active_brightness_device"
23
 TOPIC_GFW_DIRK_ACTIVE_BRIGHTNESS_DEVICE_VIDEV = "videv/gfw/dirk/active_brightness_device"

Loading…
Cancel
Save