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 heating, switch certain lights on or off or even activate the alarm functions.
In the article Node Red / FritzBox – presence detection with the FritzBox, I already described how this can be implemented using the function integrated in 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 in this article. The presence of different devices (e.g. the smartphones of the residents) can also be realized via regular ping requests.
These regular ping queries can be automated and evaluated with NodeRed. A first basis for this automation is described in the following article.
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
So that you can 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 – The first configuration!
- RaspberryPi – Control the RaspberryPi via SSH
- Node Red – Installing Node Red on the Raspberry Pi
- 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.
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 described in the article NodeRed – importing and exporting node code.
In order to be able to use the node code linked below with your ESPEasy device, you have to make a few changes. These are described in the next section.
You can find the Node Red code in the Nerdiy Git repository under the following link:
In order for the Node Red Flow to work correctly, you must enter the IP address of the device whose presence you want to query in the red area.
Information on how to find out the IP addresses of individual devices can be found in the article
So you can use the global variable “device_is-present” to evaluate the presence status of the device.
In the following categories you will find further links on the subject of Node Red.
Have fun with the project
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. 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 appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂