Struggling with this and am unable to find the right terms to search for although undoubtedly I am not the first to ask…
OH 2.4
MQTT feed incoming from RF link I get data such as
From RF open/closed sensor, physical state open - rflink/EV1527/0e20a0/R/SWITCH 0a
From RF open/closed sensor, physical state closed - rflink/EV1527/0e20a0/R/SWITCH 0e
I am having issues building this input into rules as clearly 0a & 0e do not fit in the normal framework, somehow I need to change them to OPEN & CLOSED (I think) so I can use them in the normal fashion but for the life of me cannot figure out how, some expert advice would be much appreciated!
Hello,
You can use an incoming MAP Transformation. You need to install the Map Transformation Service to use this.
And than you create a map file that maps your custom values to open and closed as described in the example section. You have to save this map file to the transformation folder that is in the same place as your rules and items folders.
You can than call this transformation from paper ui as an incoming transformation in the channel settings of the generic mqtt thing of type contact in paperui
You can put 0a in the “Custom On/Open value” and the binding will convert that to OPEN. It’s not clear whether what you wrote above is the full message received or not. If it is, then put the full text of the OPEN message on the left and the full test of the other one in the CLOSED message.
I can’t remember if this was available in MQTT 2.4 so if you don’t see the above you will need to move up to MQTT 2.5 M1 or later.
Ah I didn’t know those were available for contacts too , I wrote the answer while in line at the post office so I didn’t look it up. yes that would indeed be the easier solution.
The item sensorFrontGate ends up being 0a or 0e and so I need to change it to OPEN/CLOSED here (or before here) in order to use in rules, as this does not work:
when
Item sensorFrontGate changed to 0a
then
<stuff and bobs>
end
I am using mosquitto as the broker and the binding from David Graeff I don’t really use the GUI so will be looking to do this at a conf file level
2019-06-01 14:24:02.014 [vent.ItemStateChangedEvent] - sensorFrontGate changed from CLOSED to OPEN
2019-06-01 14:24:05.076 [vent.ItemStateChangedEvent] - sensorFrontGate changed from OPEN to CLOSED
Don’t forget to install the MAP transformation, that got me for a few mins