Determine light offline/online state?

I’ve put Lifx bulbs throughout my house as a retrofit solution to smart lighting.

This means the wall switches are still used as the primary means of control for turning them on/off.

I understand that some work has been done to allow the offline/online state of things to be read by the rules engine, but I can’t find any hints on how to use this.

Ideally my sitemap/gui would reflect whether the light is off at the wall (offline), off via an app (off, but online), or simply on (on and online).

Has anyone done this with a rule/script or have any insight on how to do this? If there is a way to do this, is there an approach so I don’t have to write variations on the below rule for each bulb?

rule "item state change"
when  
    Item Light1 changed from ONLINE to OFFLINE
then 
    Light1.sendCommand(OFF)
end

Keep in mind, that ONLINE/OFFLINE state is for the thing, not for the item :slight_smile:

Yes, you’re right. I was writing my question while trying to do a few other things at the same time.

My question still stands though. Is there a way for a rule to be fired based on the offline/online state of a thing? If there is, I think I need to look at lambda’s or functions to make a single rule apply to all the light items.

Hi Paul,

there is currently an issue in the ESH repo adressing getting the Thing status in rules:

https://github.com/eclipse/smarthome/issues/1654

So it is not possible as far as i know. I like to have such a feature, too.

Looks like it is working now:

Tried that successfully with my hue things …

Very nice.

Thanks for the heads up, i’ll have a look into getting it up and running.