An important event that your SmartHome should be able to react to is the presence status of the residents. For example, you can turn off the lights when you are away or turn on the radiators when you are present.
Are you by chance still in the possession of a FritzBox this presence detection is particularly easy.
All you need is a FritzBox, NodeRed and the MAC address(es) of the resident smartphones.
How you implement the presence detection with the FritzBox in NodeRed is described in the following article.
Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section.
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂
Safety instructions
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/
Affiliate links / advertising links
The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and store via this link, Nerdiy.de receives a commission from the online store 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. 🙂
Requirements
Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration.
How to prepare a RaspberryPi and then install NodeRed on it, is described in the following articles.
- RaspberryPi - Setting up for Nerdiys!
- RaspberryPi - The first configuration
- RaspberryPi - Controlling the RaspberryPi via SSH
- NodeRed - Installing NodeRed on the RaspberryPi
- NodeRed - Install New Nodes
- NodeRed - Import and Export Node Code
Required tools:
-none-
Required material:
In the following list you will find all the parts you need to implement this article.
Log in to the NodeRed configuration interface
Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

Install FritzBox node
So that NodeRed can communicate with your FritzBox you have to install the node "node-red-contrib-fritz". How to install Nodes is described in the article NodeRed - Install New Nodes.
Enter FritzBox node configuration
So that the just installed FritzBox node can also communicate with your FritzBox, you have to specify your FritzBox login data in the configuration of the node.



Node code for presence detection
The presence detection on you FritzBox works in principle on the fact that it checks periodically which smartphones are logged in the Wi-Fi or network of the FritzBox.
First, you need to insert the Node Code listed below into your NodeRed configuration.
Then you need the MAC addresses of the smartphones whose presence you want to recognize. This you have to then enter in a further step in the configuration of the Fritz! Box node.

Node code:
[{"id":"cf98613.60e11a","type":"comment","z":"26fe5591.f8118a","name":"PresenceMobile1","info":"","x":150 ,"y":1980,"wires":[]},{"id":"eedc08fb.12b8f8","type":"inject","z":"26fe5591.f8118a","name":"PresenceMobile1 ","topic":"","payload":"{\"NewMACAddress\": \"XX:XX:XX:XX:XX:XX\" }","payloadType":"json","repeat" :"60","crontab":"","once":true,"onceDelay":"1","x":200,"y":2040,"wires":[["38b70c39.68f504"] ]},{"id":"c546f3f1.387d1","type":"debug","z":"26fe5591.f8118a","name":"PresenceHandy1","active":false,"tosidebar": true,"console":false,"tostatus":false,"complete":"payload.NewActive","x":620,"y":2020,"wires":[]},{"id":" 1c07ae94.c6b621","type":"trigger","z":"26fe5591.f8118a","op1":"PresenceMobile1 is registered in the network","op2":"0","op1type":"str" ,"op2type":"str","duration":"0","extend":false,"units":"ms","reset":"0","bytopic":"all","name" :"","x":890,"y":2040,"wires":[["38b38282.c0058e"]]},{"id":"3c25ea32.a803d6","type":"change", "z":"26fe5591.f8118a","name":"","rules":[{"t":"set", "p":"payload","pt":"msg","to":"payload.NewActive","tot":"msg"}],"action":"","property":"", "from":"","to":"","reg":false,"x":640,"y":2100,"wires":[["1c07ae94.c6b621","379d6bd2.312594"] ]},{"id":"379d6bd2.312594","type":"trigger","z":"26fe5591.f8118a","op1":"PresenceMobile1 is no longer registered in the network","op2": "0","op1type":"str","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"1", "bytopic":"all","name":"","x":890,"y":2120,"wires":[["59fcf739.918c68"]]},{"id":"38b38282. c0058e","type":"pushbullet","z":"26fe5591.f8118a","config":"274f4530.883c1a","pushtype":"note","title":"Presence","chan" :"","name":"","x":1110,"y":2040,"wires":[]},{"id":"59fcf739.918c68","type":"pushbullet", "z":"26fe5591.f8118a","config":"274f4530.883c1a","pushtype":"note","title":"Presence","chan":"","name":"", "x":1110,"y":2120,"wires":[]},{"id":"38b70c39.68f504","type":"fritzbox-in","z":"26fe5591.f8118a" ,"device":"eef817a2.74b848","name":"","service":"urn:dslforum-org:service:Hosts:1"," action":"GetSpecificHostEntry","arguments":"{\"NewMACAddress\":\"value\"}","x":400,"y":2040,"wires":[["c546f3f1.387d1" ,"3c25ea32.a803d6"]]},{"id":"274f4530.883c1a","type":"pushbullet-config","z":"","name":"FabsPushbullet"},{"id ":"eef817a2.74b848","type":"fritzbox-config","z":"","name":"FasbFritzBox","host":"fritz.box","port":"49000" ,"ssl":false}]
It is important that after importing the NodeCode you have to update the MAC address entered in the FritzBox node. This should of course correspond to the device whose presence you want to monitor. How to find out the MAC address(es) of devices in your network is mentioned in the article Viewing/discovering IP addresses of devices on the network.

Define a fixed MAC address for your smartphone
Some smartphone manufacturers have meanwhile switched the MAC addresses of their devices to random changes. This is a security feature so that your smartphone cannot be tracked in a potentially foreign WiFi.
In our case, however, it is a hindrance because we identify the smartphones at the fixed MAC address. Therefore you should deactivate this function for your WLAN.
Disable random MAC address on Android 11:
Switch to:
- Settings
- connections
- WiFi
- Click on the gear next to your (connected) WiFi
- Extended
- MAC address type -> set to "Telephone MAC"
Disable random MAC address on iOS:
On iOS, this function is hidden somewhat cryptically under the term "private WiFi address". You can find them at:
- Settings
- WiFi
- Network (the one you are currently connected to)
- Private WiFi address -> deactivate
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 that I share this information with you, I would be happy about a small donation to the coffee box. 🙂
Hello all,
I used your instructions as described above.
Unfortunately, the following appears in the "debug" bar:
"No credentials set for pushbullet config."
where can I set credentials for pushbullet configuration?
And what do I have to set there exactly?
Hope you can help me 🙂
Sincerely
Jurgen
Hello Jurgen,
you are seeing the error message because a pushbullet message is sent when presence or absence is detected. This is a push notification service. You can find more information and how to set it up here: https://nerdiy.de/nodered-pushbullet-nachrichten-bei-ereignissen-senden/
If you don't want to use the service, you can of course simply delete the nodes. 🙂
Best regards
Fabian