51
51
SENSORS_OPTIONAL = ["humidity" , "illuminance" ]
52
52
53
53
RANDOMIZE_SEC = 5
54
+ SECONDS_PER_MIN : int = 60
54
55
55
56
56
57
# version checks
@@ -269,7 +270,7 @@ async def switch_daytime(self, kwargs: Dict[str, Any]) -> None:
269
270
self .lg (
270
271
f"set { hl (self .room .capitalize ())} to { hl (daytime ['daytime' ])} → "
271
272
f"{ 'scene' if is_scene else 'brightness' } : { hl (light_setting )} "
272
- f"{ '' if is_scene else '%' } , delay: { hl (delay )} sec " ,
273
+ f"{ '' if is_scene else '%' } , delay: { hl (natural_time ( delay )) } " ,
273
274
icon = DAYTIME_SWITCH_ICON ,
274
275
)
275
276
@@ -381,7 +382,7 @@ async def lights_on(self) -> None:
381
382
f"{ hl (self .room .capitalize ())} turned { hl (f'on' )} → "
382
383
f"{ 'hue' if self .active ['is_hue_group' ] else 'ha' } scene: "
383
384
f"{ hl (light_setting .replace ('scene.' , '' ))} "
384
- f" | delay: { hl (self .active ['delay' ])} sec " ,
385
+ f" | delay: { hl (natural_time ( int ( self .active ['delay' ]))) } " ,
385
386
icon = ON_ICON ,
386
387
)
387
388
@@ -407,7 +408,7 @@ async def lights_on(self) -> None:
407
408
self .lg (
408
409
f"{ hl (self .room .capitalize ())} turned { hl (f'on' )} → "
409
410
f"brightness: { hl (self .active ['light_setting' ])} %"
410
- f" | delay: { hl (self .active ['delay' ])} sec " ,
411
+ f" | delay: { hl (natural_time ( int ( self .active ['delay' ]))) } " ,
411
412
icon = ON_ICON ,
412
413
)
413
414
@@ -435,7 +436,7 @@ async def lights_off(self, kwargs: Dict[str, Any]) -> None:
435
436
await self .refresh_timer ()
436
437
self .lg (
437
438
f"🛁 no motion in { hl (self .room .capitalize ())} since "
438
- f"{ hl (self .active ['delay' ])} sec → "
439
+ f"{ hl (natural_time ( int ( self .active ['delay' ]))) } → "
439
440
f"but { hl (current_humidity )} %RH > "
440
441
f"{ hl (humidity_threshold )} %RH"
441
442
)
@@ -449,7 +450,7 @@ async def lights_off(self, kwargs: Dict[str, Any]) -> None:
449
450
await self .call_service ("homeassistant/turn_off" , entity_id = entity )
450
451
self .lg (
451
452
f"no motion in { hl (self .room .capitalize ())} since "
452
- f"{ hl (self .active ['delay' ])} sec → turned { hl (f'off' )} " ,
453
+ f"{ hl (natural_time ( int ( self .active ['delay' ]))) } → turned { hl (f'off' )} " ,
453
454
icon = OFF_ICON ,
454
455
)
455
456
@@ -544,7 +545,7 @@ def show_info(self, config: Optional[Dict[str, Any]] = None) -> None:
544
545
room = f" · { hl (self .config ['room' ].capitalize ())} "
545
546
546
547
self .lg ("" )
547
- self .lg (f"{ hl (APP_NAME )} { room } " , icon = self .icon )
548
+ self .lg (f"{ hl (APP_NAME )} v { hl ( __version__ ) } { room } " , icon = self .icon )
548
549
self .lg ("" )
549
550
550
551
listeners = self .config .pop ("listeners" , None )
0 commit comments