Best recommendation for a lot of sensors

Hello,

I’m going to use a lot of Home Assistant sensors from the API.
It’s working well for about 25 sensors right now.
However, I plan to use about 60 sensors (it’s for displaying a lot of information through a WaveShare epaper screen).
All sensors used are template sensors created by myself in Home Assistant.
So I can create all 60 sensors and get them one by one in ESPHome. But I wonder if it would be better or not to use less sensors but instead of returning only 1 value to return a json or a list.
My concern is only about making the ESP32 life easier (having 60 sensors is not an issue if manipulating json on the ESP32 is more expensive than making 60 requests).

TLDR: Is it better to have 60 Home Assistant sensors and make 60 requests from the ESP32 or having one Home Assistant sensor which requires to manipulate a json/list to be able to get each value on the ESP32 ?

Thanks for your help and ideas :slight_smile:
(values are numbers and text, it’s mostly weather data)

I went down the 60 sensor route - mainly because I am lazy and would rather not have to stuff around with json.

The ESP has no performance issues. Maybe some slightly extra network overhead.

In what way? CPU load? Network?

The ESP32 CPU is at least a 160MHz 32-bit processor: I used to play computer games on a ZX Spectrum with a 3.5MHz 8-bit processor.

The API claims to be “a highly-optimized network protocol”. Assuming the standard HA refresh rate of one per minute for 60 sensors, that’s one sensor reading per second on average.

There’s a project that turns these devices into routers that can achieve 15Mbps.

I’d imagine the ESP32 will be twiddling its thumbs most of the time. Try it the easy way first and see what happens.

In what way? CPU load? Network?

In term of consumption, I want my ESP32 to consume the less power as possible (I may put it on battery soon).
If making 60 requests but not manipulating json is better than 1 request but dealing with json, I don’t care but I prefer the better solution to preserve the ESP32.

I may need something to measure the consumption while it is updating.

I speculate (but don’t know) that wifi would be a key driver of energy consumption. And board selection of course.

So if you could enable/disable wifi between updates I reckon there would be reasonable energy savings there?

My thought is that doing the preprocessing on the HA side and transmitting it in one go might reduce wifi connection time? Then the local CPU processing prob doesn’t add that much overhead?

I’m not sure if you added them all as attributes to a single HA template sensor and broke them out per the link below whether it would query once or multiple times for each attribute? Probably easier than processing JSON?

Take this all with a grain of salt… I dunno.

See attribute: