For completeness, I experimented
My custom icon set in /classic/icons
beam.png
beam-open.png
beam.closed.png
Each is a visibly different image.
Stealing a URL from my UI and using it directly in OH2.5 e.g.
http://localhost:8080/icon/beam?format=svg&anyFormat=true
(valid name, no state)
displays beam image, as we’d hope.
http://localhost:8080/icon/beam?format=svg&anyFormat=true&state=closed
(valid name, valid state)
displays beam-closed image, as we’d hope.
http://localhost:8080/icon/beam?format=svg&anyFormat=true&state=apple
(valid name, unknown state) displays beam image, again as we’d hope.
Now to “break the rules” …
http://localhost:8080/icon/beam-closed?format=svg&anyFormat=true
(naughty hyphen name but exists, no state)
shows beam-closed image. Naughty, but works.
http://localhost:8080/icon/beam-closed?format=svg&anyFormat=true&state=open
(naughty hyphen name but exists, valid state)
shows beam-open image. Oh, surprise.
http://localhost:8080/icon/beam-closed?format=svg&anyFormat=true&state=apple
(naughty hyphen name but exists, invalid state)
shows beam image, default.
http://localhost:8080/icon/beam-apple?format=svg&anyFormat=true
(invalid hyphenated name, no state)
shows beam image, default
http://localhost:8080/icon/beam-apple?format=svg&anyFormat=true&state=closed
(invalid hyphenated name, valid state)
shows beam-closed image
Conclusions:
If the UI supplies an icon request with no state (I have no idea whether any of the UIs may do that), you can get away with directly addressing a hyphenated icon.
It could happen with sitemap like - (because there is no Item to get the state of)
Text label="for pagination only" icon="myicon-off" {
But if there is a hyphenated icon name AND a state, then the picker discards the hyphenated part of the name (beam-closed) to extract a base name (beam), then builds a state-related name (beam-open). If that exists, serve it. If not, serve base/default version.
I expect the presence of state=
in the URL invokes this process.
I was wrong about picker looking for say beam-open-closed.png
, tried that and it doesn’t happen.
I’ll stick to my initial pronouncement - specifying hyphenated icon names in sitemap (or Item definitions) breaks the rules with unexpected results.
Does this logic explain your visible experience, Hans ? @hmerk