Is it possible to use the datetime from a sensor in Home Assistant in ESPhome?
So I have a sensor in Home Assistant that has an attribute datetime
with the value: '2022-09-24T11:00:00+00:00'
I then import this sensor in ESPhome in the following way:
text_sensor:
- platform: homeassistant
id: datetime
entity_id: sensor.WeahterPredictions
attribute: datetime
I then try to print this on my e-paper with lambda as such:
display:
- platform: waveshare_epaper
cs_pin: 22
dc_pin: 23
busy_pin: 32
reset_pin: 21
model: 7.50in-hd-b
update_interval: 30sec
reset_duration: 2ms
rotation: 90°
lambda: |-
it.strftime(75, 518, id(tm24), color_white, TextAlign::TOP_CENTER, "%B", id(timedate).state);
This generates an error while compiling:
error: no matching function for call to 'esphome::display::DisplayBuffer::strftime(int, int, esphome::display::Font*&, esphome::Color&, esphome::display::TextAlign, const char [3], std::__cxx11::string&)'
it.strftime(75, 518, id(tm24), color_white, TextAlign::TOP_CENTER, "%B", id(timedate1).state);
^
I understand that somehow I am using the wrong format in for strftime. But I cannot figure out what format to use in order use the datetime from Home Assistant and show different aspects of that datetime in different formats throughout the dispaly, without having to make a sensor for each format. I am trying to limit the number of sensors as ram is limited for the esp32
Any help would be greatly appreciated.