Streamlining motion sensor values

  • Platform information:
    • openHAB version: 3.0.2

I have the following three motion sensor items:

Switch Fibaro_Motion1 "Bathroom" { channel="zwave:device:controller:node27:alarm_motion", autoupdate="false" }

Switch Bathroom_motion { channel="zwave:device:controller:node6:alarm_motion", autoupdate="false" }

Switch cWolfPIR "Back Door PIR" (gWolfPIR) ["Alarm"] { channel="mqtt:topic:wolf_pir:occupancy" }

Adding them as points they show different values, the two zwave ones go Alarm/Ok where as the mqtt one go On/Off. I’m fine with either but I would like the value sets to be the same across the different devices. Any suggestions on the best way to accomplish that?

Thanks,

Torkil

Look at the metadata of your Items. The zwave binding supplies state options, MQTT does not. Edit as required.
Although I do think you’ll have difficulty doing that with Items defined from text file.

For visuals only you can use the meta data’s State Description’s option field.

Hi

Thanks, but I’m not quite sure what to edit. I added autoupdate=false to the MQTT item so now the metadata block look similar:

That didn’t seem to change anything, so evidently not that.

Mvh.

Torkil

That doesn’t have anything to do with it.

You will be able to see the zwave Item options with API Explorer. Your MQTT Item won’t have any.
Maybe the UI suppresses your access because these are file generated Items, but I think you’ve just missed a “more” button or suchlike.

Thanks, that works. I guess that might just be enough since the Alarm/Ok from the zwave devices also seems cosmetic and all 3 generate ON/OFF events I can use from rules.

Thank you, both!

Mvh.

Torkil

Absolutely, it does not affect underlying real Item state, it’s just about presentation.

I changed the MQTT item to this:

Switch cWolfPIR "Back Door PIR" (gWolfPIR) ["Alarm"] { channel="mqtt:topic:wolf_pir:occupancy", autoupdate="false", stateDescription=""[ options="ON=Alarm, OFF=OK" ] }

And I can see them under metadata if I go “Add metatadata” → “State description” for the MQTT item.

I couldn’t see the state options in the GUI for the 2 zwave items though, so I added them to the item file also. I guess they were injected by some internal magic prior.

Mvh.

Torkil

This is useful

Right you are, hadn’t noticed that tool =)

I still don’t understand where those are set for the zwave motion sensors since it’s just a switch in my definition, but I guess it doesn’t matter. I presume it could be inherited from the thing type or a template somewhere.

Thanks,

Torkil

Yup, it comes across the channel linked to your Item.