[SOLVED] Transforming with map issues

  • Platform information:

    • Hardware: raspberry pi3b+
    • OS: rasbian stretch
    • Java Runtime Environment: openjdk
    • openHAB version: 2
  • Issue of the topic:
    I want to translate my window contact switch from “ON/OFF” to “OPEN/CLOSE” to use it as a contact switch.

Therefore I put following files:

default.sitemap

String item=Kabuff_Tuer_Offen

default.items

Contact Kabuff_Tuer_Offen "Kabuff Tür offen[MAP(windowdoorcontact.map):%s]" <contact> { channel="zway:zwayDevice:d5ec35fd:15:sensorBinary-ZWayVDev_zway_15-0-113-6-Door-A" }

windowdoorcontact.map

ON=OPEN
OFF=CLOSE

but it is not working at all?

Any help

You haven’t filled in any information relevant to your system
And we still don’t know what the issue is!

you were to fast sorry

The item, should be a switch item:

Switch Kabuff_Tuer_Offen "Kabuff Tür offen[MAP(windowdoorcontact.map):%s]" <contact> { channel="zway:zwayDevice:d5ec35fd:15:sensorBinary-ZWayVDev_zway_15-0-113-6-Door-A" }

The sitemap:
You should use Text in the sitemap not String

Text item=Kabuff_Tuer_Offen

is it possible to have opensymbol for windo if it displays open and a icon for closedwindow if it displays closed ?

Yes, you need yo go into the /icons/classic folder and find the contact-open.png and the contact-closed.png
Copy them and name the copies contact-on.png and contact-off.png

Where do i find the classic icon folder?

See previous post

but it is empty at my pi?

On my phone right now.
I’ll send them to you later

you can also grab them from here: https://www.openhab.org/docs/configuration/iconsets/classic/#icons

right click on the image, save as
to get the closed and open “flavors” just modify the URL

or directly in your rPi:

cd /etc/openhab2/icons/classic/
wget "https://www.openhab.org/iconsets/classic/contact-open.png"
wget "https://www.openhab.org/iconsets/classic/contact-closed.png"
cp contact-open.png contact-on.png
cp contact-closed.png contact-off.png
2 Likes

Thanks. I can never remember where to find them.
Bookmarked!

but symbol is not changed…how do i say openhab to use it?

Try changing the name from contact-on.png to contact_on do the same for the contact off.

Per the doc’s:
Example filenames:

  • Good: myswitch.svg , power_meter.png , error23.svg
  • Bad: PC_Display.svg , power-meter.png , tür⇔.svg

EDIT: @Dim pointed out that the doc’s also mention this:

"Some icons are dynamically selected by openHAB depending on the Item’s state. For example, a “switch” icon may appear to be green when the Item is “ON” and red when the item is “OFF. Behind the scenes, openHAB is actually selecting two different icon files depending upon the Item state - switch-on or switch-off . A third default icon file, switch , is required as well. This icon file matches when none of the other icon files match the Item state (e.g. when the Item is in an undefined state).”

So the original naming above should work.

If your still having issues, this shouldn’t be required but, maybe try adding the icon on your sitemap opposed to the item.

1 Like

Still not working so how do I mention it in my sitemap

As I mentioned above this shouldn’t be necessary but to add the icon on the sitemap use this:

Text item=Kabuff_Tuer_Offen icon="contact-on"

try to use a personalized name for the icon in the Item definition and rename the svgs also

maybe? OH2 doesn’t like that you are using one of the “built-in” names for the icon

1 Like

That was going to be my next suggestion.:rofl:

As Dim mentioned, try changing the name by simply adding my to the first part of the name like mycontact-on.png for the file and use mycontact-on in either the item or sitemap.

1 Like

@milo what are you using as a UI, BasicUI?

If all your icons are .png (bitmap) type then a change to the UI config may be needed. This is done in PaperUI > Confgiuration > Services > UI > Basic UI > Icon Format. Select bitmap for .png and vector for .svg

Note: If your using both types and all are located in /etc/openhab2/icons/classic then no change is needed.

1 Like

OK so if i write…

<windowcontact> 

as icon then I need three icons as *.PNG

Like windowcontact.png, windowcontact_on.png, windowcontact_off.png

Correct?

2 Likes