Sonoff DW2-Wi-Fi Door Sensor and Node-Red

Ok, first things first, the DW2-Wi-Wi door sensor is as it says, WiFi, not RF or Bluetooth (though it does use BT to setup with the eWeLink APP in the first place).

I looked here on Amazon and read someone saying the device was almost impossible to pair – mine paired with the Sonoff eWeLink APP pretty much immediately – I think that user must’ve used the wrong pairing method. The correct method with this device is Bluetooth.

Someone else commented on battery life, which is supposed to be 3 months, the user said they got much less than that – but didn’t specify what kind of AAA batteries they used. I’ve had this issue with ESP8266 and AAA batteries (see my CRICKETS article) – Kodak for example don’t last any time at all so I simply stopped using them ages ago. I generally use GPExtra AAA batteries from Amazon and elsewhere as they are cheap and seem to last. If I need long life I go for Energizer Ultimate Lithium AAA.

So, just what chip DO Sonoff use for this door sensor? NOT an ESP32 – but something else: OPL1000.

Sonoff DW2-Wi-Fi door sensor

I’m not familiar with that chip – but there you have it -opened up.

Sonoff DW2-Wi-Fi door sensor

Once I had the device talking to eWeLink, I went to my Node-Red installation and looked up my node-red-contrib-ewelink nodes which work fine as well, unce the device has been paired into the eWeLink APP – from there, the Node-Red nodes no longer need your phone switched on.

node-red-contrib-ewelink nodes

I’ve been messing with this all day and the battery indicator in the Sonoff APP still says full and my nodes report 100 (assume 100%) – clearly it would take weeks or months to test battery life so I’ll leave this sensor and it’s magnet on a door somewhere.

In my original article I left sensors on doors on the UK home we no longer own (and I left them on the doors… dohhh!)

Importantly the sensor reports both ON and OFF state (open and closed) as well as WiFi signal level and battery level. I also got the firmware details: 1000.2.1195 – a later version than the first DW2-WiFi I received a while ago… see the original blog entry which also covered other Sonoff products.

Sensor operating gap

For the above Node-Red nodes, the first eWeLink node (eWeLink Devices) needs nothing more than your free eWeLink account credentials (ie a sequence of numbers and letters with a period part way through) and the second (eWeLink Event Listener) needs the same code and a device ID which can be picked up from the output of the first node.

The FUNCTION node is how I get out useful info.

As for the gap needed – my hand is pretty normal size. Judge for yourself. Of course if you don’t want to use Node-Red, the Sonoff eWeLink APP is ok. For the record, I’m not finding the node-red-contrib-ewelink node (eWeLink event listener) 100% reliable – I AM finding the APP 100% reliable. For the APP with my WiFi turned off and Bluetooth turned off – which means the round trip has to be via Sonoff servers, I’m finding less than 0.5 seconds response time to be typical for screen response. With my phone in my pocket, audio notifications maybe 1-20 seconds (and I JUST realised I can customise notifications on a per-app basis – how did I miss out on that until now!)

msg.payload = "Device " + msg.payload.deviceid + "=" + msg.payload.params.switch + global.get("handyDate");
return msg;

7 thoughts on “Sonoff DW2-Wi-Fi Door Sensor and Node-Red

  1. Peter, Not sure if you know – but you can use TUYAAPI to enable local control of the TUYA based devices – its a fairly simple 10 step process to essentially generate an access key on the TUYA developer portal and then use that to take local control (through your NR instance for example) and cut the cloud out completely (without having to cross flash the device etc)

    1. Craig,

      Would you mind supplying a link? I found some Tuya API stuff but I do not think it is what you are referring to.

  2. I wonder if you could replace the AAA batteries (D10*44 mm) with AA batteries (D14*50 mm) with modified battery contacts. AAs typically have three times the capacity at twice the volume.

    1. Could be a struggle but don’t let that stop you. To get better battery life, the move to Energizer AAA Lithium Ultimate (no I’m not plugging them) is probably worthwhile – they start at a slightly higher voltage and it stays there for ages – and yes, they are more expensive than cheapies but not THAT much more.

  3. Oh, thanks Peter for this – I do have same sensor but had no idea about existence of Node-red eWeLink node! Thank you!

Comments are closed.