[SOLVED] MQTT, JSONPATH transformation & strange results in Basic UI

HI Will,
I just got the Kerui D026. Can you share your current working solution for thing, item and rules for these contact sensors under MQTT 2.4?

Hi J

The post further back on here from February 18th is pretty much still what Im using Items/Sitemap/Rules wise. Im not sure what version of MQTT Im using, so Im not sure if youre implying something has changed in a recent version, though Id imagine MQTT wont have changed in any way. EDIT- MQTT 2.4 binding: Items go to UNDEF after reboot (reading this post, theres a suggestion on it that there was an issue with implementation of MQTT on Openhab 2.4 and that 2.5 resolves this, though I have no issues myself and havnt looked any further into this, but perhaps this will point you in the right direction).

Each Kerui DO26 will send its own unique codes through via your RF Bridge to MQTT, so you need to use something like MQTT.fx (or similar) that can live look at what gets sent to your RFBrige, you will see when you press the buttons on the sensor, you get a different code sent for Open/Closed/Tamper (and battery too… but you need a bad battery or variable power supply to figure that out), so you will note those codes down for each sensor and use the codes in the rules.

Beyond that, everything is pretty much as per my previous post, though you will create additional rules for each sensor and its unique codes.

Does that help or is there something specific you need help with, or perhaps describe your problem with MQTT 2.4 and the rules?

Thanks

Hi Will,
I previously got a contact sensor that only gave out specific rf data on open and close. @vzorglub helped me with a JS transformation which did the trick.
However with the Kerui D026, I cannot use the same JS transformation as it gives out 4 different types of RF data . So I want to model it exactly after someone who have used it successfully (which you have) . I have not figured out how to get the battery RF data but I assume the only change is the last character, as that is true for the open,close and tamper data.

Yes I am using MQTT 2.4 binding, which needs specific thing and item files. I hope that is also what you used currently.

Could you share your thing, item and rule file for one of your D026 sensor?

I looked over my config files etc and everything was as I showed above… I think the answer though is that Im still using Openhab 2.3.0 and not Openhab 2.4.x, so its not a challenge Ive yet taken on and investigated.

The bindings/actions/persistence I have installed are:

MQTT Binding

binding-mqtt1 - 1.12.0

MQTT Action

action-mqtt - 1.12.0

MQTT Persistence

persistence-mqtt - 1.12.0

Which are all shown in paper UI. Im not declaring anything in either the text file or webui things at this time.

So it looks like this will be a new challenge to investigate at some point in the future when I upgrade.

As for the battery, yes it is a different number on the end… so either you could make something that looks for all the possible end variants (but not the other 3 that you know of)… or if you have an almost worn out battery, put that in the device and get it to send the code… or you need a variable power supply to hook up and slowly drop the voltage until it starts sending out its “low battery” code. I dont know of any other route for this (I suppose it may be possible to write a “device hasnt checked in for X period of time” which you may be able to cover all the sensors in one go with that type of code, as well as cover off the bridge being switched off)

Upgrading is something I may do one day, but not at the moment as I dont have spare time.

I hope however this gives you some insight and Id be grateful if you do find any answers.

Thanks

Hi Will,
Looks like you have not moved to MQTT 2.4 binding yet. Unfortunately I have, and I am still figuring things out.thanks very much for your input

To anyone who looks at this post in the future. I did upgrade my system to 2.4 build and yes my MQTT related devices stopped working. It looks as though (reading the documentation) that MQTT has been changed in 2.4 on wards, so yes you will need to configure MQTT Binding/Broker and possibly change your items setups to query/use the MQTT Bridge/Broker…

Alternatively, I re-enabled the old version 1 MQTT binding in Paper UI (Go to settings and enable 1.x bindings). From here, I went into the Bindings in Paper UI, re-added/enabled the older MQTT 1.x binding and everything started working again (I will obviously have to look at updating properly some time, when I have the time… but this is 1 quick fix for anyone using this whom updates to 2.4 or later).

Thanks Will. Look forward to learning from you 2.4 updates