Show item is offline in sitemap

Hi,

In OpenHAB 1 I would display offline zwave items in red using the configuration below in the sitemap:

Switch item=sChbParents labelcolor=[sChbParentsDead==ON="red"]

and the below config in the items:

Switch sChbParentsDead "Chambre parents isDead" (gZWaveStatus) {zwave="5:command=info,item=dead"}

So basically this relied on the z-wave binding exposing the state of the device.
Now it looks like OpenHAB 2 has a nice concept of status on Things (see http://docs.openhab.org/concepts/things.html – and I imagine this then extends to items?). There is an example on how to get the status on Things in rules, but I can’t see how to use this in sitemaps.

How can I make use of it to display dead items in red in my sitemap, similarly to how I was doing it in OpenHAB 1?

Thx,
Thibault.

I don’t have the latest snapshot running and the ability to get at the Thing’s status in Rules was only implemented a little less than a month ago. If you post a link to this example I can see if there was a new channel added with the Thing’s status.

If not you will have to create a Rule to update your sChbParentsDead Switch based on the Thing’s status.

Hi Rich,

Thanks for the answer, and apologies for the delay, but I’m back on this now.
Since then I upgraded to today’s snapshot build (as I needed createTimerWithArgument() which wasn’t in 2.0.0).
I’ve also realised that the code in http://docs.openhab.org/concepts/things.html looks like Java rather than Xtend, and mentions the console rather than rules.
All that to say that I am none the wiser. Do you know the syntax to get Thing’s status in rules? (as a side note, if there is new methods etc added to a new version of OpenHAB, is there a way to make them known to Eclipse Smart Home so as it sees them as valid, propose them for auto-completion, etc? Alternatively, is there a reference doc of the OH2 Xtend API somewhere?)

Also I don’t see any channel related to this Thing status in paperUI or HABmin.
You mentioned me posting a link to an example… sorry I am a bit unclear what you meant? Were you after logs or something else?

Thanks,
Thib.

No, I’m still on 2.0 and havne’t looked into it.

No, short of updating ESHD. And there are currently some things really broken about version 0.9.0 that need to be fixed and I think the focus is currently on building the Experimental Rules Engine which will be a replacement for both the current Rules Engine and ESHD.

http://docs.openhab.org/configuration/rules-dsl.html

https://eclipse.org/xtend/documentation/203_xtend_expressions.html

Does the binding recoginze the device or is it showing it as Unknown?

You said:

There is an example on how to get the status on Things in rules, but I can’t see how to use this in sitemaps.

I was asking for a link to this example.

Ok

Thanks – I wasn’t aware of the 2nd link that does look useful as a language reference. However I was rather asking on whether there is a documentation on all the classes, methods, etc that one can use in OpenHAB rules (e.g. executeCommandLine(), createTimerWithArgument(), the list of types such as GenericItem, and the methods that can be applied on it, etc). Of course CTRL+Space in ESHD is very helpful, but as discussed it is not always up to date, and sometimes it’s best to explore documentation and not fully rely on completion.

the (z-wave) devices are recognised as Things fine, and I can use them fine when online. What I am trying to do is be able to detect when they are offline (e.g. someone unplugged something so it obviously can’t take part in the z-wave network anymore) to display it differently in the sitemap, and to have my rules take into account the item is not there.
I can see OpenHAB reports them as offline, but I didn’t yet find a way to expose this in a sitemap and use this in rules.

I was referring to the code at http://docs.openhab.org/concepts/things.html#thing-status-api . But that’s java code, not Xtend.

On this particular subject though, some more googling since then lead me to https://github.com/eclipse/smarthome/pull/3001, with some more information on how to use this in rules.

http://www.eclipse.org/smarthome/documentation/javadoc/index.html

This is the javadocs for Eclipse SmartHome. Not all of these classes are available in Rules.

As for methods, those are Actions and documented here:

http://docs.openhab.org/addons/actions.html

And here:

NOTE: this link is currently being incorporated into the previous link right now.

If you figure it out please post an example either here or as a new posting in Tutorials and Examples.