Setting up a motion activated light with Sonoff Zigbee sensor and T2 WiFi switch

Earlier this month, I received a Sonoff ZBBridge Zigbee gateway, a motion sensor, and a Sonoff T2 wireless switch in order to set up everything to work as a motion activated light using Zigbee and WiFi through the eWelink Android app and cloud service. You can check out the first post to have a closer look at the hardware and accessories.

We’ve now had time to configure everything and will report the results of the project in this post. The idea is basically to detect motion with the Zigbee sensor, which then transmits the info through the gateway, and the T2 switch is controlled by the eWelink cloud.

Last time around, I thought I had a switch with a neutral wire at home, but I did not check in detail enough, and I’ve been unable to use it.

switch without neutral wire

Without suitable switches in my home, it was not practical to rewire a switch with neutral especially I’m renting. So I asked somebody if they had a gang with a light switch and a socket that would ensure the neutral wire is present.

Sonoff T2 switch installationSo we’ve found our candidate. That house is a bit far from where I live, so I ended up outsourcing the work, which should be interesting since nobody has a technical background over there. This will show how easy or hard Sonoff is to use for newcomers. Since I have a Yeelight light bulb, I also thought about testing eWelink to IFTTT integration, but this requires an eWelink Advanced paid plan, and it did not look like ITEAD was that interested in providing one for this and future reviews… So I’ve given up on that part.

Sonoff T2 installation

Let’s start by installing Sonoff T2 2-gang switch compatible with the US standard that is also used in Thailand. First, we’ll need to remove the cover…

Thailand switch cover.. and loosen the screws to check out the existing wiring… the neutral wire is blue, the live wire from the mains is brown, and the thin black wire is the live signal to the light.

switch box with socket wiring

There was a lot of confusion about that, and they did not feel confident to install it, especially considering the safety issue, so an electrician friend did the wiring and electrical installation connecting switch 2, and left switch 1 unused, at least for now.

Sonoff T2 wiring Thailand
Once everything was put back in place, they were able to turn the light on and off manually by pressing the square on the right.
Sonoff T2 installed

The light switches are perfectly visible at night thanks to the blue LEDs.

Sonoff T2 night

Motion sensor and Zigbee gateway

The rest of the hardware installation is much easier. A USB to micro USB cable is used to power the gateway…

Sonoff ZBBridge… and for the motion sensor, one has to remove the paper inside preventing the battery from being depleted, and use the included dual-sided tape (or your own) to attach the sensor in a strategic position.  sonoff motion sensor sticky tape

The next step is to install the eWelink app for Android and set up all three devices. Let’s start with Sonoff Zigbee bridge using the Quick Paring mode, where you’ll be asked to select a 2.4 GHz WiFi and input the password before the app tries to connect and configure the gateway.

Ewelink Quick PairingOn my side, it would not work the first time, but I could force it to pairing mode by pressing the button in the pinhole reserved for this purpose, and after the gateway was up and running, it was a breeze to add the motion sensor as a subdevice.

Ewelink Zigbee Motion Sensor

The same process can be repeated for the Sonoff T2, except the method to enter pairing mode is to long-press one of the switches.

Zigbee Motion Sensor eWelink

At this point, we can see motion events in the app or in notifications (if enabled), and control the light from Android.

The person at the “test home” had more difficulties when trying to pair the Sonoff T2 switch, apparently because she selected the wrong SSID, and the “pairing mode” concept took a while to understand. But after two evenings, everything was working, including the motion-activated light.

Setting up “Scenes” to enable the motion-activated light

In order to turn on and off the light automatically with motion, we can use the Scene menu (aka Smart Scenes) in the eWelink app with one scene to turn the light on upon motion detection, and another to turn it off if motion is not detected anymore. I sent the following instructions…

Sonoff Scene motion activated Light on, light offThere are four Triggers (if) options with a user tap, time of day, Sunrise/Sunset, and Smart Devices (e.g. motion sensor). It would have been nice to use Sunrise/Sunset, but if only defines specific times at sunset/sunrise or a few minutes before or after, we cannot set the motion sensor to work from Sunset to Sunrise.[Update: It’s actually possible to use Sunset/Sunrise triggers to enable/disable Smart Scenes. See AJ comment below]

Ideally, we would have to add a light sensor to make it work a night and other low-light conditions.

eWelink TriggerThere are two Actions (Then) categories with smart devices (e.g. Sonoff T2 switch connected to a light bulb) and a delay option, which I’ve used above to wait for 2 minutes until turning the light off when motion is not detected.

But the Scenes now used at the test home are slightly different since the delay is not necessary, as there’s already a delay of a few minutes before the light is switched off, and the effective period to turn the light off can be 24 hours. It does not matter.

ewelink scene motion on/off

But at least, the motion activated light is now working just fine.

At least for the demo. I was told one night the sensor stopped working, and they had to set it up again, as well as the Scenes. After that little hiccup, I’ve been told it’s been working for several days. Sadly, the sensor appears to be offline again today when looking remotely. The Zigbee gateway, clearly visible in the video above, had been moved to another location indoor, I’m told about 5 meters from the motion sensor, so it could be an explanation. I’ll try to have to move closer to see if the solution can be made more reliable. The specifications of the sensor indicate a 6-meter range, but I was told the light will only turn on when one or two meters away from the sensor which seems to be confirmed by the short demo above.

I’d like to thanks ITEAD for sending the items for review. You can purchase those on ITEAD website, or alternatively on Banggood where the Sonogg ZBBridge gateway goes for $16.28, Sonoff SNZB-03 motion sensor for $9.49, and the 2-gang Sonoff T2 wireless switch used in this review for $20.08. So the total comes up to about $45 including shipping.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
7 Comments
oldest
newest
AJ
AJ
2 years ago

I had a similar problem with the sunrise and sunset options. The way around it is to create a scene that disables the motion scene you created at sunrise and another that enables it a sunset.

In ewelink
If (any condition is met) sunset at your location then enable the scene for your motion detect.
Do the reverse for sunrise in another scene. Enable them both and it works a treat.

lance harvie
2 years ago

These motion sensors have an issue with re-triggering after motion is detected – not recommended if you are looking for consistent performance.

Antti
Antti
2 years ago

I agree. I’ve tried several different ways of setting up the scenes, but always run to the same problem. The motion detector does not always sence the motion.
Even if Im moving right under the detector it mau turn off the light. After tha it takes up to a minute to trigger the light on again. Basically guite unuseful device 🙁
Unfortunately I have 4 motion detectors in the house and same problem in every room.

Thomas Deschenes
1 year ago

Thank you for your insight on this. Also from Chiang Mai, I have started a smarthome business, more of a hobby at this point, and have been working with SONOFF since before they had Zigbee devices. I have been reluctant to try their Zigbee devices.

What I would really like to be able to do is to flash the devices to work with Home Assistant so that I can have a custom system that works with multiple branded devices. If you know anyone with these skills, especially Thai, I would like to employ their services.

Khadas VIM4 SBC