How to detect Trådfri light turned on?

Hello all,

I am having a hard time detecting that our Trådfri lights have been turned on via the wall switch. Let me explain.

I have a hass.io installation on a Raspberry Pi, and also a Trådfri Gateway, and a bunch of Trådfri lightbulbs. I have installed the tradfri integration and it detects and controls all lights correctly.

However, the tradfri integration has: “IoT class: Local Polling”, which to my understanding means the Trådfri gateway does not notify HA that state has changed, but HA has to poll. This works fairly well when the lights are on (via the wall switch) and I change their status via the Trådfri app, or HA, but if turn them off and on via the wall switch, HA (and, I believe, the Trådfri gateway) miss this fact. I would like to make an automation that performs actions as soon as a light is turned on, both via software, and via the wall switch.

Ultimately, what I want is for the lights to change brightness and colour temperature depending on the time of day, but also to be able to be overriden if we want to change their brightness or colour.

Initially I had adopted a naïve approach whereby I had created an automation that runs every five seconds, and applies a scene depending on the time of day (with the correct values for each lightbulb). The problem with that was that a) if a light was off, it would turn it on again and b) we couldn’t override the brightness or colour temp, as after 5 seconds it would be set by the automation again.

What I’m trying to do is: have an automation that listens to some event that is fired once a Trådfri light has been turned on, and then depending on the time of day it sets it to different brightness and colour temp values. My issue with that is that because of what I said above, the “Device turned on” and the “state changed from off to on” (or even unavailable to on) triggers don’t work.

Can anyone think of a way to achieve this?

Bumping this after a couple of months for more visibility! :sweat_smile:

Sorry, no remedy but I have the same problem - that is - detecting/triggering when a light has been turned on and then forcing the brightness of that light depending on if it is day or night time.

Hoping for some help!