Send Notification on Respberry pi Start to android

Python Script to send notification on raspberry pi startup

Bash
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from pushover import Client
import time
import urllib2

def wait_for_internet_connection():
    while True:
        try:        
       response =    urllib2.urlopen('https://google.com',timeout=1)
          return
        except urllib2.URLError:
            pass

def main():
    Client().send_message("Started OSMC", title="Yo Master!")    

wait_for_internet_connection()
main()

Add following line to crontab

Bash
1
@reboot python /path/to/python/script
  • The python script will wait for the network connection to establish and then execute the command
  • You need Python-Pushover pip package
  • Setup your default pushover settings in `~/.pushoverrc`` file