Need a push notification service?

Tell us about your projects. Update us regularly.
Post Reply
parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Need a push notification service?

Post by parkview » Tue Jan 19, 2016 10:14 pm

Hi,

with all this weather around lately, I thought it would be nice to have my RPi weather station send me updates. Initially I thought of twitter (very public), wechat (because I have it and it's a great service, but I would have needed a public facing webserver), but then someone mentioned a service called PushBullet.

I had never heard of that one. It so easy though. In 10-15min. you can setup an PB account (uses Facebook or Google to login), generate an API key, and start sending your mobile device some messages. I wrote up a bit of info here: https://www.raspberrypi.org/forums/viewtopic.php?f=41&t=133039&sid=65a056a660e1bdfc0e21f098c6204b9b&p=886852#p886852

You can push out Weather info, graphs, photos, RPi boot up IP Address, Bootup/shutdown notifications, status info, security notifications, Octoprint print notifications... this list is endless! :D

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Need a push notification service?

Post by parkview » Fri Jan 22, 2016 11:07 pm

Note: if you want to run a PushBullet bash/python script at boot up, you will need to sleep, or pause the script for 10 seconds so the network can properly establish.

Here is a bash script that uses curl (something different) to push out a notification to a PB account:

Code: Select all

#!/bin/bash
#
#  sends out a pushbullet notification to an account

cd /home/pi/pushbullet
sleep 10

API="add-pushbullet-api-here"
DATETIME=`date "+ %Y-%m-%d %H:%M:%S: "`
HOSTNAME=`hostname | tr '[:lower:]' '[:upper:]' `
IPADD=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
MSG=" '$HOSTNAME' $IPADD has booted up at: $DATETIME!"

curl -u $API: https://api.pushbullet.com/v2/pushes -d type=note -d title="RPi Booted up:" -d body="$MSG"  >/tmp/BOOT.out 2>/tmp/BOOT.err


I call it from: /etc/rc.local so it kicks off at boot up. It can also be called from the root crontab.

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Need a push notification service?

Post by parkview » Mon Feb 08, 2016 7:04 am

Example Screenshot of a PushBullet notification:

PB screenshot.jpg
PB screenshot.jpg (41.89 KiB) Viewed 5034 times

User avatar
seaton
Master Maker
Posts: 222
Joined: Tue Jun 24, 2014 11:41 am
Location: Bunbury, WA
Contact:

Re: Need a push notification service?

Post by seaton » Mon Feb 08, 2016 10:14 pm

I must give this a go, even for work I see it would be nice

Post Reply