Using Fibaro Smart Implant with a Door Contact Sensor

Hi Forum

Ive wired my sliding gate into this sensor and get an ON=CLOSED, OFF=OPEN

My item file has this:

Switch  Gate_status    "Sliding Gate [MAP(door1.map)]"         (Group_HabPanel_Dashboard,gDoorSensors)  [ "Switchable" ] { channel="zwave:device:1a3feba2:node10:alarm_burglar1" }

With door1.map defined as:

ON=CLOSED
OFF=OPEN

For some reason, the sitemap doesnt display the correct status using:

 Text item=Gate_status label="Rear Gate []" icon="garage"

When I add %s instead of [], it shows Alarm which is different to its status in the console, or OK if theres no alarm. Even adding Alarm=OPEN and OK=CLOSED in the map doesnt appear to do it

smarthome:status Gate_status
ON
openhab>

Am I doing something wrong here?

Thanks!

The empty [ ] that you put in your sitemap entry overrides any presentation in your Item definition. “You got what you asked for” here.

This binding suggests “state options” via the channel, these enumerations will get used by default for %s (or selection widgets etc.)

Bear in mind the Item state is always ON or OFF, everything here is about presentation.

hi rossko57, the item channel then is either ‘ALARM’ or ‘OK’

So I would imagine, a translation map to convert ALARM to OPEN, and OK to CLOSED. But that appears to not do what I’m looking for.



ON=OPEN
OFF=CLOSED
OPEN=Alarm
CLOSED=OK

No, a Switch Item state is ON or OFF.
This is about presentation.

Why, where did you put it? You haven’t shown us.

You can define some [state presentation] in your Item definition label.

You can also define a different [state presentation] in your sitemap widget. This will override that of the Item definition.
So in your orginal post, [ ] overrides [MAP(door1.map)], resulting in no display.

In your original test attempt, [%s] overrides [MAP(door1.map)], and %s displays the default state options suggested by the binding. That seems like a nuisance to me, but I don’t know a way to get rid of the suggested options apart from making your own MAP.
Any such MAP will work off the Item raw state, not the binding suggested options.

Now we don’t know what your doing.
If you want the Item state shown with the [state presentation] in your Item definition, don’t put any [state presentation] at all in your sitemap widget.
or
put the [state presentation] (e.g.MAP) in the widget.

Does you map translate Alarm to Open or Open to Alarm?

It was pasted above, OPEN=ALARM

ON=OPEN
OFF=CLOSED
OPEN=Alarm
CLOSED=OK

Solved.

Created the map as ON=OPEN, OFF=CLOSED

Then added: [MAP(door1.map):%s] to the item file
Thanks for the pointers!

Glad to see you got it working. OPEN=ALARM translates OPEN to ALARM, not ALARM to OPEN so if the unit states were ALARM and OK, as per your earlier post, it still would not have worked, hence my question on what you posted.

1 Like