So I have been trying to make an e-paper ESP32 driven dashboard. I am amble to pull in the current date and other information just fine. However, I am trying to pull in a forecast for the next 3 days with the day’s names (“Mon”, “Wed”, etc). I have tried a few different ways of doing this so I am happy to try others.
I can see that the state of the entity is a timestamp.
In my ESPHome Yaml I have tried adding it as a sensor and a text_sensor at different times.
text_sensor:
- platform: homeassistant
id: weather_now_icon
entity_id: sensor.pirateweather_current_icon
- platform: homeassistant
id: weather_icon_d1
entity_id: sensor.pirateweather_icon_1d
- platform: homeassistant
id: forecast_d1_day
entity_id: sensor.pirateweather_time_1d
However, no matter what way I try to put that on the ESPHome screen I cannot get it to work. Yes I have read the date stuff on ESPHome’s support pages, the difference is I am not pulling the default HA time and instead a different timestamp from a sensor in HA.
Second to last line has latest iteration, but don’t let that stop you from suggesting something else. All iterations so far have resulted in displaying “0x0p+0”
lambda: |-
// Map weather states to MDI characters.
std::map<std::string, std::string> weather_icon_map
{
{"cloudy", "\U000F0590"},
{"cloudy-alert", "\U000F0F2F"},
{"cloudy-arrow-right", "\U000F0E6E"},
{"fog", "\U000F0591"},
{"hail", "\U000F0592"},
{"hazy", "\U000F0F30"},
{"hurricane", "\U000F0898"},
{"lightning", "\U000F0593"},
{"lightning-rainy", "\U000F067E"},
{"clear-night", "\U000F0594"},
{"night-partly-cloudy", "U000F0F31"},
{"partlycloudy", "\U000F0595"},
{"partly-lightning", "\U000F0F32"},
{"partly-rainy", "\U000F0F33"},
{"partly-snowy", "\U000F0F34"},
{"partly-snowy-rainy", "\U000F0F35"},
{"pouring", "\U000F0596"},
{"rainy", "\U000F0597"},
{"snowy", "\U000F0598"},
{"snowy-heavy", "\U000F0F36"},
{"snowy-rainy", "\U000F067F"},
{"sunny", "\U000F0599"},
{"clear-day", "\U000F0599"},
{"sunny-alert", "\U000F0F37"},
{"sunny-off", "\U000F14E4"},
{"sunset", "\U000F059A"},
{"sunset-down", "\U000F059B"},
{"sunset-up", "\U000F059C"},
{"tornado", "\U000F0F38"},
{"windy", "\U000F059D"},
{"windy-variant", "\U000F059E"},
};
// Top Row of Dashboard
it.print(it.get_width(), 0, id(small), TextAlign::TOP_RIGHT, "My City");
it.strftime(it.get_width(), 33, id(small), TextAlign::TOP_RIGHT, "%a, %b %d", id(homeassistant_time).now());
it.printf(0, 4, id(font_mdi_large), "%s", weather_icon_map[id(weather_now_icon).state.c_str()].c_str());
it.printf(60, 0, id(medium), "%.0f°", id(temp_now).state);
it.printf(0, 65, id(tiny), "Feels like %.0f°", id(feels_like).state);
it.printf(5, 86, id(tiny), "Precip %.0f%%", id(today_precip_chance).state);
// Middle Row of Dashboard
it.printf(100, 125, id(tiny), id(forecast_d1_day).state.strftime("%a"));
it.printf(100, 145, id(font_mdi_large), "%s", weather_icon_map[id(weather_icon_d1).state.c_str()].c_str());