ZHA Energy Scan continous?

Short question:

It is easily possible to perform an energy scan in ZHA by navigating to Settings → Devices → SkyConnect (or whichever ZHA device) → ⋮ menu → Download diagnostics

However that is a single snapshot of the current situation.

I would really like to get some data over a larger timeframe.

→ So is there any possibility to trigger this functionality automatically in an interval?

It would be suficcient if the automation just downloads the file into a directory every x minutes, I could evaluate the files later. I read a post where the zha-toolkit was mentioned but i could not find an option for the energy scan there…

I would like to perform energy scans on demand. But I presume the energy scan values in the diagnostics file are recorded at startup. So I guess when you download the diagnostics multiple times, the values won’t change (but I can be wrong)

No that does not seem to be the case…at least i always get different values for each scan

My current situation is as follows:
Everything is working flawlessly most of the time
If i perform an energy scan the values for my current channel are way below 10%

But there are sometimes short periods of time where sensors do react slow or not at all. If i am quick and perform an energy scan right at this time periods the values are going over 80%…

So there is something interfering heavily for short periods of time.

Therefore i would really like to get a bigger picture of the channel utilization over time to:
a) maybe see a pattern that helps me narrow down the source of the problem
b) find a channel that is less effected to switch over to (i want to be sure it is a better channel because changing channels is a PITA :slight_smile: )

It would be great if ZHA could provide an energy scan service with the energy values listed in the response data (min/max/median)
Having an input parameter that defines the period to scan would be nice.
Ps: checked, my diagnosis data changes as well every time I download it. Wondering it the energy scan is done while operational, or it interrupts

It really nagged me that there is no good solution to get a better overview over my zigbee channels so i implemented the following on my own:

As i am already running home assistant on docker i simply created another docker container with selenium running in it on my server.

With selenium i am able to perform an automated browser navigation…logging in to my home assistant website, navigating to the ZHA Integration page and clicking on the energy scan link there…

This action is performed in a regular interval (1min at the moment) and results in the download of the ZHA diagnostic file in a dedicated directory.

Now i have setup a node-red automation that monitors this directory and if a new file is placed there it reads the content, converts it into JSON, reads out the energy scan values for each channel and stores it in input_number helpers i have created.

The only thing left to do was to create a nice dashboard to show those values over time and I must admit, am quite happy with the result:


Here you can see the channel i am currently using for my network. Its kinda ok at this point where i took the image but the interference rises significantly from time to time.

So i am planning to migrate to another channel that looks much cleaner such as this one:


Also some spikes but much less and most importantly, there are no points in time where the interfereence got worse.

Also nice to see is how my WLAN effects channels with higher numbers:

As for the question if the scan interrups normal operations while in progress…i dont know, i think it would … but some tests, where i startet it and simultaneously triggert some sensors did not show problems…however i will lower the scan interval after some extended time of monitoring all the channels to find my final candidate to migrate to :slight_smile:

1 Like

Great work, and pity it is not a simple service call. I appreciate you tried to test normal operation while scanning👌