I would like to limit the amount of sensors in ESPHome. Therefore I created a sensor in HA that gives as a event0start
for example 2022-09-14 17:30:00+02:00
In ESPHome I setup a Home Assistant text-sensor like this:
- platform: homeassistant
id: event0start
entity_id: sensor.calendaritems
attribute: event0start
Now I am trying to convert this sensor into a more readable format in ESPHome for my epaper screen. I’ve tried this:
it.strftime(436, 223, id(tm20), "%H:%M", id(event0start).state);
It doesn’t want to compile with the error:
error: no matching function for call to 'esphome::display::DisplayBuffer::strftime(int, int, esphome::display::Font*&, const char [6], std::__cxx11::string&)'
it.strftime(436, 223, id(tm20), "%H:%M", id(event0start).state);
^
I have also tried to import the HA sensor just a sensor (not a text sensor) and then the error is:
error: no matching function for call to 'esphome::display::DisplayBuffer::strftime(int, int, esphome::display::Font*&, const char [6], float&)'
it.strftime(436, 223, id(tm20), "%H:%M", id(event0start).state);
^
I know I can do the formatting at HA’s side, but then I would have to create seperate sensors for the time and the year. And with an end time and day and several agenda-items this starts to add up.
I know how to convert the time(homeassistant).now()
into the correct format, but how to replace time(homeassistant)
with a state of one of the sensors, I cannot find anywhere.
If anyone can help.