You can map any State to be interpreted as ON by putting the name of that State here, e.g. CLOSED which would be interpreted as ON which I used on the Onkyo-Receiver above.
OpenClosed items indeed work well with opacity but not with color or class
If class or color is configured it just adds empty class and style attributes to corresponding svg element.
Same element configured with any OnOff item works s expected.
P.S. I have OpenHAB 4.3.0. I will upgrade it to 4.3.2 tomorrow to check if there is any improvements.
Thanks for the update! Status mapping is of course a great feature, I’ll be waiting for it. But still I think the fact that OpenClosed works with opacity but not with color or class is considered a bug and should be fixed.
I am not sure whether this is a bug. When I started with this, I considered the “ON” status the only status that would toggle an element in the SVG which is why it is called an “On-State” mapping. Only later I noticed myself that other states could be also perceived as ON like the CLOSED state though one could argue that OPEN is actually the related state to be perceived as on. Also there might be other states than open/closed that should be perceived as ON-State which is why I went to idea to allow YOU to decide which State should be perceived as ON. Doesn’t it make it more general to be used?
Speaking of the state map feature, I would like to suggest going a step further, of course, if it is possible and not too difficult. Instead of mapping ON or OFF values, implement multiple value mappings directly to colors or even better to classes e.g.
0: element1:class1, element2:class2
1: element1:class3, element2:class4
whatever: element1:class5, element2:class6
…
That would be a universal approach and it could completely abandon specific “ON color”, “OFF color”
It is possible that using only classes is a more flexible solution. Color currently simply adds a style to fill:… For example, for me, several elements such as led strip have not closed paths but simply wide lines and the fill attribute does not affect it at all, but with classes you can achieve the necessary result.
I believe that Interactive SVG Backgrounds is the best feature that has come out since the new UI with very great potential and I really hope that it will continue to develop.
Looks like an interesting idea. Can you explain a bit more the use case you have in mind?
Would you mind creating a github issue for that where you exactly explain what you intend to do with an example? Also it would be good if you attach a simple SVG and Item setup, so I would be able to test that.