HA has become unavailable and devices are mostly gone

Suddenly HA had become unreachable, and I was only able to restore connection by HW reboot.

After this, I got a message that the Zigbee channel has changed. I restored from the backup as suggested.

The result is that only three devices are visible in the network. Using ZHA.
Shall I try to restore to an older backup?

It’s two months back.

Why not change the channel back to what it was?

What hardware are you running your server on?

But something you really could do with sorting is daily backups to an external source.

The channel has changed upon suggested fix. Running on Raspberry Pi 3 with Sonoff on ZHA.
The main question is how to get all devices back online. I hope I don’t need to readd them manually. The backup did not revert the state of devices.

The second one is why did it happen? I’m kind of rattled by HA instability.
See only part of the network.

I don’t use ZHA but I am assuming the same applies - this is from the changing channel documentation from Z2M. Also note that the Pi3 is no longer recommended to run HA, it’s too old and too weak.

Changing the Zigbee channel

Changing the channel of an existing Zigbee network is supported. In Zigbee, this is done by broadcasting a network update indicating the channel change. Devices that are asleep during the broadcast (usually battery powered end devices) will not switch immediately, but the next time they wake-up. It is therefore advised to trigger them after the channel change.

Warning

Some Zigbee devices do not support changing channels. In case a device remains unresponsive several minutes after the change, and after having been triggered/woken up, you may have to re-pair it manually.

Warning

Changing channels is only supported for the zstack and ember adapter.

The main reason for instability is the pi3, these no longer have enough memory to run HA. Other reasons may include the power available at the USB ports, google this to find out. Next will almost certainly be SD card if you are using one, if not it will be the USB powered SSD.

Now would be a good time to consider a hardware upgrade, this has been discussed plenty over the last few years here, so I won’t bother with my opinion on what you should invest in.

There seems to be enough memory, 0.7 GB / 1 GB. The CPU is not taxed at all, at least this time.
I am concerned that HA crashed and devices changed channels and lost all the devices. It was not a stable system, but it’s rather disastrous in this case.
Some router devices are coming online, but end devices are still offline.

It makes me think I need to re-add all dozens of devices manually (, which I dread…

You didn’t answer in regards whether you run on an SD cart, or SSD, not how much size left there either ?, But with 0.3GB left in memory, im sure your system will do alot Swap’s, during high usage, So most likely the cause of the Crash, which you will experience more of ( Until your Card/Disk gets permanently corrupted )( Might already be so )

I believe You, for above reasons

Which “fix” suggested where, by whom ?

You shouldn’t need to re-add the battery devices. If they have a button on them, pressing it once briefly should get them to show up

No!
What you see is the allocated memory.
What you do not see is the request to allocate memory which is what makes it crash when those requests are not met.
300Mb is not much and what is worse is that it is probably really fragmented, so you might only have blocks of 20Mb available and some programs need bigger blocks. It is no good that you have 2x 20Mb available when the application needs 40Mb in one block.

It’s a SD high-endurance card with 70% space left. The fix was suggested by HA itself, which it did, restoring the channel.
Is there a way to defragment the current installation or do I have to reimage?

You are confusing memory with storage memory fragments just like a disk

Look. I really hate to tell you this.. But. At the end of the day you’ll have to fix this. It simply is not supported with current HA.

This is the HA installation page…

See the tools required under Pi installation… This is why that minimum ram number exists.

I have done some investigation and it appears that the crash was due to a memory issue indeed, caused by a Python subprocess.
It’s not clear what system was using the process. The SD card is very likely not an issue.

What is most concerning is that HA in the process/after the crash changed the channel and lost the devices.

My main issue with HA Assistant in general is that Zigbee devices keep becoming unavailable and having to re-add them now is such a chore that after trying two Zigbee controllers I want to look to other hubs and routers.

And you do you but until you fix that underlying issue of HA ITSELF running out of ram… You won’t fix that. THAT (devices becoming unavailable, and the wierd channel change - prob a corruption thing invited by memory exhaustion is my bet… those don’t happen in normal running sys) was a side effect of the system. Add all the ‘hubs’ or antennas you want.

So your main issue is your HA system… Full stop.

Zigbee can take some settling in to get a reliable mesh. Read this for some good tips.

As for the channel changing, it might be that the crash has corrupted the settings file causing the channel change, just guessing as I have no experience of this issue