Hi all
I have simple automation, but it’s not working because as shown in the picture below the format of the time is different how can I fix it ?
I do this automation because this D1 Mini works on solar when time is pick maybe there is no power that I need after power is back sync with datetime component
Note : if D1 Mini power off after back online datetime component cannot trigger - switch.turn_on: “Schedule_Start”
time:
- platform: homeassistant
id: HA_Time
on_time_sync:
then:
- logger.log: "Synchronized system clock"
- delay: 10s
- if:
condition:
and:
- lambda: 'return ( id(HA_Time).now().timestamp => id(Start_time).state_as_esptime().timestamp );'
then:
- switch.turn_on: "Schedule_Start"
datetime:
- platform: template
name: $DeviceName $Switch_2 Start
id: "Start_time"
time_id: "HA_Time"
type: time
icon: mdi:timer-outline
optimistic: yes
initial_value: "8:00:00"
restore_value: true
on_time:
then:
- switch.turn_on: "Schedule_Start"
sensor:
- platform: template
name: "$DeviceName HA Time"
lambda: return id(HA_Time).now().timestamp;
update_interval: 5s
- platform: template
name: "$DeviceName Start Time timestamp"
lambda: return id(Start_time).state_as_esptime().timestamp ;
update_interval: 5s`
switch:
- platform: template
name: "$DeviceName $Switch_2 Schedule Start"
id: "Schedule_Start"
icon: mdi:autorenew
restore_mode: RESTORE_DEFAULT_OFF
optimistic: true