@@ -282,6 +282,8 @@ async def set_auto_on_off_times(
282282 state [self ._get_key ((day_of_week , OFF , HOUR ))] = hour_off
283283 state [self ._get_key ((day_of_week , OFF , MIN ))] = minute_off
284284
285+ self .calculate_auto_sched_times (day_of_week )
286+
285287 self ._call_callbacks (entity_type = TYPE_MAIN )
286288
287289 async def set_dose (self , key = None , pulses = None ):
@@ -293,11 +295,8 @@ async def set_dose(self, key=None, pulses=None):
293295 f"set_dose: Some parameters not specified { key = } { pulses = } "
294296 )
295297
296- if isinstance (pulses , str ):
297- pulses = int (pulses )
298-
299- if isinstance (key , str ):
300- key = int (key )
298+ isinstance (pulses , str ) and (pulses := int (pulses ))
299+ isinstance (key , str ) and (key := int (key ))
301300
302301 """Validate input."""
303302 if not (1 <= pulses <= 1000 and 1 <= key <= 5 ):
@@ -320,8 +319,7 @@ async def set_dose_hot_water(self, seconds=None):
320319 if seconds is None :
321320 raise InvalidInput ("set_dose_hot_water: Seconds not specified" )
322321
323- if isinstance (seconds , str ):
324- seconds = int (seconds )
322+ isinstance (seconds , str ) and (seconds := int (seconds ))
325323
326324 """Validate input."""
327325 if not (1 <= seconds <= 30 ):
@@ -346,9 +344,7 @@ async def set_prebrew_times(self, key=None, seconds_on=None, seconds_off=None):
346344 )
347345
348346 seconds_on , seconds_off = [float (x ) for x in [seconds_on , seconds_off ]]
349-
350- if isinstance (key , str ):
351- key = int (key )
347+ isinstance (key , str ) and (key := int (key ))
352348
353349 """Validate input."""
354350 if not (
@@ -386,9 +382,7 @@ async def set_coffee_temp(self, temp=None):
386382 if temp is None :
387383 raise InvalidInput ("set_coffee__temp: Temperature not specified" )
388384
389- if isinstance (temp , str ):
390- temp = float (temp )
391-
385+ isinstance (temp , str ) and (temp := float (temp ))
392386 temp = round (temp , 1 )
393387
394388 data = self ._convert_to_ascii (int (temp * 10 ), size = 2 )
@@ -407,9 +401,7 @@ async def set_steam_temp(self, temp=None):
407401 if temp is None :
408402 raise InvalidInput ("set_steam_temp: Temperature not specified" )
409403
410- if isinstance (temp , str ):
411- temp = float (temp )
412-
404+ isinstance (temp , str ) and (temp := float (temp ))
413405 temp = round (temp , 1 )
414406
415407 data = self ._convert_to_ascii (int (temp * 10 ), size = 2 )
0 commit comments