@@ -144,11 +144,11 @@ def _device_data_climate(
144144 device_data ["preset_modes" ] = None
145145 device_data ["active_preset" ] = None
146146 if presets := self ._presets (loc_id ):
147- presets_list = list (presets )
147+ self . _presets_list = list (presets )
148148 # Adam does not show vacation preset anymore, issue #185
149149 if self .smile_name == "Adam" :
150- presets_list .remove ("vacation" )
151- device_data ["preset_modes" ] = presets_list
150+ self . _presets_list .remove ("vacation" )
151+ device_data ["preset_modes" ] = self . _presets_list
152152
153153 device_data ["active_preset" ] = self ._preset (loc_id )
154154
@@ -486,6 +486,9 @@ async def set_schedule_state(
486486 Determined from - DOMAIN_OBJECTS.
487487 In HA Core used to set the hvac_mode: in practice switch between schedule on - off.
488488 """
489+ if state not in ["on" , "off" ]:
490+ raise PlugwiseError ("Plugwise: invalid schedule state." )
491+
489492 # Do nothing when name == None and the state does not change. No need to show
490493 # an error, as doing nothing is the correct action in this scenario.
491494 if name is None :
@@ -550,6 +553,9 @@ async def _set_preset_legacy(self, preset: str) -> None:
550553
551554 async def set_preset (self , loc_id : str , preset : str ) -> None :
552555 """Set the given Preset on the relevant Thermostat - from LOCATIONS."""
556+ if preset not in self ._presets_list :
557+ raise PlugwiseError ("Plugwise: invalid preset." )
558+
553559 if self ._smile_legacy :
554560 await self ._set_preset_legacy (preset )
555561 return
0 commit comments