{"id":1151,"date":"2014-06-30T14:51:55","date_gmt":"2014-06-30T14:51:55","guid":{"rendered":"http:\/\/biosrhythm.com\/?p=1151"},"modified":"2014-06-30T15:06:29","modified_gmt":"2014-06-30T15:06:29","slug":"using-prowl-to-announce-ip-address-of-raspberry-pi","status":"publish","type":"post","link":"https:\/\/biosrhythm.com\/?p=1151","title":{"rendered":"Using Prowl to Announce IP Address of Raspberry Pi on iOS"},"content":{"rendered":"<p><img loading=\"lazy\" src=\"http:\/\/biosrhythm.com\/wp-content\/uploads\/2014\/06\/BqSmQYxCYAAB4SN-168x300.jpg\" alt=\"Prowl on iOS\" width=\"168\" height=\"300\" class=\"alignright size-medium wp-image-1161\" srcset=\"https:\/\/biosrhythm.com\/wp-content\/uploads\/2014\/06\/BqSmQYxCYAAB4SN-168x300.jpg 168w, https:\/\/biosrhythm.com\/wp-content\/uploads\/2014\/06\/BqSmQYxCYAAB4SN-450x800.jpg 450w, https:\/\/biosrhythm.com\/wp-content\/uploads\/2014\/06\/BqSmQYxCYAAB4SN.jpg 576w\" sizes=\"(max-width: 168px) 100vw, 168px\" \/>If you use your Raspberry Pi without a keyboard and monitor, you know how frustrating it can be to use it without knowing it&#8217;s IP address. By default, the Raspberry Pi is configured to use DHCP to obtain an IP address. This is great for moving the unit around to different networks but can be annoying when you want SSH to the unit. Typically you can use the zero-config\/Bonjour &#8220;raspberrypi.local&#8221; address but this doesn&#8217;t always work. I&#8217;ve instead come up with a way to use Prowl to notify me of the current IP address after it boots. As a bonus it works with either an Ethernet or WiFi (or both) connection.<\/p>\n<p>Prowl is a Growl push notification service for iOS. <a href=\"https:\/\/itunes.apple.com\/us\/app\/prowl-growl-client\/id320876271?mt=8\">It costs $3 and is available from the iTunes App Store<\/a>.<\/p>\n<p>1. The first step is to download and install Prowl and setup an account. Next, <a href=\"https:\/\/www.prowlapp.com\/api_settings.php\">obtain an API key from Prowl<\/a>. Copy the API key&#8211; you&#8217;ll need to insert it into a script below.<\/p>\n<p>2. Next, create two files in your home directory (\/home\/pi\/) called prowl.sh and prowlip.sh. Insert the API key into prowl.sh as shown.<\/p>\n<hr>\n<p><strong>File: prowl.sh<\/strong> from <a href=\"https:\/\/gist.github.com\/koma5\/911389\">koma5 on github<\/a>.<br \/>\n<code><br \/>\n#! \/bin\/sh<br \/>\n# Usage: .\/prowl.sh priority(-2 to 2) app event description<br \/>\n# Example: .\/prowl.sh 0 \"transmission\" \"torrent has finished\" \"Coen Brothers Compilation has finised downloading\"<br \/>\napp=$2<br \/>\npriority=$1<br \/>\nevent=$3<br \/>\ndescription=$4<br \/>\napikey=PASTE_YOUR_HEXADECIMAL_API_KEY_HERE<\/p>\n<p>if [ $# -ne 4 ]; then<br \/>\necho \"Usage: .\/prowl.sh priority(-2 to 2) app event description\"<br \/>\necho 'Example: .\/prowl.sh 0 \"transmission\" \"torrent has finished\" \"Coen Brothers Compilation has finised downloading\"'<br \/>\nelse<br \/>\ncurl https:\/\/prowl.weks.net\/publicapi\/add -F apikey=$apikey -F priority=$priority -F application=\"$app\" -F event=\"$event\" -F description=\"$description\"<br \/>\nfi<br \/>\n<\/code><\/p>\n<hr>\n<p><strong>File: prowlip.sh<\/strong> with apologies to original author.<br \/>\n<code><br \/>\n#!\/bin\/sh<\/p>\n<p>eth=`ifconfig eth0 | awk -F':' '\/inet addr\/&&!\/127.0.0.1\/{split($2,_,\" \");print _[1]}'`<br \/>\nwlan=`ifconfig wlan0 | awk -F':' '\/inet addr\/&&!\/127.0.0.1\/{split($2,_,\" \");print _[1]}'`<\/p>\n<p>if [ \"x$eth\" = \"x\" ]; then<br \/>\n  eth=\"\"<br \/>\n    # Variable is empty<br \/>\nelse<br \/>\n  eth=\"eth0: $eth \"<br \/>\nfi<\/p>\n<p>if [ \"x$wlan\" = \"x\" ]; then<br \/>\n  wlan=\"\"<br \/>\n    # Variable is empty<br \/>\nelse<br \/>\n  wlan=\"wlan0: $wlan\"<br \/>\nfi<\/p>\n<p>\/home\/pi\/prowl.sh 0 \"Raspberry Pi\" \"IP Address\" \"$eth$wlan\"<br \/>\n<\/code><\/p>\n<hr>\n<p>3. Set both files to executable by typing<br \/>\n<code><br \/>\nchmod 755 prowl.sh prowlip.sh<br \/>\n<\/code><\/p>\n<p>4. Add this line to \/etc\/rc.local before the &#8220;exit 0&#8221; line. This will execute the script at startup.<br \/>\n<code><br \/>\n\/home\/pi\/prowlip.sh<br \/>\n<\/code><\/p>\n<p>5. Reboot your Raspberry Pi and you should receive a push notification from Prowl on your iOS device with the current IP address(s).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you use your Raspberry Pi without a keyboard and monitor, you know how frustrating it can be to use it without knowing it&#8217;s IP address. By default, the Raspberry Pi is configured to use DHCP to obtain an IP address. This is great for moving the unit around to different networks but can be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"_links":{"self":[{"href":"https:\/\/biosrhythm.com\/index.php?rest_route=\/wp\/v2\/posts\/1151"}],"collection":[{"href":"https:\/\/biosrhythm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/biosrhythm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/biosrhythm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/biosrhythm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1151"}],"version-history":[{"count":15,"href":"https:\/\/biosrhythm.com\/index.php?rest_route=\/wp\/v2\/posts\/1151\/revisions"}],"predecessor-version":[{"id":1168,"href":"https:\/\/biosrhythm.com\/index.php?rest_route=\/wp\/v2\/posts\/1151\/revisions\/1168"}],"wp:attachment":[{"href":"https:\/\/biosrhythm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/biosrhythm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/biosrhythm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}