How can I use a dynamic icon e.g. light for a contact-item (that doesn’t accept ON and OFF)?
The documentation says: the icon selected is based on the mapped value used in the label (i.e. what gets returned by [MAP(file.map):%s], not the Item’s raw state.
Mapping CLOSED=ON,OPEN=OFF works, but light-off isn’t selected.
This is, because mapping does only take effect on the label, but not on the state itself. Why using a contact item for a switch at all?
GPIO-inputs must be defined as contact. For the presentation in the basic/classicUI, I would like to use e.g. a light-icon.
I think, than the documentation must be wrong.
I’m pretty sure you can use Switch even to a GPI, the only difference is Contact is RO, you have to ensure not to accidentally switch the input when using Switch (in UI you can use Text widget).
For a binary input-only, a Contact is exactly the right kind of Item.
If mapping the Contact state to ON/OFF isn’t working for icon selection, have you tried using icons that match the ‘native’ Contaact states i.e. light-open, light-closed
Yes, this could be a alternative, I had contemplabled oneself. But, I defined only light. light-open (/closed) are no standard icons. So I have to create them.
My ambition is to use the standard as possible, to have less risk and work with updates. The application also should be small and clearly.
At the moment I use a second switch-item only for the presentation and set the state in a rule.
But what does the documentation Dynamic Icons mean with: the icon selected is based on the mapped value used in the label (i.e. what gets returned by [MAP(file.map):%s], not the Item’s raw state.
Yes. And no.
I think it belongs to, what kind of thing the item shall represent. If it’s the state of a lamp, it should be a switch rather than a contact (just my opinion).