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,7 +172,9 @@ class remote(base):
172 172
     """
173 173
     KEY_CD = "CD"
174 174
     KEY_LINE1 = "LINE1"
175
+    KEY_LINE2 = "LINE2"
175 176
     KEY_LINE3 = "LINE3"
177
+    KEY_PHONO = "PHONO"
176 178
     KEY_MUTE = "MUTE"
177 179
     KEY_POWER = "POWER"
178 180
     KEY_VOLDOWN = "VOLDOWN"
@@ -181,7 +183,7 @@ class remote(base):
181 183
     TX_TOPIC = ''
182 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 188
     def __state_logging__(self, inst, key, data):
187 189
         pass    # This is just a TX device using self.set_*
@@ -194,10 +196,18 @@ class remote(base):
194 196
         self.logger.info("Changing amplifier source to LINE1")
195 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 203
     def set_line3(self, device=None, key=None, data=None):
198 204
         self.logger.info("Changing amplifier source to LINE3")
199 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 211
     def set_mute(self, device=None, key=None, data=None):
202 212
         self.logger.info("Muting / Unmuting amplifier")
203 213
         self.send_command(self.KEY_MUTE, None)

+ 14
- 0
function/ground_floor_west.py View File

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

+ 1
- 0
topics.py View File

@@ -17,6 +17,7 @@ TOPIC_GFW_MARION_HEATING_VALVE_VIDEV = "videv/gfw/marion/heating_valve"
17 17
 TOPIC_GFW_DIRK_MAIN_LIGHT_VIDEV = "videv/gfw/dirk/main_light"
18 18
 TOPIC_GFW_DIRK_DESK_LIGHT_VIDEV = "videv/gfw/dirk/desk_light"
19 19
 TOPIC_GFW_DIRK_AMPLIFIER_VIDEV = "videv/gfw/dirk/amplifier"
20
+TOPIC_GFW_DIRK_PHONO_VIDEV = "videv/gfw/dirk/phono"
20 21
 TOPIC_GFW_DIRK_CD_PLAYER_VIDEV = "videv/gfw/dirk/cd_player"
21 22
 TOPIC_GFW_DIRK_PC_DOCK_VIDEV = "videv/gfw/dirk/pc_dock"
22 23
 TOPIC_GFW_DIRK_ACTIVE_BRIGHTNESS_DEVICE_VIDEV = "videv/gfw/dirk/active_brightness_device"

Loading…
Cancel
Save