hi i having issues… i posted in another forum for HA when i was working on weather station project…
but figured id ask here in Esphome section
so i have the 2.4 enhanced screen
id like Home assistant to sync the time to the screen when i get a battery for it… so when its connected to the network it will sync the time… rest of the time… it uses the battery to keep the time…
my template.yaml i have
- name: "Display Time"
state: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%I:%M %p') }}"
icon: "mdi:calendar-clock"
- name: "Display Hour"
state: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%I') }}"
icon: "mdi:calendar-clock"
- name: "Display Minutes"
state: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%M') }}"
icon: "mdi:calendar-clock"
my esphome yaml i have some coding
time:
- platform: sntp
id: sntp_time
sensor:
- platform: homeassistant
id: sun_elevation
entity_id: sensor.sun_elevation
- platform: homeassistant # Inside temperature
id: display_time
entity_id: sensor.display_time
i have 3 text boxes in nexiton
dtime <=== to show full time 12 hour with AM/PM
hour <======= hour to show 12 hours
minutes <===== show minutes
i been playing with different ways… home assistant doesnt like my time display says its cant convert time to a number… i dont want it to convert it i just want to print it…
and the lamda
lambda: |-
// Turn display on when somebody is home. Only update when display on.
float br;
auto time_text = id(sntp_time).now().strftime("%I:%M%P");
auto hour_text = id(sntp_time).now().strftime("%I");
auto minute_text = id(sntp_time).now().strftime("%M");
it.set_component_text("dtime",time_text.c_str());
// it.set_component_text("dtime",time_text.c_str());
// it.set_component_text_printf("dtime","%I", id(display_time).c_str);
// it.set_component_text("dtime", id(display_time).state);
// it.set_component_text_printf("dtime","%I", id(display_time).state);
// it.set_component_text("hour", hour_text.c_str());
// it.set_component_text("hour", hour_text.c_str());
// it.set_component_text("minute", id(sntp_time).now().strftime("%M"));
// it.set_component_text("hour", hour_text.c_str());
// it.set_component_text("minute", minute_text.c_str());
i not getting the outcome i was hoping
for 0 errors
time to display from Home Assitant
display in 12 hour format
save it to the the screen… (when battery is there )
and sync it whenever home assistant syncs instead of me trying to pole time on the module
as i also wanted a incar display for time… so each time it connects to my network it will re sync the time.
figured id ask in here as its more narrowed for screen and esphome… as im stuck spinning my wheels googling etc