I’m trying to distinguish the way a zigbee bulb is turned on: by a hass automation vs power on. The bulb is in a standard socket with a standard on-off switch, and I’d like to reset the bulb state after its been powered off.
The bulb is an IKEA bulb, and the log for it tells me the information that I need (eg turned on my automation such and such). So the information is si avilable. How can I access this?
I’ve seen previous posts (eg for thermostats) that try to do the same, but the method didn’t work for me.
What state do you hope to reset? You cannot change properties of lights that are off. Setting color or brightness will turn the light on with that color/brightness. That is not a HA thing, but inherent to the way smart bulbs (regrettably) work.
Making sure the light returns to its state when power is restored should be done by the light itself. There’s no way Home Assistant can do that reliably. Most lights have a firmware setting for this. Note that having smart bulbs cut off power is not wise to begin with, especially for ones that need to form a mesh. They need to be able to pass on information to further nodes.
So to answer your question, the information you are after is in the context, but it is likely of little use. If the light itself changes state, there is no user or automation in the context. Note that this is not per se indicative of a user action at the hardware side. For instance, if a device goes from unavailable to available, the state will be set according to the device current state also:
To tell if a device that returns after it was offline, you can look at the state change from unvailable to something else. But this too happens also when e.g. an integration loads at startup.