Commit 9a783b2 1 parent 408652b commit 9a783b2 Copy full SHA for 9a783b2
File tree 1 file changed +13
-8
lines changed
1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -109,13 +109,18 @@ def subscribe_for_updates(self):
109
109
def change_light (self , light , data ):
110
110
service_data = {}
111
111
service_data ['entity_id' ] = light .protocol_cfg ['entity_id' ]
112
-
113
- payload = {
114
- "type" : "call_service" ,
115
- "domain" : "light" ,
116
- "service_data" : service_data
117
- }
118
-
112
+ if light .protocol_cfg ['entity_id' ].startswith ("light." ):
113
+ payload = {
114
+ "type" : "call_service" ,
115
+ "domain" : "light" ,
116
+ "service_data" : service_data
117
+ }
118
+ elif light .protocol_cfg ['entity_id' ].startswith ("switch." ):
119
+ payload = {
120
+ "type" : "call_service" ,
121
+ "domain" : "switch" ,
122
+ "service_data" : service_data
123
+ }
119
124
payload ["service" ] = "turn_on"
120
125
if 'on' in data :
121
126
if not data ['on' ]:
@@ -183,7 +188,7 @@ def _should_include(self, ha_state):
183
188
should_include = False
184
189
diy_hue_flag = None
185
190
entity_id = ha_state .get ('entity_id' , None )
186
- if entity_id .startswith ("light." ):
191
+ if entity_id .startswith ("light." ) or entity_id . startswith ( "switch." ) :
187
192
if 'attributes' in ha_state and 'diyhue' in ha_state ['attributes' ]:
188
193
diy_hue_flag = ha_state ['attributes' ]['diyhue' ]
189
194
You can’t perform that action at this time.
0 commit comments