@@ -480,7 +480,7 @@ async def _set_schedule_state_legacy(self, name: str, status: str) -> None:
480480 await self ._request (uri , method = "put" , data = data )
481481
482482 async def set_schedule_state (
483- self , loc_id : str , name : str | None , newstate : str
483+ self , loc_id : str , name : str | None , state : str
484484 ) -> None :
485485 """Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.
486486 Determined from - DOMAIN_OBJECTS.
@@ -489,16 +489,15 @@ async def set_schedule_state(
489489 # Do nothing when name == None and the state does not change. No need to show
490490 # an error, as doing nothing is the correct action in this scenario.
491491 if name is None :
492- oldstate = "off"
493- if newstate == oldstate :
492+ if state == "off" :
494493 return
495494 # else:
496495 raise PlugwiseError (
497496 "Plugwise: cannot change schedule-state: no schedule name provided"
498497 )
499498
500499 if self ._smile_legacy :
501- await self ._set_schedule_state_legacy (name , newstate )
500+ await self ._set_schedule_state_legacy (name , state )
502501 return
503502
504503 schedule_rule = self ._rule_ids_by_name (name , loc_id )
@@ -523,10 +522,10 @@ async def set_schedule_state(
523522 subject = f'<context><zone><location id="{ loc_id } " /></zone></context>'
524523 subject = etree .fromstring (subject )
525524
526- if newstate == "off" :
525+ if state == "off" :
527526 self ._last_active [loc_id ] = name
528527 contexts .remove (subject )
529- if newstate == "on" :
528+ if state == "on" :
530529 contexts .append (subject )
531530
532531 contexts = etree .tostring (contexts , encoding = "unicode" ).rstrip ()
0 commit comments