Zigbee2mqtt, trådfri, checking if lights are on/off

Ikea lightbulb, paired to zigbee2mqtt dongle (overall few tens of zigbees, but that’s possibly irrelevant). Using automation, e.g. switch off all lights etc. But also using the oldie manual wall switches to turn lamps off by cutting the power.

When using manual wall switch, HA state does not change. Either direction. So if the light is ‘on’ in HA, and I use the wall switch to turn it off, in HA it stays ‘on’. If the light is ‘off’ in HA, and I use the wall switch to turn it on, it stays ‘off’ in HA.

I found a year-old thread (Test if Tradfri light is available/reachable?) where was some automation to make a periodic check on the lights, but that did not work.

Any hints, how to make some automated check on Ikea lightbulbs to update HA state?

…and seems like it’s a good idea to post questions in here. After days of googling, browsing this community and trying, I post my question. And 5min later I find the solution from here:

what exactly do you mean with ‘doesn’t work’? It still does here…

Well, possibly bit hard to say, as it didn’t work for me. It did nothing, and states stay as they are. Anyway, suppose there are million reasons, starting from my incompetence. But at least the "availability_timeout": 60 in zigbee2mqtt config suits my need excellent.

ok great you got it working, would have loved to help.