Rookie Questions: Icons (Blinds-20) wont work; OpenHap Code Plugin,

Hey Guys,

i hope this is the correct section to ask this. Im using basic-ui btw:

Ive got some Blinds/Shutters and i’d like to display some status info. The KNX-Device gives infos like “Position Up reached” or “Position Down reached” as well as “Moving Up” and “Moving Down”. Of course it also gives the actual Position in %.

I tried the “contact” to show Status with Icon (like Blinds-0 and Blinds-100) using also visibility, but the icon is the same (standard icon) all the time, regardless if i “call” the Blinds-0 or the Blinds-100 or whatever.

I found out that the additional State-argument causes the issue - regardless of the choosen icon (same for battery and so on). So as long as openhab creates the link to the icon with like “state=OPEN” -> full example here “…/icon/battery-0?state=OPEN&format=svg”
then it doesnt work.

So what im looking for is an option to show a status with text and or icons, but not as a switch - it should just indicate something and not provide any option to operate. The icons should really show as what i configured. Like Blinds-20 should show 20 and not the standard icon.

Next Issue is, that if i like to use the features of the Code-Plugin, it doesnt do a good copy to Items and Sitemap. Are there known issues?

Like it should do this:

Switch
SMI_Aktor_1OG_Wohnzimmer_Hoehe_Verstellen
“Befehl Höhe verstellen” {channel=“knx:device:bridge:SMI_Aktor_1OG_Wohnzimmer:Hoehe_Verstellen”}

But it does this
Switch
1OGWohnzimmerSMIAktor
HoeheVerstellen
“Befehl höhe verstellen” {channel=“knx:device:bridge:SMI_Aktor_1OG_Wohnzimmer:Hoehe_Verstellen”}

As you see, the name after Switch is not correct and the Content of the quotes has only the first letter in capital, everything else is small

Another question is if and how i can assign several control-objects (Slider/Setpoint/…) next to each other.
Like for a Dimmer or whatever you use a Slider (also Shutters/Blinds), i like to have the Slider and the Setpoint next to each other. At this moment i just added both and it displays them as 2 objects. But is there an option to combine it? I dont need 2 captions/Labels or 2 columns/lines occupied, i was thinking to have one Label and both controls (Slider and Setpoint) connected to that one label. Is that possible?

Hi Daniel,

  1. if you just want to have a text displayed on the sitemap, you could use the text element. This would the plainly show whats coming from the item.
    Getting a changing icon is a bit trickier. The easiest way would be to set up multiple elements with different visibilities. Like for different ranges (0-20 show this icon_1, for 20-40 this icon_2, etc).

  2. never used it, so can’t make a statement here

  3. to combine multiple elements in one line is not possible in the basicui. This stuff can be done in the panel, but not basicui. Basicui will always structure itself in the grid of to elements next to each other

No idea what that all means really. Example please, if you want help with things you’ve tried.

Your Item type and the states that it can assume are important for dynamic icons.
For numeric types (Number, Dimmer, Rollershutter) you can have a set of icons like
mine.png
mine-0.png
mine-30.png
mine-70.png
mine-100.png
You specify the icon in Item definition or sitemap widget e.g <mine>
When the Item has a state of 55, mine-30 will be shown.
It is important to use the correct icon type, and look at the default icon type setting for your UI in your system.
It is important to have the default (no number) icon in the set.
It is important to put your icons in the correct folder.

Thanks

Well i like to have Text and or Icons and what ive tried was also using visibility. No problem so far, but however i always see the standard icon instead of the icon matching the added “-xx” where xx stands for a number like 20
Also im just using standard icons, nothing custom

I found out that if i manually call the generated url (copy link and open in browser),i also just see the standard icon regardless the -20, -80 or whatever

If i remove the stuff behind the picture (like …svg?STATE blabla and i only call the url until …svg - then it works

So i dont know yet whats causing this STATE stuff in the picture url.
Ill give you some code examples and screenshots as soon as ill find time.

The “state stuff” is what the UI sends to OH, where the icon picker does its selection.

Works for me, OH2.4, default icons set ‘blinds’ as included, plus demo as bulb-style icon.
items

Number testNum "testing [%d]" <blinds>

sitemap

Setpoint item=testNum minValue=0 maxValue=100 step=5
Text item=testNum icon="slider"

(you have to seed the number with something to get it off NULL for the setpoint to work in this quick demo)

I will give it a try.

So just to confirm: What would be the best way to display different information (true / false) and show the correct text and icon.

Like status “Blinds are moving up” or “…down”
as well as
“Blinds are in position up” or “…down”

Last example is what lead me to the blinds-icon which stays default at my switch / contact regardless what value i put.

Is there any example for Contact (or whatever you guys use to display bool information in combination with icons)?

Too woolly. What is “correct”? What sort of information are you starting from?

Of course. Did you look in the OH demo items, sitemaps, etc?

items

Contact myWindow "Sample Window [%s]" <window>

sitemap

Text myWindow

rules

rule "window demo"
when
   Time cron "0 0/1 * * * ?" // each minute
then
   if (myWindow == OPEN) {
      myWindow.postUpdate(CLOSED)
   } else {
      myWindow.postUpdate(OPEN)
   }
end

Change the text using a MAP file
items

Contact myWindow "Sample Window [MAP(pudding.map):%s]" <window>

pudding,map

CLOSED=banana
OPEN=custard
NULL=no idea

Thanks, ill try that, too

I didnt check the demo-stuff. Is there a way to install that if you didnt select it at beginning?

Not sure, what your rule does ^^ But i am also having problems with my first rule, but ill post that in another thread as its nothing with an icon :smiley:

I honestly don’t know. I doubt it.

As the comment says, it triggers each minute. What it does, you can work out.
It’s a little demo and once you say “hurrah, the window icon works” you can delete the rule forever.