Contact Item as light status

Hi there,

I’m trying to show the status of a digital input of a modbus module.
I can show everything on the visualisation however I have 2 issues:

  • how can I invert the status, because the contact item is designed to use with window contacts and so.
  • how can I use another symbol, like a light instead of a window or door.

I think to invert a state, you will have to use another item and set it’s state via rule to the opposite state of your “input item”.
To use another than the default icon, you have to give the name of the icon at the item definition:

Contact myItem "my Label [%s]" <iconname> (group) {binding=[...]}

or at least in the sitemap:

Text item=myItem icon="iconname"

For dynamic Icons the icon has to have different images, stored as icon-open.png, icon-closed.png or (for switching) icon-off.png and icon-on.png.
Keep in mind, that there is usually an ‘default’ icon.png without any state extension.

Hey!
I have the same problem with my SPS / modbus and my window contact. What is the best way to address this for binding development?

:wink:
Thanks

Not really a binding issues, that just passes the 0s and 1s the modbus device tells it.
You could map to a Number item and assign whatever meaning you like to 0 and 1