I hope someone can help me with the following situation.
I have a few Ikea lighbulbs that I can control with Homey, and working to satisfaction. However, I also believe that the normal lightswitch should be working as everyone in the house is used to, and I am not planning to replace my switches around the house with Zwave or other intelligent switches. So, when the power is turned off by the switch the light goes off and when turned on the light goes on. So far so good. However that status change of the power is not registered in Homey (understandable).
With WIFI connected (xiaomi) light bulbs I use the Smart Presence app to test a device is offline or online, so I can sync the status with the power status and enable scenes when power is turned off/on.
Is there is similar possiblity with Zigbee devices, to be developed perhaps, to test if a light is offline/online in the zigbee network (ie. being powered on or not)?
I hope someone can help me with the following situation.
I also have Tradfri bulbs, but not controlled by Homey yet. My experience with only the Ikea dimmer is that the bulbs DO remember the last state if they are switched off and on by a physical switch.
Isn’t there a setting in the Homey Tradfri app or with the devices itself that you can or need to adjust?
There are no separate settings in Homey for this as far as I could find out.
I am also not looking to the lights to be restored to the state they were in; turning on the power should just turn on the light by default.
I am looking for a solution that homey knows (by a ping?) that a device is offline (powered off), so that when it comes back online that I can have an action triggered or control “lights out” via Homey or Alexa. Currently the device remains “on” in homey when power goes off, so no flows are triggered. If I can test the online vs offline status I would have a way of detecting the power is off, so in Homey it should be off as well.
Ah, ok, mis-interpreted that. Alas, i wouldn’t know if that is possible or how to do that.
I just checked with the Tradfri gateway, and it looks like that device doesn’t really notice that the power has been removed from a bulb either (I waited for about 5 minutes). Only when you make it send a command to a bulb it will notice and mark the device as offline.
So I don’t think that there is a sort of “ping” signal that can be used to check if devices are still online or not.
It seems the gateway is more aware than Homey.
With Homey I can send any command to the light bulb and it will not change status.
Perhaps with the gateway, if it regularly sends a command (which one?), it will see the status being offline or online. Could you test this?
While it might at least be a work-around for my Ikea bulbs, I would still hope that basic capability could be provided native from Homey or through some of the apps.
If I try to change either the on/off status or the dim value (from Homey using the gateway app), the gateway will notice that the device is offline in about 10 seconds. The Homey gateway app marks the device as “unavailable” at that point.
And the other way around works too: if I switch on the bulb, it takes about 5 seconds for the gateway and Homey to notice it’s back online again.
In theory, you could periodically send a “dim” command containing the same dim value that it’s already set to, or an on/off command with the same state as when the bulb was last seen, to force a status update. However, I don’t know if Homey, or the gateway app or the gateway is smart and see that you’re setting the dim value to exactly the same value, and just ignore it.
Don’t have time to test that now
That seems to work as expected: I’m running a flow that sets the brightness of the lamp to the value it had last (using a tag), and when the bulb is turned off, it’s marked offline in about 10 seconds.
Robert, Thank you.
It looks that the Tradfri gateway indeed is doing the trick. Very nice.
I am keen to see if there may be other solutions working with Homey natively - which I would still prefer.
when the power goes out, is there a clever way to tell Homey to give a command to all lights ikea equal to the last status in memory on homey?
so if I shorten that the current returns I do it by hand.
if then there was a way to understand when homey comes back online giving it automatically
I don’t think there’s a way to do that. Some lights (I think the Hue’s) can be configured to remember their last status, perhaps the IKEA lights can do the same?
Yes they do.
The Tradfri bulbs do that by default, either when powered off by remote (and still connected to 230v) or by switching them off completely with a switch or plug (no 230v).
but only if you use the ikea hub. if you connect directly to Homey without ikea hub doesn’t work.
when the power go off and on (eg blackout) the homey see the light ikea off, but the light are on.
I use the app:
by Athom B.V. v1.4.2 - 13.09.19
Let me dig this topic out - I’m also interested in tracking the state of zigbee bulbs (tradfri, hue, osram) which can be disconnected from electricity. I have two use cases:
- Possibility to check if I have turned the lights off when I left home
- Creating a flow with “bulb has been turned on” event as a trigger
Unfortunately it seems like neither case can be right now achieved using Homey Even when I periodically send “dim” command (or whatever else) - no matter if I connect bulbs to Homey directly or using Hue bridge, Homey never mark them as unavailable.
This is what happens:
- Bulbs connected to Homey directly: when I try to dim the disconnected bulb from Homey UI, it shows red error message, the new state is not remembered, but the device is still marked as available. When I dim the bulb from the flow, the new state is not remembered, but the device is still marked as available.
- Bulbs connected to Hue bridge: when I try to dim the disconnected bulb from Homey or from the flow, it doesn’t even show the red error message, the new state is remembered, everything behaves as if the change has actually happened! What really makes me mad is the fact, that the Hue bridge CAN DETECT offline devices within seconds - I don’t know how it does it, but when only I disconnect the device, the Hue app displays “unavailable” text next to this light. Maybe the Hue bridge periodically sends some kind of ping to bulb?
One workaround for bulbs connected to Homey directly is to periodically try do dim it by 1% - ex. from 100% to 99% - and then check if the state is remembered. However it requires a lot of flow cards, just to check one single bulb, I don’t know how could I parametrize it - and the result can only be stored inside variable, the UI is still incorrect.
If anybody finds the solution, I’m very interested in it!
In Domoticz i had implemented an enhanced Dzvents script that would get a JSON from the HUE bridge every minute. in this JSON the state of each lamp is described, included if they were available (reachable). The results would be stored in a table and if a lamp was not “seen” every minutes for 5 minutes, the lamp was turned off.
I’m sure the same can be done on Homey, it is just that my java script knowledge is non-existent.
The original dzVents script can be found here: (it is the third script, which does not have any dependencies https://www.domoticz.com/wiki/Simple_script_to_update_Philips_Hue_status
In short the url to get the complete light status overviewcis
where you have to put your own IP address for the bridge (so that has to become static) and your HUE-bridge key (token).
See https://www.sitebase.be/generate-phillips-hue-api-token/ to get the token.
Next the returned JSON has to be transformed into a table.
and for each lamp in the table the ‘state’ has to be checked: if the state.reachable == false while homey/HUE==ON it needs to be turned off, to sync the HUE state to the IRL state.
In the script the “state.on” is also checked and synced. (in case the lights are switched outside Domoticz. Not sure if this is also needed for Homey?
Quoted from the the dzVents script (which is based on/built on LUA)
for i, light in pairs(lights) do if (domoticz.devices( light.name ) ~= nil) then local device = domoticz.devices( light.name ) if( light.state.on == true and device.state == 'Off') then device.switchOn() elseif( light.state.on == false and device.state == 'On') then device.switchOff() elseif( light.state.reachable == false and device.state == 'On') then previousData.add( light.name )
Then the script has some extra bits with a persistent table, so that only when a light is not reachable for 5 consecutieve minutes, it will be turned off. To prevent a lamp is switched of in the first minute when a connection fails. The on/off syncing was done in the first minute.
I hope one of you could take the above to create some script? (fingers crossed). Alternatively
For hue, this will help you:
In the window you see, post to /API:
Do this after you pushed the blue button on the bridge.
This way you will get the username you need to perform these actions:
(Make sure to create a developers account to get in that api docs)
Then, make sure you can with with the better logic app (in combination with the Http flow cards). To get the light reachable status.
In Http flow cards, use under “then” the get JSON action.