Wireless Door Sensor

Dear Colleagues,

I’m using some door/windows sensors based on ESP8266 + wired power, but right now I need to define a new structure for door/windows sensor wireless and that must run on batteries. WHich are the best HUB or solution for? Please find below some solutions that I have found so far

  • ESP8266 (mqtt+reed) + deepsleep + battery (30 days of battery autonomy)
  • Zigbee solution (is it possible to deploy my network? I have check some xiaomy/z-wave but it’s quite expensive and a HuB must be added). It’s supporting 2-4years with same battery
  • RF433 (Im my researchs I found that a special sensor to send to codes is needed (open/close) + a Hub gateway (sonoff bridge).

May you give your tips&hints about in order to figure out the best solution for my needed?!

I suggest openHAB plus Aeotec Z-wave controller; then choose your door sensor. I use the Fibaro sensors https://www.fibaro.com/en/products/door-window-sensor/

1 Like

I went with mono price for my door/window sensor - https://www.monoprice.com/product?p_id=15270

I’m still working on finding an ideal solution for some of my windows which open from the top and bottom and will probably go with reed connections ran into the mono price device.

I do believe my oldest door sensor on a heavily used door for over a year is still reporting 100% for battery life. Keep in mind that it uses a CR123A battery.

I also agree that the zwave way can cost more, but pre-made and stable devices for me means I don’t have to hear my wife complaining when something doesn’t work as expected.

2 Likes

Or this: http://www.instructables.com/id/LoRa-Tooth-Small-Wireless-Sensors/

Bluetooth based, longer battery life…but does require bluetooth “gateways” dotted around the place.

2 Likes

I would suggest researching “MySensors” and going the Arduino and RF route…

1 Like

May take a look at the KERUI Door Sensors in combination with a SONOFF 433MHz Bridge and the Tasmota Firmware.
This Setup works great for me, so maybe for you too.
The Sensor sends signals while opening /closing the Window and removing the Sensor.
One advantage is that you can read as many sensors as you want and also send commands via the bridge.

better order in china direct

Have fun

2 Likes

Hey Michael,

thanks so much, I really appreciate your answer! I can’t find this sensor in Brazil, do you know how to check if another sensor is able to send close & open sinals? Almost of all is just sending when it’s open, but not when they are “close” again I need to try to find another vendor for. Another topic, do you have temperature sensor, gas and other sensors is your house? Which one do you use?

Marcel,
I have in my setup Kerui, WDS-07 and Xiaomi.
All of them send open and close signals.
As of today, I am slowly moving to Xiaomi only, because they are more reliable, battery life is 1 year and you can see battery level.
Xiaomi sensors can be cheep if you are purchasing them at sale time from China. For instance I was able to get some Aqara Door Sensors on Gearbest for USD7 each - just check when sensor are on sale on Gearbest or Aliexpress.
Plus MiHome binding is working great.

Hi Igot,

Sounds good! It’s a good solution, which gateway have been using from Xiaomi? Is the temperature sensor and other working good as well?

Thanks in advance Igor!

Hey Marcel,
the only other sensor I use, is an ordinary DHT22 Sensor on an ESP8266-E12 with Tasmota Software for temperature and humidity in the cellar. On the same ESP I got a door contact and a water detecting contact. So, 3 in 1, but not in batterie modus.

Standard Gateway2 - have 2 of them. Why 2 ? - because I have big house - distance is problem and many users reported that if you have more 30 devices on one gateway, some isuues may arise. But I have seen comments that one is using one gateway with 45 devices without problems.
Yes, Temp sensors working great, only one thing - they report data only when temp changes or once in 30 minutes aproximately if nothing changes.
Check Xiaomi Mi Smart Home Binding and review https://community.openhab.org/t/mi-xiaomi-smart-home-bindings.

Hi Michel,
Did you switch to MQTT 2.4 for your Kerui Door sensors with sonoff bridge?
If so, could you share your thing, item and/or rule configuration?

Hi J Wee,

I’ve got both systems running. Mqtt binding 1 and 2.4 but I didn’t update the bridge thing/items by now. Later this day I can take a look to get the bridge to the newest mqtt version also. I will report as soon as possible.

Hi J Wee,

I did the update for my Bridge

  1. update Bridge to Tasmota version 6.5

  2. Add this
    Thing topic GF_Bridgesensor_status “Bridgestatus” {Channels:
    Type string : RF_Sensor [stateTopic=“tele/sonoff_50/RESULT”, transformationPattern=“JSONPATH:$.RfReceived.Data”]
    }
    to my Tasmota things (The MQTT server is already defined on the Thing side)

  3. Add this
    String OS_Bridgesensor “Bridgestatus [%s]” (gContact, gwContact) { channel=“mqtt:topic:OH:GF_Bridgesensor_status:RF_Sensor” }
    to my Contact.items

  4. Add this
    Frame label=“Security” icon=“lock” {
    Group item=gContact
    }
    to my Sitemap

  5. via Putty
    sudo systemctl stop openhab2.service
    sudo openhab-cli clean-cache
    sudo reboot

Now Bridge is online at Paper UI and the state is shown at Item on sitemap

Hope this helps.
Good luck

Thank you very much Michel. I will try it on my side to see how it goes with MQTT 2.4 binding

This seems only applicable for 1 contact sensor. What if I have multiple sensors? Do I need a rule to define what happens when as the RF bridge will be listening to any RF input? Moreover, the Kerui D026 gives out 4 distinct RFcodes : one for open, close, tamper and battery . How do you get openhab to know which is which?

Hi J Wee,
You’re right. This OS_Bridgesensor is ony to read the value of the different sensors. There should be an item for every contact as well to show the state of the window/door contact and a rule wich is triggerered on every change of the value at the OS_Bridgesensor. The rule then converts the value in a state like: when OS_Bridgesensor gets update, if incoming value = “XYZ” send update Window_contact “OPEN”…
Later I can post a concrete example for you.

Hi J Wee,
as example for window contact in my bathroom:
items file
Group:Contact:OR(OPEN, CLOSED) gContact “Tür-/ Fensterkontakt” (Home)

String OS_Bridgesensor “Bridgestatus [%s]” (gContact, gwContact) { channel=“mqtt:topic:OH:GF_Bridgesensor_status:RF_Sensor” }

String GF_Bathroom_Window “Fensterkontakt Bad EG [%s]” (GF_Bathroom, gContact)

and the rule is:
//This is Alarmsensor_GF_Bathroom_Window.rules

var Timer SLEEP_TIME_Sirene
var Sirenenzeit = 120

rule “Alarmsensor_GF_Bathroom_Window”

when
Item OS_Bridgesensor received update or
Item OS_Bridgesensor changed
then

    	if (OS_Bridgesensor.state == "01DEE7" && MA_Houseoccupied.state == ON) { GF_Bathroom_Window.postUpdate("CLOSED")
			val String Current_DateTime = String::format( "%1$tl:%1$tM%1$tp on %1$tA, %1$tB %1$te, %1$tY", new java.util.Date)
        	sendBroadcastNotification("Alarm - Fenster Bad EG geschlossen " + Current_DateTime)
			sendTelegram("bot1", "Alarm - Fenster Bad EG  geschlossen " + Current_DateTime)
            MA_Alert.postUpdate("Fenster Bad EG")
            MA_Alerttrigger.postUpdate("CLOSED")
            MA_Alerttime.postUpdate(Current_DateTime)
			BM_LaundryRoom_Siren.sendCommand(ON)
			SLEEP_TIME_Sirene = createTimer(now.plusSeconds(Sirenenzeit)) [|
			BM_LaundryRoom_Siren.sendCommand(OFF)]				
            }
    	if (OS_Bridgesensor.state == "01DEE7" && MA_Houseoccupied.state == OFF) 	{ GF_Bathroom_Window.postUpdate("CLOSED") }
        if (OS_Bridgesensor.state == "01DEEE" && MA_Houseoccupied.state == ON) 	{ GF_Bathroom_Window.postUpdate("OPEN")
			val String Current_DateTime2 = String::format( "%1$tl:%1$tM%1$tp on %1$tA, %1$tB %1$te, %1$tY", new java.util.Date)
        	sendBroadcastNotification("Alarm - Fenster Bad EG Offen " + Current_DateTime2)
			sendTelegram("bot1", "Alarm - Fenster Bad EG Offen " + Current_DateTime2)
			MA_Alert.postUpdate("Fenster Bad EG")
			MA_Alerttrigger.postUpdate("OPEN")
			MA_Alerttime.postUpdate(Current_DateTime2)
			BM_LaundryRoom_Siren.sendCommand(ON)
			SLEEP_TIME_Sirene = createTimer(now.plusSeconds(Sirenenzeit)) [|
			BM_LaundryRoom_Siren.sendCommand(OFF)]				
        	}
		if (OS_Bridgesensor.state == "01DEEE" && MA_Houseoccupied.state == OFF) 	{ GF_Bathroom_Window.postUpdate("OPEN") }
		if (OS_Bridgesensor.state == "01DEEB" && MA_Houseoccupied.state == ON) 	{ GF_Bathroom_Window.postUpdate("TAMPER")
			val String Current_DateTime3 = String::format( "%1$tl:%1$tM%1$tp on %1$tA, %1$tB %1$te, %1$tY", new java.util.Date)
			sendBroadcastNotification( "Alarm - Fenster Bad EG-Sensor manipuliert - Alarm was Armed " + Current_DateTime3)
			sendTelegram("bot1", "Alarm - Fenster Bad EG-Sensor manipuliert - Alarm was Armed " + Current_DateTime3)
			MA_Alert.postUpdate("Fenster Bad EG")
			MA_Alerttrigger.postUpdate("TAMPER")
			MA_Alerttime.postUpdate(Current_DateTime3)
			BM_LaundryRoom_Siren.sendCommand(ON)
			SLEEP_TIME_Sirene = createTimer(now.plusSeconds(Sirenenzeit)) [|
			BM_LaundryRoom_Siren.sendCommand(OFF)]
        	}			
		if (OS_Bridgesensor.state == "01DEEB" && MA_Houseoccupied.state == OFF) 	{ GF_Bathroom_Window.postUpdate("TAMPER")
			val String Current_DateTime4 = String::format( "%1$tl:%1$tM%1$tp on %1$tA, %1$tB %1$te, %1$tY", new java.util.Date)
			sendBroadcastNotification("Alarm - Fenster Bad EG-Sensor manipuliert - Alarm was Disarmed " + Current_DateTime4) 
			sendTelegram("bot1", "Alarm - Fenster Bad EG-Sensor manipuliert - Alarm was Disarmed " + Current_DateTime4)
        	}

end

//01DEEE open
//01DEE7 closed
//01DEEB tamper

You have to figure out wich value is wich state for your contact. After this you write the different values in your rule.

I know that the rule is not that clean and that I can reduce it with the “case” function, but it woks for me.

For sure you can delete the parts of the rule, that were not necessary for you like MA_Alert, MA_Alerttrigger… so that you don’t got any error notification in your Log Viewer.

Good luck

Thanks again Michel.
It appears a rule for each and every single contact sensor will be necessary.
Can you also share your things file for this sensor?

regards
Jon

you’re right. you need one rule and one item for every sensor to process the received rf data and show the item state of your contacts.
But you only need one thing and one item for your bridge to get all dates of all your sensors .
The thing file is like I discribed in the older post:

Thing topic GF_Bridgesensor_status “Bridgestatus” {Channels:
Type string : RF_Sensor [stateTopic=“tele/sonoff_50/RESULT”, transformationPattern=“JSONPATH:$.RfReceived.Data”]
}

  • all your mqtt 2.4 settings