@@ -236,7 +236,7 @@ async def set_select(
236236 key : str ,
237237 appl_or_loc_id : str ,
238238 option : str ,
239- state : str | None = None ,
239+ state : int | str | None = None ,
240240 ) -> None :
241241 """Set a dhw/gateway/regulation mode or the thermostat schedule option."""
242242 match key :
@@ -257,16 +257,21 @@ async def set_select(
257257 await self .set_zone_profile (appl_or_loc_id , option )
258258
259259 async def set_dhw_mode (
260- self , key : str , appl_id : str , mode : str , length : int
260+ self , key : str , appl_id : str , mode : str , length : int | str | None = None
261261 ) -> None :
262262 """Set the domestic hot water mode.
263263
264264 Two options are known:
265265 - 2 modes, comfort and off, representing the dhw comfort mode on and off switch states,
266266 - and the 5 modes available on the Loria.
267267 """
268- if self ._dhw_allowed_modes and mode not in self ._dhw_allowed_modes :
269- raise PlugwiseError ("Plugwise: invalid dhw mode." )
268+ if (
269+ self ._dhw_allowed_modes
270+ and mode not in self ._dhw_allowed_modes
271+ or length is None
272+ or not isinstance (length , int )
273+ ):
274+ raise PlugwiseError ("Plugwise: invalid dhw mode or invalid dhw modes list." )
270275
271276 match length :
272277 case 2 :
@@ -346,7 +351,7 @@ async def set_zone_profile(self, loc_id: str, profile: str) -> None:
346351 await self .call_request (uri , method = "post" , data = data )
347352
348353 async def set_schedule_state (
349- self , loc_id : str , name : str | None = None , state : str | None = None
354+ self , loc_id : str , name : str | None = None , state : int | str | None = None
350355 ) -> None :
351356 """Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.
352357
0 commit comments