[SOLVED] Dynamic Icons not displayed in sitemap with group entries

Tags: #<Tag:0x00007f7461548238>

Hi, I’m using group items in my sitemap and would like to use dynamic icons associated with it. Unfortunately they’re not displayed.

Example:

Group item=alarm icon="siren-off" labelcolor=[>0="red"]

Is always displaying the siren in an “ON” state. The items within the group are displayed correctly. Is this a bug in the implementation of the recent stable version (2.4)?

Please post the item definition.
And try changing the icon to siren

That is not a valid icon reference, because the hyphen “-” character has a reserved function for dynamic icons.

In short, you’re not allowed hyphens in sitemap icon="xxx", or in <icon> in Item definitions, it just won’t work properly.

Does your Group Item have state of its own? They don’t by default, unless you assign an aggregate function.

Changed it to plain “siren” which has no effect. The group item definition is

Group:Number:SUM alarm "Alarms [%d]"

As your Group is of type Number, it will only work with numeric dynamic icons. It never takes ON or OFF states, could not possibly match icon-off.

If you describe what you want to happen when you have states of UNDEF , 0 , 3.2, 99, etc. we can probably offer advice.

Thank you for your support.

  • The siren-on should be displayed with a numeric value > 0 or an undef state
  • and the siren-off should be displayed with a numeric value 0.

I tried by using the visibility option and the appropriate icon with siren-on and siren-off but that doesn’t work as I wrote. I used the labelcolor which works fine with this but would’ve loved to have to proper icon, too.

That’s right, it will never work because icon parameter with hyphens is not allowed and messes up.

The easiest way to do this is to create your own dynamic icon set. You can copy the standard images to new files with new filenames.
Work out if you want .svg or .png files.

You must have a default icon with no hyphen in the filename, whether you expect to use it or not. All lowercase.
mycustomgroupicon.svg
This will show up if nothing else matches, so use this for your UNDEF requirement.
You would probably copy the standard red siren icon.

You want something different for state 0, so you need another file
mycustomgroupicon-0.svg
This will show up if the state is numeric 0, or greater with no other numeric matches.
You would probably copy the grey siren icon for this.

You want something different for state 1 or more, so you need another file
mycustomgroupicon-1.svg
This will show up if the state is numeric 1, or greater with no other numeric matches.
You would probably copy the red siren icon for this.

With that set, if the state is value 1.314 or 10 or so on, the -1 icon will be displayed.

Put your set of icons in the /conf/icons/classic folder (even if you use BasicUI) and select them in your sitemap
Group item=alarm icon="mycustomgroupicon"

Super that worked perfectly, Thanks!

1 Like