@@ -235,16 +235,14 @@ async def set_schedule_state(
235235
236236 async def set_switch_state (
237237 self , appl_id : str , members : list [str ] | None , model : str , state : str
238- ) -> bool :
238+ ) -> None :
239239 """Set the given state of the relevant switch.
240240
241241 For individual switches, sets the state directly.
242242 For group switches, sets the state for each member in the group separately.
243243 For switch-locks, sets the lock state using a different data format.
244244 Return the requested state when succesful, the current state otherwise.
245245 """
246- current_state = self .gw_entities [appl_id ]["switches" ]["relay" ]
247- requested_state = state == STATE_ON
248246 switch = Munch ()
249247 switch .actuator = "actuator_functionalities"
250248 switch .func_type = "relay_functionality"
@@ -273,7 +271,6 @@ async def set_switch_state(
273271 "</appliances>"
274272 )
275273 await self .call_request (APPLIANCES , method = "post" , data = data )
276- return requested_state
277274
278275 # Handle group of switches
279276 data = f"<{ switch .func_type } ><state>{ state } </state></{ switch .func_type } >"
@@ -284,12 +281,11 @@ async def set_switch_state(
284281
285282 # Handle individual relay switches
286283 uri = f"{ APPLIANCES } ;id={ appl_id } /relay"
287- if model == "relay" and self .gw_entities [appl_id ]["switches" ][ "lock" ] :
284+ if model == "relay" and self .gw_entities [appl_id ]["switches" ]. get ( "lock" ) :
288285 # Don't bother switching a relay when the corresponding lock-state is true
289- return current_state
286+ return None
290287
291288 await self .call_request (uri , method = "put" , data = data )
292- return requested_state
293289
294290 async def _set_groupswitch_member_state (
295291 self , appl_id : str , data : str , members : list [str ], state : str , switch : Munch
@@ -299,19 +295,10 @@ async def _set_groupswitch_member_state(
299295 Set the given State of the relevant Switch (relay) within a group of members.
300296 Return the requested state when at least one requested change was succesful, the current state otherwise.
301297 """
302- current_state = self .gw_entities [appl_id ]["switches" ]["relay" ]
303- requested_state = state == STATE_ON
304- switched = 0
305298 for member in members :
306- if not self .gw_entities [member ]["switches" ][ "lock" ] :
299+ if not self .gw_entities [member ]["switches" ]. get ( "lock" ) :
307300 uri = f"{ APPLIANCES } ;id={ member } /relay"
308301 await self .call_request (uri , method = "put" , data = data )
309- switched += 1
310-
311- if switched > 0 :
312- return requested_state
313-
314- return current_state # pragma: no cover
315302
316303 async def set_temperature (self , _ : str , items : dict [str , float ]) -> None :
317304 """Set the given Temperature on the relevant Thermostat."""
0 commit comments