@ptdalen et all,
Please allow me to add to you analysis of 2 reasons. I think there are 3
1- interference with other wireless topologies. Can’t say I’ve been hampered by that, but some are, and solutions have been suggested. Even Hue has that builtin their app, changing to another Zigbee channel could solve that, as does changing router channels.
2- Don’t forget Hue lights due really turn unavailable sometimes. I see that happening too, but, that is on an individual light basis, and doesn’t cause the Hue hub to go unavailable. In fact, it should show the lights unavailable, because they are.
3- The main issue.Tthis is the most unclear and most frustrating reason, and has been so for almost a year now… Still not solved.
It seems to boil down to I/O happening in your system, which causes the Hue Hub to go unavailable and hence show all lights unavailable. Why only the Hue integration suffers from that is beyond me or even the dev’s for that matter, because no answers are given when asked. Seems to also have to do with the fact HA needs to poll the Hue, versus components changes pushed.
Solution for now:
My Mqtt broker (which I had on my main system) is one of those I/O troublemakers, so I moved that to another RPi. Ive had my share of binary_sensors, deleted these, and that gave some relieve. Bluetooth is another known factor. If you only check the startup log, and see how long it takes for that component to setup, alarm bells should ring. Taken that out too. (Maybe better filed under 2… still seems a HA heavy I/O thing)
All in all, I now have 2 systems: a HA Mqtt ‘hub’, with bluetooth and some other administrative things, and my main system, that subscribes to the mqtt topics I need (my Mqtt broker receives many more topics, that are now not overflowing the main systems statemachine.
Only times when my main system is showing unavailable now, is when I do some system checking, or reloading/freshing Lovelace. Regular Ha seems steadier than ever.
I can now wake up and see my lights having a last_changed of over 6 hours While on the Mqtt system last_changed of over more than half an hour is a rarity.
As a side note: if individual lights show unavailable, try switching the group, and see the lights toggle… show the lights are reachable and HA incorrectly states they aren’t.
Hope this helps.
cheers.