Sonoff Goodies including WiFi Door Sensor and more

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.

DW2-Wi-Fi
DW2-Wi-Fi

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 brought 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 it is 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, not 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”

params:
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.

Facebooktwitterpinterestlinkedin

9 thoughts on “Sonoff Goodies including WiFi Door Sensor and more

  1. The Aqara door sensors that I use (MCCGQ11LM, ZigBee) almost instantly send a signal. I would say less that half a second from sensor to ZigBee hub to WiFi to RasPi to Home Assistant dashboard.

  2. Pete, have you measured reaction time? It is what keeps me from using WiFi door sensors for my gate. If the sensor wakes up from sleep and runs a full WiFi ‘search and connect’ cycle this may take up to three seconds or longer (measured on Shelly: https://www.shelly-support.eu/forum/index.php?thread/4304-open-close-response-takes-10-seconds-when-coming-out-of-deep-sleep/).
    This would be too long to turn my surveillance camera on.

    I learned during ESP32 programming that there are faster ways to re-establish an old WiFi connection. It would be interesting which manufacturer uses them.

    1. Finally tested: Reaction time of my DW2 is around 2 seconds. Not bad. Static IP address in my local WiFi, no cloud connection.

      The DW2 is a bit tricky to setup. I could only switch off cloud connection in the web interface, not in the app. Started to dislike the app. Today it not updating the open/close reports from the DW2 but my Home Assistant does.

      A feature worth using with most Shellys is HTTP Request. http://x.x.x.x/settings?sleep_mode_period=24 makes the DW2 wake up to broadcast only once a day. Default is every 6 hours.
      (For the TRV http://x.x.x.x/settings/?display_flipped=1 rotates the display 180° so I can actually read the temperature on the TRV mounted on the left of my heater.)

    1. Thanks for that – got it sorted in the end with a “23A” battery from a local store. Tight fit but it works. You guys are very helpful – not only have I discovered two new (to me) batteries in the last 2 days but also where to find one of them in existing gadgets – lovely. And there’s more – I’ve just finished part one of my new Shelly article – https://tech.scargill.net/more-shelly-goodies-to-write-about-on-my-birthday/ – check out CR123A batteries – not cheap at Amazon.

  3. Speaking as one of the ” inner-city Americans” that follows your adventures: I can say I’ve never heard of the type A27 battery either. Heck, I just stumbled upon AAAA (yes there are 4) batteries.
    And Thank You for sharing your knowledge and problem-solving methods along the way.

    1. I only just discovered AAAA myself. What do manufacturers have against good old AA and AAA.

      It gets worse – I just got a sample at lunchtime of the Shelly Door/Window2 sensor – WiFi – and being Shelly it will be good BUT it needs (not supplied) a pair of CR123A 3v batteries (what???) – rather than miss out – I just ordered a pair – €5 from Amazon – mind you they claim 2 years on the batteries.

        1. Seriously – WELL you learn something new every day. Thanks for that, Steve.

          I can see some serious blogging coming on this coming week – I’ve several sensors all with their own story – and I’m trying not to think of the other gadgets which are piling up on me right now before I’ve unpacked from our long drive from the UK to Galera.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!