Ask Fritz!Box who is at home

A flow, that asks fritz!box, who is at home. For that edit the mac list and add/remove persons from list. Edit the MAC for each user. Use for example the mac of the smartphone. At the end of the flow the presence is printed to the debug out. Also you can publish this to mqtt.

[{"id":"5ca38ebf.4e20b","type":"inject","z":"ca9fa2ba.c5628","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":60,"wires":[["3dbffa8f.ffbc66"]]},{"id":"3dbffa8f.ffbc66","type":"function","z":"ca9fa2ba.c5628","name":"mac list","func":"macList = { \"bob\":\"12:12:12:12:12:12\",\n            \"linda\":\"34:34:34:34:34:34\",\n            \"paul\":\"56:56:56:56:56:56\" };\n\nmsg.payload = macList;\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":60,"wires":[["e75c1edd.22298"]]},{"id":"ab5e6f6e.1e689","type":"debug","z":"ca9fa2ba.c5628","name":"","active":true,"console":"false","complete":"true","x":730,"y":160,"wires":[]},{"id":"27775190.f7f8ce","type":"function","z":"ca9fa2ba.c5628","name":"frame data","func":"newMsg = { \"payload\": {\"NewMACAddress\": msg.payload},\n           \"hostname\": msg.parts.key };\n\nreturn newMsg;","outputs":1,"noerr":0,"x":610,"y":60,"wires":[["805f607a.cd5ea"]]},{"id":"e75c1edd.22298","type":"split","z":"ca9fa2ba.c5628","name":"","splt":"","x":450,"y":60,"wires":[["27775190.f7f8ce"]]},{"id":"805f607a.cd5ea","type":"fritzbox-in","z":"ca9fa2ba.c5628","device":"cb769716.cc9b48","name":"ask fritz.box","service":"urn:dslforum-org:service:Hosts:1","action":"GetSpecificHostEntry","arguments":"{\"NewMACAddress\":\"value\"}","x":330,"y":160,"wires":[["1f1586f3.a24d79"]]},{"id":"1f1586f3.a24d79","type":"function","z":"ca9fa2ba.c5628","name":"format output for mqtt","func":"msg = { \"payload\": msg.payload.NewActive,\n        \"topic\": \"human/presence/\" + msg.hostname };\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":160,"wires":[["ab5e6f6e.1e689"]]},{"id":"cb769716.cc9b48","type":"fritzbox-config","z":"","name":"MyFritz","host":"fritz.box","port":"49000","ssl":false}]
coolchip

Flow Info

created 1 year ago

Node Types

Core
  • debug (x1)
  • function (x3)
  • inject (x1)
Other

Tags

  • fritzbox
  • fritz!box
  • presence
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option