FRITZ!box router to PiLite Caller ID Display (Raspberry Pi)

The Fritz!Box routers (http://www.avm.de/en/index.php3) contain an integrated telephone answering machine and can be configured to output CallerID details of calls (incoming and outgoing) to port 1012.

This flow listens to the telnet stream on that port and when an incoming call occurs selects the phone number and passes that to the PiLite LED display (http://shop.ciseco.co.uk/pi-lite-white-lots-of-leds-for-the-raspberry-pi-1206-white/). If the number if not available it passes "Number withheld"

Uses following nodes:

  • TCP input
  • Function
  • Delay nodes (_to_repeat_number_on_display)
  • Serial output (requires serialport node to be installed.)
  • Inject (_to_modify_PiLite_config_if_necessary)

Configuration Required

  • Requires serialport package to be installed before starting Node-RED npm install serialport
  • To work you need to activate tcp port 1012 on your Fritz!Box by dialing #96*5*
  • Change TCP node to point at IP address of router
  • Set Scroll Speed - Set scrolling delay in mS. 1 is scrolling very fast, 1000 is scrolling very slow. Default speed is 80. $$$SPEED<Number>
[{"id":"1919bd63.e6e643","type":"serial-port","serialport":"/dev/ttyAMA0","serialbaud":"9600","newline":"\\r","addchar":"true"},{"id":"7211440f.8deebc","type":"serial out","name":"Send to PiLite","serial":"1919bd63.e6e643","x":808.8888549804688,"y":502.11109733581543,"z":"7cf9991f.830668","wires":[]},{"id":"36a45dc9.c95ba2","type":"tcp in","server":"client","host":"XXX.XXX.XXX.XXX","port":"1012","datamode":"stream","datatype":"buffer","newline":" \\n","topic":"FritzBox Telnet Calls","name":"","base64":false,"x":223.55548095703125,"y":265.19442558288574,"z":"7cf9991f.830668","wires":[["306150a8.cf9eb"]]},{"id":"306150a8.cf9eb","type":"function","name":"Parse FritzBox Telnet","func":"//Name: Parse FritzBox Telnet\n\n//\n//Requirements:\n//- TCP Input\n//- must be able to reach tcp port 1012 on your FB\n//- activate call monitor on FB by dialing #96*5*\n//\n//  Output : 1\n//-If context is RING, output is PhoneNumber\n// Other calltypes - CALL - Outgoing\n//                 - DISCONNECT  \n\ncontext.buff = context.buff || \"\";\ncontext.buff = context.buff + msg.payload;\n//context.buff = msg.payload;\n\nmess = context.buff.slice(18);\t// return rest of the buffer as the payload\nslices = mess.split(\";\");\ncalltype= mess.split(\";\",1);\n\nif (slices[2] == \"\") {\nphonenumber = \"Number withheld  \";}\nelse \n{\nphonenumber = slices[2] +\"  \";\n}\n\n\n//msg.payload= calltype ;\ncontext.buff = \"\";\nif (calltype == \"RING\") {\nmsg.topic = calltype;\t// return the first two chars as the topic\nmsg.payload = phonenumber;\t// return rest of the buffer as the payload\n\nreturn msg;\n}\nreturn null;\n//return msg;\n","outputs":1,"x":445.55548095703125,"y":266.19442558288574,"z":"7cf9991f.830668","wires":[["d479210b.2b86e","49ddb68c.b62248","7211440f.8deebc"]]},{"id":"95ea75ce.6a1588","type":"inject","name":"Set Scroll Speed","topic":"Scroll Speed","payload":"$$$SPEED35","repeat":"","crontab":"","once":false,"x":233.55548095703125,"y":379.77775382995605,"z":"7cf9991f.830668","wires":[["7211440f.8deebc"]]},{"id":"49ddb68c.b62248","type":"delay","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","x":836.8888549804688,"y":394.7777690887451,"z":"7cf9991f.830668","wires":[["7211440f.8deebc"]]},{"id":"d479210b.2b86e","type":"delay","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","x":832.5554809570312,"y":324.44442558288574,"z":"7cf9991f.830668","wires":[["7211440f.8deebc"]]},{"id":"261f05a7.d9e0fa","type":"comment","name":"FRITZ!box to PiLite Caller ID Display double click for more info...","info":"CallerID flow from Fritz!Box router (http://www.avm.de/en/index.php3) \nto\nPiLite display \n(http://shop.ciseco.co.uk/pi-lite-white-lots-of-leds-for-the-raspberry-pi-1206-white/) \n\nUses following nodes:\nTCP input\nfunction\ndelay nodes ( to repeat number on display)\nserial output\nInject ( to modify PiLite config if necessary)\n\n\n\nTo work first you need to activate tcp port 1012 on your Fritz!Box by dialing #96*5*\n\nChange TCP node to point at IP address of router\n\nAlso requires serialport node to be installed.\n\nSet Scroll Speed\nSet scrolling delay in mS. 1 is scrolling very fast, 1000 is scrolling very slow. Default speed is 80.\n$$$SPEED<Number>\n\n\n","x":349,"y":199,"z":"7cf9991f.830668","wires":[]}]

Flow Info

Created 11 years, 8 months ago
Updated 10 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x1)
  • delay (x2)
  • function (x1)
  • inject (x1)
  • tcp in (x1)
Other
  • serial out (x1)
  • serial-port (x1)

Tags

  • FRITZ!Box
  • PiLITE
  • TCP
  • Serial
  • RPi
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option