File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -611,15 +611,17 @@ async def set_schedule_state(
611611 """Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.
612612
613613 Determined from - DOMAIN_OBJECTS.
614- In HA Core used to set the hvac_mode: in practice switch between schedule on - off.
614+ Used in HA Core to set the hvac_mode: in practice switch between schedule on - off.
615615 """
616616 # Input checking
617617 if new_state not in ["on" , "off" ]:
618618 raise PlugwiseError ("Plugwise: invalid schedule state." )
619619 if name is None :
620620 for device in self .gw_devices :
621- if device ["location" ] == loc_id :
621+ if device ["location" ] == loc_id and device [ "last_used" ] :
622622 name = device ["last_used" ]
623+ else :
624+ return
623625
624626 if self ._smile_legacy :
625627 await self ._set_schedule_state_legacy (loc_id , name , new_state )
You can’t perform that action at this time.
0 commit comments