I just received a little package from Itead (Sonoff) including their DW2-Wi-Fi door/window sensor. DW2 RF sensor and RFBridgeR2. Nothing special about this lot? Well, the DW2-Wi-Fi has WiFi and Bluetooth built into it. OTT for a door sensor? That was my exact reaction (but read on). I figured they were using an ESP32, the very idea of using something like an ESP32 on a door sensor smacks of major overkill to me – but then it turns out my gut feeling on this was wrong – read on…

I grabbed 2 AAA batteries, prised the back off and fitted them into the DW2-Wi-Fi. I then read the instructions which told me to put the unit into “pairing mode” with the eject pin (which was not provided so I used a generic pin) into the hole on the front – and to use “Bluetooth mode” in the eWeLink APP. I put the MAC address into MACVENDORS.com which said “not found” which is a bit odd. Well, the quiescent current is 40uA… and the pairing was DEAD easy.

Sonoff DW2-Wi-Fi door/window sensor

Once I had the sensor working in the eWeLink APP (a few seconds), I jumped straight back to my Node-Red installation wherein I have the Node-Red-Contrib-eWelink node running. The APP gave me the ID of the sensor, I punched that into the relevant Node-Red node and sure enough, as the contact opened and closed, a package came out of the node into my debug node.



Ok you’ve talked me into it – I opened up the sensor – it’s not an ESP32 after all. Here are a couple of photos:

The square chip is obviously the powerhouse behind this sensor. What’s an OPL1000? I can’t quite read the smaller 8-pin chip. Feedback welcome.

Whatever – the unit puts out a well defined data package as you’ll see below and I’ve included an extract of what comes out of the node as the contacts close:

I’ve deliberately left off the chip ID and MAC info which comes out. The data when separating the two units is similar with “on” instead of “off” in the package.

If I were using the eWeLink APP I’d get “open” and “closed” and a pretty picture of the contact set in the APP.

I’m just wondering if I can make this unit weather-proof so it can go on the gate at the front of our property…. signal should be strong enough – soon find out…

switch: “off”
battery: 3.197
fwVersion: “1000.2.925”
type: 3
rssi: -73
actionTime: “2022-03-02T22:20:17.931Z”

Next: the other items I received in the package – the Sonoff RFBridge(R2) and their DW2-RF which differs from the WiFi version in using only 1.5uA quiescent current but uses a tiny 12v battery instead of the pair of AAAs that the WiFi model uses.

Ok, here was my first issue. I just opened up the RF sensor. I keep a range of batteries for general use. You can’t go wrong, keeping a supply of decent AAA and AA batteries (remote controls for one thing) – I also keep some Lithium button cells lying around for LED candle lights and various night lights. But miniature 12v batteries (marked 27A on the box)? No. And no battery was included with the Sonoff DW2-RF sensor.

MN27 (27A) 12v battery

Batteries – I can almost hear some of our inner-city friends mumbling “what’s the big deal?” Well, here in rural Southern Spain, the main place to get batteries would be a local “Chinese store” and I was betting that fresh, miniature 12v batteries are not at the top of their stocking list.

I’ve been wrong before so I took a look this next morning while at the local market – type is “27A” or MN27 which for the uninitiated has nothing to do with capacity – just an unfortunate naming convention. If that failed it would be down to Amazon – and a single battery can cost more than a typical Chinese RF door sensor… take a look inc post..€1.95 I can handle – but add the postal charge at €3.95 – someone’s kidding, right?

I wouldn’t care but back in the UK I have two 12v batteries sitting in a drawer – but not here. I also need to check out the Sonoff RFBridgeR2 but of course to do that I need this sensor running as my other sensors are all Zigbee or WiFi.

Sonoff RFBridge R2

Meanwhile, why RFBridgeR2? Elsewhere in the blog I’ve covered using RFBridge – which I have to say works well, back in the UK I have a pair of these USB-powered (microUSB connector on the bottom) RF to WiFi bridges (on which I’m running Tasmota for non-cloud operation) handling input from various door sensors from Aqara as well as picking up the RF signal from a random doorbell which Banggood sent to me ages ago.

With the signals bought into Tasmota on my Raspberry Pi, I then have that info sent out to a public MQTT broker and hence to Tasker on my phone so I can tell if someone rings the bell or opens a door back in the UK. Thats a working but yet-to-perfect project I’ve covered in another blog entry here – read all about the doorbell and how it is working with RFBridge and Tasker etc. if this interests you.

Why did this RFBridgeR2 tweak my interest and why do I have these sensors? Well, I knew I was coming to Spain this month and read somewhere that the RF chip inside the R2 has changed and that caught my eye so I dropped a line to Itead (makers of Sonoff) to send me some bits to play with..

AND off I went to the market, the local Chinese store didn’t have A27 or 27A or MN27 batteries but did have a 23A battery which looked identical so I went for it.

As far as I could make out, the Spanish-speaking Chinese fellow tried to tell me the 23A battery was no good but I took a chance – at €1 it beat Amazon hands down. It’s a little wide and so a tight fit, but the exact length and voltage so I believe I’ll be ok. Separating the magnet from the transmitter unit produces an orange light – no such luck when bringing them back together but I’m assuming that’s normal.

So for now at least, I can pair the RFBridge to the eWeLink App (easy – just done it – QUICK LINK in the eWeLink APP (making sure my phone was on a 2.4Ghz WiFi access point).

On power-up, the RFBridge had a blue flashing light which turned solid blue once the pairing was complete (a few seconds) – I took the opportunity to rename the unit to RFBridge433r2 (another few seconds) at which point the block for that device in the APP said “subdevice 0” as it should.

I clicked inside the device block and saw “No remote yet” and “Add”. I clicked “Add” and sure enough the door sensor appeared along with a message to “long press remote button to enter learning mode”. I noted at this point, every time I separated the DW2 and magnet, the “recent alarms” message updated the time.

Again, nothing on closing the contacts. I guess that’s ok, you want to know if someone opens the door, not closes it – personally I’d rather have the option to use both but as things stand I can’t see how you’d alter that – I’m assuming “long press remote control to enter learning mode” in this case will do nothing and so finally, here’s a list of my test alarms. Normally I would say that at a later date, I’d Tasmota this RFBridge but if you read above, my experiment with Node-Red and the Node-Red eWeLink node should also work here.

Erm, mnot quite? In the APP, the DW2 WiFi showed it’s device number so I could copy that to Node-Red – no such luck with the RF product – instead, the only device number I have is the bridge itself…

action: “update”
deviceid: “aaaaaa”
apikey: “xxxxxxxxxxxxxxx”
userAgent: “device”

cmd: “trigger”
rfTrig0: “2022-03-03T12:57:43.000Z”
from: “device”

As you can see I’ve changed the device name and api key to protect the innocent. The device in this case is the RFBRIDGE, not the subdevice “My Remote” – no mention of that in the returned data so at this point I’m happy to receive any ideas as to how to tie that data to the specific subdevice in the Node-Red node. Wish I had two of the RF sensors :-). It does however work but if I had 2 sensors, in Node-Red I’m not sure I’d know which one was which.