@@ -242,7 +242,7 @@ async def set_switch_state(
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 """
245- req_state = state == STATE_ON
245+ requested_state = state == STATE_ON
246246 switch = Munch ()
247247 switch .actuator = "actuator_functionalities"
248248 switch .func_type = "relay_functionality"
@@ -271,7 +271,7 @@ async def set_switch_state(
271271 "</appliances>"
272272 )
273273 await self .call_request (APPLIANCES , method = "post" , data = data )
274- return req_state
274+ return requested_state
275275
276276 # Handle group of switches
277277 data = f"<{ switch .func_type } ><state>{ state } </state></{ switch .func_type } >"
@@ -284,10 +284,10 @@ async def set_switch_state(
284284 uri = f"{ APPLIANCES } ;id={ appl_id } /relay"
285285 if model == "relay" and self .gw_entities [appl_id ]["switches" ]["lock" ]:
286286 # Don't bother switching a relay when the corresponding lock-state is true
287- return False
287+ return not requested_state
288288
289289 await self .call_request (uri , method = "put" , data = data )
290- return req_state
290+ return requested_state
291291
292292 async def _set_groupswitch_member_state (
293293 self , data : str , members : list [str ], state : str , switch : Munch
@@ -296,7 +296,7 @@ async def _set_groupswitch_member_state(
296296
297297 Set the given State of the relevant Switch (relay) within a group of members.
298298 """
299- req_state = state == STATE_ON
299+ requested_state = state == STATE_ON
300300 switched = 0
301301 for member in members :
302302 if not self .gw_entities [member ]["switches" ]["lock" ]:
@@ -305,9 +305,9 @@ async def _set_groupswitch_member_state(
305305 switched += 1
306306
307307 if switched > 0 :
308- return req_state
309- else :
310- return not req_state # pragma: no cover
308+ return requested_state
309+
310+ return not requested_state # pragma: no cover
311311
312312 async def set_temperature (self , _ : str , items : dict [str , float ]) -> None :
313313 """Set the given Temperature on the relevant Thermostat."""
0 commit comments