Sonoff rf bridge contact sensors

Hi all, I am spinning to know which direction to go for resource.

I dont use PaperUI as I use Visual Studio for everything else I play with and it’s easier to keep everything in one place.

I know some people encourage us to use PaperUI reading other posts on this topic.

If there is anyone else out there that is like me, maybe you could point me in right direction.

The set up

2 x contact sensors

one that reports open/close working great (no Problems) but I have a one sensor that only report open (with no close state)

How can I get the 2nd to work.

Thing File
Thing topic RFBridge1 {
Channels:
Type string : receiveddata “Received Data” [ stateTopic=“tele/RFBridge1/RESULT”, transformationPattern=“JSONPATH:$.RfReceived.Data”]
Type contact : door1 “Parcel Box Sensor” [ stateTopic=“tele/RFBridge1/RESULT”, transformationPattern=“JSONPATH:$.RfReceived.Data” ,allowedStates=“09B793, 09B799”, on=“09B793”, off=“09B799” ]
Type contact : door2 “Gate Sensor” [ stateTopic=“tele/RFBridge1/RESULT”, transformationPattern=“JSONPATH:$.RfReceived.Data” ,allowedStates=“FBFB0E”, on=“FBFB0E” ]

}

}

Item File

Contact GF_Sonoff_RF_Door_1 “Door 1:” (GF_Sonoff_RF) { channel=“mqtt:topic:pibroker:RFBridge1:door1” }

Contact GF_Sonoff_RF_Door_2  "Door 2:"  (GF_Sonoff_RF) { channel="mqtt:topic:pibroker:RFBridge1:door2" }
Error 2020-08-14 06:01:40.991 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'FBFB0E' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.FBFB0E

Any help would be appreciated.

I don’t know the answer, but I would try two things:

  1. Remove allowedStates from your contact channels. The documentation seems to suggest that this only works with string channels.
  2. Add an empty off="" to your second contact.
1 Like

Thanks for the help tried all different ways with same error.

I will keep trying.

Your two channels have the same topic. Both channels get the MQTT messages from both sensors. "allowedStates’ does not work for contact type channels. So each channel will throw the WARN when it gets a message for the other channel.

Here is how to deal -

1 Like

@rossko57 has nailed it. I was curious so tried it out myself, and no longer get the warnings. Try the following in your things file, and make sure the RegEx transformation service is installed in openHAB.

Thing topic RFBridge1 "RF Bridge 1" {
    Channels:
        Type string : receiveddata "Received Data" [
            stateTopic="tele/RFBridge1/RESULT", 
            transformationPattern="JSONPATH:$.RfReceived.Data"
        ]
        
        Type contact : door1 "Parcel Box Sensor" [
            stateTopic="tele/RFBridge1/RESULT",
            transformationPattern="REGEX:(.*09B79.*)∩JSONPATH:$.RfReceived.Data",
            on="09B793",
            off="09B799"
        ]
        Type contact : door2 "Gate Sensor" [
            stateTopic="tele/RFBridge1/RESULT",
            transformationPattern="REGEX:(.*FBFB0E.*)∩JSONPATH:$.RfReceived.Data",
            on="FBFB0E",
            off=""
        ]
}

Note that your original things file still works - the second sensor still updated correctly. Just that the first sensor channel complained with the warning, which - if you don’t care about it - you could just ignore…

Do you have a plan for detecting when the second contact is no longer open?

You are a star, at work at moment but cant wait too try it, this post is going to very popular.

I was just going to use a timer to clear state, as it is more as alarm plus if this works people can use the sonoff PIR to switch lights.

I’m excited

I tested by publishing the following to tele/RFBridge1/RESULT

{ "RfReceived" : { "Data" : "FBFB0E" } }

If in reality the device publishes something else then there’s a chance it may interfere with the REGEX - try it and see! If there is an issue, then let us know what the actual message is.

You could probably do this with the Expire binding - no need for rules!

Just change your item to something like (from the third example):

Contact GF_Sonoff_RF_Door_2  "Door 2:"  (GF_Sonoff_RF) { channel="mqtt:topic:pibroker:RFBridge1:door2", expire="30s,state=CLOSED" }

hafniumzinc

This Works perfectly. I cant thank you enough, I was about to jump to the other side as there seemed to be more people willing to help, sometimes you need to see the answer so you can understand the function.

This opens up a lot of automation fun.

I now have

Sensor on postbox so I know when courier has delivered something and closes the lid.

Back Gate Alarm
Front Door Alarm
PIR on top patio to switch on water feature
PIR on drive to switch security lights on
I have a lot more planned.
I will now write a conclusion post so people also benefit from your help

Again Thanks for taking the time to help

S