Skip to content

Instantly share code, notes, and snippets.

@coolchip
Created November 3, 2016 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolchip/4a94b6ae30a711a95439189d40860da0 to your computer and use it in GitHub Desktop.
Save coolchip/4a94b6ae30a711a95439189d40860da0 to your computer and use it in GitHub Desktop.
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}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment