Motion sensors to turn on an outlet that powers a water pump

Howdy all! I’m trying to find a motion sensor (or rather collection of sensors - 5 sensors in 5 different rooms) that I could get to turn on a zigbee certified smart plug (leaning toward/but not married to the Decora Smart Plug-In Single Outlet, Zigbee Certified at https://www.homedepot.com/p/Leviton-Decora-Smart-Plug-In-Single-Outlet-Zigbee-Certified-DG15A-1BW/315388352) and then turn it off 30 minutes after the last motion is detected. Currently I have a hot water recirculation pump being controlled by a wemo plug set to run each evening from 6PM-10PM. After watching a tutorial I was inspired to explore options for a system that was controlled by motion sensors vs. a set schedule. After receiving advice from several awesome folks online, I’ve been able to resurrect an old hp2000 (currently running Ubuntu 22.04, but planning to install home assistant (NOT supervised) in the near future. On that note, I’m wondering if I can accomplish my goal using HA or if I’m going to need Supervised. Thoughts? :thinking:

As far as equipment, I’m inclined to go with the Sonoff Zigbee 3 Plus (looks like walmart has one for around $20 US), the aforementioned Leviton Decora plug, and the big question mark: motion sensors. One person suggested the SONOFF SNZB-03 ZigBee Motion Sensor ($9.49 from https://itead.cc/product/sonoff-snzb-03-zigbee-motion-sensor/) but it seems to be used more for turning on lights. Can it be used to turn on a smart plug if so, which one and how would I find out if it would work with the Decora?). I’ve also hear that the Aqara 1 is good, but it’s also fairly pricey compared to the former and it also requires an Aqara hub? Not averse to paying the extra, but if I can get away with less - why not. Open to suggestions/ideas on equipment/configurations though simple is best in my book. Also, looking to the future, someday it might be nice a system that would support electronic door locks but not the main goal at this point. Many thanks in advance for your help!

That is what I use and for me they work well.

The motion sensor does not turn on anything. When used with node-red, the motion events are picked up by node-red (usually via zigbee2MQTT) and then you can do anything you like, such as controlling your pump. Node red should be able to control any zigbee smart socket, but check the zigbee2MQTT website to ensure compatibility. I have a SmartThings mains socket with power meter GP-WOU019BBDWG, but there are many to choose from.

My personal choice is not to use Home Assistant, but to do it all in node-red, which is what most here do.

I use them too, they are very quick. Keep in mind that motion sensor are not human presence sensors, there is quite a lot of debate (even research papers) about motion sensors, as long as your trigger timeouts are longer than the motion sensor timeout, you should be ok (in the case of the SNZB-03 it is 1 minute). No home-assistant here either, just zigbee2mqtt.

Colin, thank you for sharing! I googled "what is node red" and I suppose I'll have to find a good tutorial on how to use it. If I can avoid Home Assistant and still accomplish the same thing I will! Do you have any tutorials you recommend for a noob?

Bakman2, thank you much! Is there a way to set the timeout for say 30 minutes? Also, any tutorials on using node red exclusively that you might suggest for a beginner would be much appreciated.

The Aquara ‎RTCGQ11LM does not require an Aquara hub. Works with zigbee2MQTT no problem. (Also provides lux data). It is more expensive than the Sonoff, but it is also a lot neater.

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

For installing in Ubuntu, use this script, which works for Debian based OSs, such as Pi and Ubuntu.

Buckskin thank you! I'll look into the Aquara ‎RTCGQ11LM!

The playlist looks like just what the doctor ordered and will go through it! Also, many thanks for the script!

@Colin Looks like the Leviton DG15A-1BW control via MQTT | Zigbee2MQTT will work! I looked into the adapter you mentioned (GP-WOU019BBDWG) but it looks like it's designed for use with 220-240V. Here in the States I'm dealing with 110V. Also, I completed the Node-RED Essentials playlist you recommended. Good stuff!! I'll be referring to it again no doubt as I gather my hardware and get node-red installed.

@Buckskin , @Colin , @bakman2 Was about to place an order for 3 of the SONOFF SNZB-03 ZigBee Motion Sensor when I came across this review from itead.com "bought three of these along with the USB Dongle and set it up in Home Assistant using ZHA. Everything I placed the sensors around my home and everything setup easily and worked perfectly. I ordered several more. Soon, some sensors started showing as unavailable so I purchased two wall outlets solely to use as router devices. Some of the sensors showed routing through the wall switches but most did not even though they were very close. eventually all pir sensors failed and required re-pairing to be seen by the coordinator. Repeated re-pairing only works for a day or two and then each device is shown as unavailable. Once they fail, they do not recover on their own. This was, for me, a waste of money as the five PIR sensors, coordinator, and two router devices are all useless to me. BTW, the two wall switches always show solid connection in the network and see each other. Just no routing or connection to the PIR sensors. I do not recommend this equipment for anyone." Now I'm a bit leery of making the purchase and more inclined to the Aqara that @Buckskin mentioned. It's twice the price but if it works... Thoughts? Also, I should add that I just found the Aqaras for around $13 US with shipping (aliexpress).

I have not had any such problems. On one of them the battery ran out after just a few weeks, I think possibly they ship them with cheap batteries. Apart from that they have been running for a year now with no problems. I wonder whether he used a poor co-ordinator. There are a lot of cheap rubbish ones about. The sonoff 3 plus are good.

1 Like

@Colin @Buckskin @bakman2 Howdy all! I've (apparently) successfully installed the script in the link that Colin provided. Now going through "Learn how to secure your editor" (link at the bottom of the linked page) to be followed by "Create your first flow." Thank you again for your help in this journey!

You only need to do that if you wish it to be accessible via the internet, or you wish to only allow certain users within your organisation to access it.

1 Like

Okay. I wasn't aware of that, but I guess one of my questions is are there any benefits to making it accessible via the internet? Or is it more hassle than it's worth? I'm doing this project for an apartment that I'm renovating. I don't live on site so I suppose it would be nice to be able to check the "status" of the system remotely, though I'm not opposed to doing so periodically by in person visits. Thank you @Colin

Yes go to the effort now as it will be the best to have it locked down now before you need it

Also in relation to your initial post about how to trigger the water pump - which is where your whole journey started - have a look at the built in trigger node - it will easily do exactly what you need

Craig

1 Like

Craig, thank you for your advice! I've been looking into TLS and one node red "guru" suggested that the use of a proxy server may be a good idea. Seems like a lot of expense and maintenance for a small system like this. Thoughts? Also, I posted this topic: Best place to keep certs ubuntu - fresh install of node red v3 as I'm at a loss where to put my Certs directory. Many thanks, Jon

Making your system accessible via the internet is not to be taken lightly. There are bots out there probing systems to find vulnerabilities, and if they find anything then you will be hacked. Also it is not only the device open to the internet that is at risk. Once a hacker is into your network then your other systems are at risk too. Unless you are prepared to put in the effort to keep the system safe then don't do it. If you just need simple notifications and control then possible using something like Telegram may well be enough.

See this FAQ post for advice on how to safely access node-red over the internet.

1 Like

It isn't expensive. Maintenance, once set up, is just about zero. For a simple configuration, the "Caddy" web server is probably best since it includes the ability to automatically connect to and update certificates from Let's Encrypt. I found Caddy to be great for simple setups but not so good for more complex ones where I recommend NGINX but the setup if more complex then. Configurations for both have been shared in the forum before.

The only cost is for a registered domain. If you register via Cloudflare, you don't pay any overheads and the cost is a few US$ a year.

1 Like

@TotallyInformation Julian thank you for sharing about Caddy! Will I need a separate machine (laptop, server, etc.?) to run Caddy on or can I use it on the same HP 2000 laptop I'm running Ubuntu (Node red) on? The tutorial I'm following says I'll need Ubuntu Server 22.04. My search here in the forum hasn't yielded any results for configuring Caddy for my situation. So I found another tutorial: Caddy Server - How to Install Caddy Web Server on Ubuntu - YouTube and the author doesn't indicate whether he's already installed Ubuntu Server 22.04 or no. From what I gather, he's just installed it on Ubuntu Desktop.