In order to be able to automate your own smart home properly, one function is quite important: Are residents present or not? This is the only way the system can, for example, automatically deactivate the heaters, switch certain lights off or on or even activate the alarm functions.
In the article Node Red / FritzBox – presence detection with the FritzBox I have already described how this can be achieved using the function integrated into a FritzBox. But what if you don't use a FritzBox as a router?
In that case, there are a few other options, one of which I would like to describe to you in this article. The presence of various devices (e.g. residents' smartphones) can also be realized via regular ping requests.
These regular ping queries can be automated and evaluated with NodeRed. An initial basis for this automation is described in the following article.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
To be able to install new nodes, NodeRed should of course already be installed on your RaspberryPi.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.
- RaspberryPi – setup for nerdiys!
- RaspberryPi – Tuee First configuration!
- RaspberryPi – Control the RaspberryPi via SSH
- NodeRed – Installing NodeRed on the RaspberryPi
- NodeRed – Install new nodes
- NodeRed - import and export node code
In the following lists you will find all the parts you need to implement this article.
Required tool:
Number | Link |
---|---|
1x | Screwdriver set Buy at Amazon |
1x | SD card reader Buy at Amazon |
Required material:
Number | Link |
---|---|
1x | Raspberry Pi Buy at Amazon |
1x | Raspberry Pi power supply Buy at Amazon |
1x | Raspberry Pi case Buy at Amazon |
1x | Micro SD card 64GB Buy at Amazon |
1x | SMA EV CHARGER 22 Wallbox |
Import Node Red code
In this section you will find the Node Red code you need. How you can import this into your NodeRed environment is in the article NodeRed - import and export node code described.
To use the node code linked below with your ESPEasy device, you need to make a few changes. These are described in the next section.
You can find the Node Red code in the Nerdiy Git repository at the following link:
In order for the Node Red Flow to work correctly, you must enter the IP address of the device from which you want to query the presence in the area marked red.
You can find information on how to find out the IP addresses of individual devices in the article
The area marked in red shows the JavaScript code that converts the response time into a presence signal.
You can therefore use the global variable "device_is-present" to evaluate the presence status of the device.
More articles about Node Red
In the following categories you will find further links on the topic of Node Red.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂