The value of “Data” is the unique identifier of the PIR that I would like to link to.
house.sitemap
Text item=esp_8285_PIR_1 label="Living Room Sensor" icon="motion"
PaperUI -> Things -> MQTT Client (Generic MQTT) -> Channel:
tele/house/living_room/esp8285/bridge/RESULT
Configured as String
Log Viewer (frontail):
2019-05-12 13:13:36.612 [vent.ItemStateChangedEvent] - esp_8285_PIR_1 changed from NULL to {"RfReceived":{"Sync":12420,"Low":430,"High":1250,"Data":"EC4B2E","RfKey":"None"}}
I’m trying to get Item (esp_8285_PIR_1) to display motion detected information in openhab basicui. But so far I’m not getting anything as I am not familiar with JSON and a complete beginner in OpenHAB. I have managed to successfully bind other MQTT clients to OpenHAB, but this is the first time I had to work with JSON. From what I gather, I will need a JSONPATH or some kind of parser, but I don’t understand the syntax because all the examples that I find online, seems to use the broker syntax and not the channel syntax from PaperUI.
My guess is, that if it starts working, the next step would be to create a rule, to make the detection last only for 10 seconds and clear, but I’m not there yet.
So, the message you posted gets published when the device sees motion and only in motion? All other sensor readings and device info gets published to some other topic? There is nothing about that message that indicates it’s a motion detection event so does that mean the whole message means motion was detected?
I receive this message, when there is motion, there is no other message that says it stopped. It is a once off message, per motion detected cycle. Would I need to use a mapping, or a JSONPATH transformation? I saw this was an option to install under PaperUI -> Add-ons -> Transformations.
I only have one PIR sensor so I cannot compare with another, but from what I have read online with YouTube videos indicating that I should search for the Data, apparently door sensors have more information, but I don’t have any right now. The ones from iTead Sonoff, only sends Door Open message. Other 433MHz sensors might also send door closed, and battery status.
My guess would be that the topic will be the same for all, coming from this single tasmota device. If I was to add another PIR sensor, door sensor, or a button to this RF bridge. Well, I do not add anything to tasmota. The device is listening on RF 433MHz for any device, and I want to filter for messages that are relevant to me. Each sensor device will have a different value in Data, to identify it.
I think I am trying to achieve something similar to this post.
The difference will be instead of chaining this to another transform you will just set up the regec to match or not.
Then use the ON command field (I’m on my phone and can’t look up the right name) to send ON when ever any message is received.
The REGEX should filter out those messages that don’t apply to the device. The ON command will set the Switch Item lined to the Channel to get an ON command when ever a message that passes the regec is received.
So, the next step would be, to create a rule and then post to another item? Where I would then use esp_8285_PIR_1 as a mechanism to narrow down to the ID. So I need a String item place holder that will be showed in BasicUI?
Hello, and thank you for taking the time to respond. To be honest, I didn’t understand your tutorial at all. I’m an absolute beginner, I have no knowledge of JSON, or REGEX or OpenHAB 1.x or OpenHAB 2.x or even MQTT. All of this is new to me. I honestly don’t know how to translate what you mentioned in the tutorial into what I need and want.
I’m just trying to figure out and build on top of what I already know, based on this tutorial.
This is my rule that I created, based on the JSONPATH approach. Which shows DETECT in the Basic UI and removes the value after 5 seconds. This JASONPATH syntax example. I got from here.
rule "esp8285 Sensor Processing"
when
Item esp_8285_PIR_1 received update // Need received update if Data has not change but button still pressed
then
if (esp_8285_PIR_1.state == "EC4B2E")
{
my_Display.postUpdate("DETECT")
Thread::sleep(5000)
my_Display.postUpdate("")
}
end
Which required me to have an additional item to display in the BasicUI
String my_Display "[%s]" <motion> (Test_Group)
With your approach, I take it that I don’t need this place holder item, which I called my_Display. I can do everything directly to esp_8285_PIR_1. Thank you for showing me another way of doing it. I have not considered and understood the full context until you spoon fed me.