I’m building some e-ink displays that are using hundreds of sensor data points to build a few screens. Currently, I’ve tried two solutions since I built my own data collector in Home Assistant (from a JSON template.)
The first one is a single attribute per data point (works mostly okay - just need hundreds of them)
- platform: homeassistant
entity_id: sensor.weatherflow_hourly_forecast_0
id: wf_h_fc_0_air_temperature
attribute: air_temperature
(Looks like this in HA)
air_temperature: 82
am_pm: AM
conditions: Clear
icon: /
local_hour: 10
pixel_height: 90
precip_probability: 0
friendly_name: weatherflow_hourly_forecast_0
The second I’m asking about is how to use a Home Assistant attribute that contains a JSON array. (Would be great to load in just a few sensors with many arrays)
- platform: homeassistant
entity_id: sensor.weatherflow_hourly_forecast
id: wf_h_fc_0_air_temperature
attribute: air_temperature[0]
(Looks like this in HA)
air_temperature: 84, 84, 82, 84, 84, 84, 84, 82, 81, 77, 75, 73, 72, 70, 68, 68, 66, 66, 64, 64, 64, 66, 70, 72
am_pm: AM, PM, PM, PM, PM, PM, PM, PM, PM, PM, PM, PM, PM, AM, AM, AM, AM, AM, AM, AM, AM, AM, AM, AM
conditions: Clear, Clear, Partly Cloudy, Partly Cloudy, Partly Cloudy, Partly Cloudy, Cloudy, Cloudy, Cloudy, Cloudy, Partly Cloudy, Rain Possible, Partly Cloudy, Rain Possible, Rain Likely, Rain Likely, Rain Likely, Rain Likely, Thunderstorms Likely, Rain Likely, Rain Likely, Rain Possible, Thunderstorms Possible, Cloudy
icon: /, /, R, R, R, R, a, a, a, a, A, D, A, D, b, b, b, b, w, b, b, E, y, a
local_hour: 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
pixel_height: 100, 100, 90, 100, 100, 100, 100, 90, 85, 65, 55, 45, 40, 30, 20, 20, 10, 10, 0, 0, 0, 10, 30, 40
precip_probability: 0, 0, 0, 0, 0, 0, 0, 0, 5, 15, 15, 25, 15, 20, 50, 80, 85, 80, 85, 90, 50, 40, 40, 10
friendly_name: weatherflow_hourly_forecast
It doesn’t look like there is any ability to use JSON arrays stored in a Home Assistant attribute that I can see. I do see that an array comes across as a text string when debugging but it’s not usable as a number. I’m also not sure how to use something like this in a LAMBDA state:
it.printf(hourly_hour_x, hourly_temperature_y - id(wf_h_fc_0_pixel_height).state, id(font_hourly), TextAlign::BOTTOM_RIGHT, "%.0f", id(wf_h_fc_0_air_temperature).state);
Any thoughts on how others may have accomplished this? Being able to pull out an array for a sensor would greatly simplify how I load and manage the data in Home Assistant. Instead of running lots of scripts, I could use a single script with arrays of data. It also allows me to use other sources of data in Home Assistant that use JSON arrays in attributes. And lastly - instead of pulling hundreds of sensors into esphome, I would be able to just pull a few of the sensors and break out the data. Asking the home assistant API in esphome to pull a large number of sensors takes a very long time and sometimes hiccups where data doesn’t get responded to.
Thanks!