sorry, but i don’t understand that would work given the condition you have:
- condition: state
entity_id: light.kitchen_1
state: 'on'
state won’t be on if the light is unavailable, hence the action won’t trigger? Ive tried many situations, and ended using !=‘unavailable’… working in any situation
I see. I had to make the distinction between being power cut and being ‘off’ with power.
I both cases my automation does its job.
cool to see each has their own needs. and solutions
I got the IKEA Tradfi Gatawey and I haven’t Zeegbee/Decons/ZHA or other USB dongle…
If I power off the Ikea Bulbs from the wall switch their status remains “on” and don’t go to “unavailable”. Only some bulbs do this, the others stay always “on” for hours/days. So, your automation give me a fake value of brightness, because in reality the bulb is switched off from the wall.
This happens also in the Ikea App (smartphone). No status updated
My Ikea Bulbs firmware for someone is 2.3.093, for others 2.3.095 (but this issue seems non related to bulbs firmare). Instead, my gateway firmware is 1.21.31.
out of curiosity: why would this still be a useful automation?
in the past, I only did this to keep the gateway alive, and controlling a single light did help. setting a light to its current state.
now I see this being executed to all lights, I am wondering why you would hammer the gateway so often, and it this isnt more hurtful than the original issue.
btw, the Ikea integration suffers terrible performance regularly, requiring restarts more than a few times per day, and even HA restarts now, to complete the integration restart…
GitHub issues for that exist since over a year and no action is taken unfortunately
It is because when a light is physically switched off, the tradfri gateway is not reporting the light as unavailable. It never did unless you change something on the light.
So this script, by slightly changing from time to time the brightness on all lights trigger the unavailable state to be reported correctly in HA. Otherwise, the light remain on/off while it is actually unavailable.
If 5 minutes is hammering the gateway, you can increase the time and/or change the group to only contains the lights that really matters (e.g.: state transition from/to unavailable used in another automation). Note: only include lights that are powered by the main line, otherwise it will drain the battery.
As I said, sending the exact same values did not work for me, the gateway being smart enough to not flood the zigbee network for nothing hence the slight change of brightness.
I see, you are still tackling that peculiar behavior.
I on the other hand am getting more and more frustrated with the integration losing touch with the gateway and requiring reload or worse , restart of Ha…
Don’t you experience that, seems way more impactful and blocking core operation because of unavailability to the system
I do of course.
I bought a sonoff micro for that particular reason that is cutting the usb cord of the tradfri gateway.
I’ve an automation to off/on the sonoff when there is a suspicion of disconnection (I compare some light sensors with the status of some key light bulbs)
If I have reasonable suspicion, I switch the sonoff, wait 1 minute then restart the IKEA integration (I used to restart HA but it seems to be from the past, at least for me)
For all those reasons, I’m moving to a Zigbee CC2531 that is plugged to my RPi. It is not very powerfull but with the meshing, it is working fine (up to 30 devices I think but still not there, for now)
Technically, Zigbee (and ZHA) are not limited in number of devices.
But the small CC2531 that was originally meant to do zigbee sniffing and that I flashed for zigbee2mqtt is not strong enough to handle more than 30 devices or very poorly probably.