Esempio n. 1
0
def push(text: str, details: str, r: praw) -> None:
    """
    Push a message to computer
    :param text: MNT or WNT
    :param details: Match details
    :param r: PRAW instance
    :return: None
    """
    try:
        from pushbullet import Pushbullet
        with open('token.txt') as files:
            token = files.read().strip()
        pb = Pushbullet(token)
        try:
            lst = text.split('?')
            pb.push_note('{} match today at {} on {}'.format(details, lst[4], lst[3]),
                         '', device=pb.get_device('iPhone'))
        except IndexError:
            pb.push_note('{}{}'.format(text, details),
                         '', device=pb.get_device('iPhone'))

    except ImportError:
        lst = text.split('?')
        r.send_message('RedRavens', '{} Match Today'.format(details),
                       '{} match today at {} on {}'.format(details, lst[4], lst[3]))
Esempio n. 2
0
def setup_notification_pb():
	# Setup pushbullet notification
	from pushbullet import Pushbullet
	pb = Pushbullet(pushbullet_API)
	#print(pb.devices)
	dev = pb.get_device(pushbullet_Device)
	#push = dev.push_note("Alert!!", "My msg...")
	return dev
Esempio n. 3
0
 def pushbullet_notification(self):
     pb = Pushbullet("o.xgWW2FkTk3pGt2oQXM9m9TiQXF2GvUPQ")
     phone = pb.devices[0]
     phone = pb.get_device('OnePlus 7 Pro')
     if self.typeOfNotification == "notification":
         push = phone.push_note("Alert!", self.msg)
     elif self.typeOfNotification == "sms":
         push = pb.push_sms(phone, "+4521378019", self.msg)
Esempio n. 4
0
def notify_s10(title, body):
    api_key = config.push_key
    try:
        pb = Pushbullet(api_key)
        device = pb.get_device('S10')
        push = pb.push_note(title, body, device=device)
    except:
        print('Failed to notify - ' + title + ';' + body)
Esempio n. 5
0
def loop():
    reduser = reddit_object.redditor("{redditor username}")
    for post in reduser.submissions.new(limit=1):
        if "ama" in post.title.lower() and post.id != last_ama_id:
            push_bullet = Pushbullet(pushbullet_access_token)
            my_phone = push_bullet.get_device("{device identifier}")
            my_phone.push_note("AMA Posted","User {redditor username} is doing an AMA!")
            exit()
    threading.Timer(10.0,loop).start()
Esempio n. 6
0
def send_pushbullet_message(metro_time):
    from pushbullet import Pushbullet

    pb = Pushbullet(conn['pushbullet_api_key'])

    # If device name is provided, push to this device only
    to = pb.get_device(conn['pushbullet_device']) if conn['pushbullet_device'] else pb

    to.push_note("Time to go home!", "You have {0} minutes for the metro.".format(metro_time))
    print("Message pushed")
Esempio n. 7
0
def pushbullet_notification(notificationType, message):
    pb = Pushbullet("o.xgWW2FkTk3pGt2oQXM9m9TiQXF2GvUPQ")
    # Get all devices that the current user has access to.
    # Select a device
    phone = pb.devices[0]
    phone = pb.get_device('OnePlus 7 Pro')
    if notificationType == "notification":
        push = phone.push_note("Alert!", message)
    elif notificationType == "sms":
        push = pb.push_sms(phone, "+4521378019", message)
Esempio n. 8
0
def push_file(filename):
    if is_device_connected(DEVICE_MAC):
        print "Device is connected, not sending"
        return
    print "Sending", filename

    pushbullet = Pushbullet(PUSHBULLET_API_KEY)
    my_device = pushbullet.get_device(PUSHBULLET_DEVICE_NAME)
    file_data = pushbullet.upload_file(open(filename, "rb"), filename)
    pushbullet.push_file(device=my_device, **file_data)
    print "Sent!"
Esempio n. 9
0
class Notification:
    def __init__(self):
        with open("pushbullet_parameters.json",'r') as file:
            #Load parameters:
            # print(type(file))
            parameters=json.loads(file.read())
            self.pb = Pushbullet(parameters['pushbullet'])
            self.dev = self.pb.get_device(parameters['device'])
    def notify(self,title,text):
        push = self.dev.push_note(title, text)
        return push
Esempio n. 10
0
def push_file(filename):
	if is_device_connected(DEVICE_MAC):
		print "Device is connected, not sending"
		return
	print "Sending", filename

	pushbullet = Pushbullet(PUSHBULLET_API_KEY)
	my_device = pushbullet.get_device(PUSHBULLET_DEVICE_NAME)
	file_data = pushbullet.upload_file(open(filename, "rb"), filename)
	pushbullet.push_file(device = my_device, **file_data)
	print "Sent!"
Esempio n. 11
0
def send_pushbullet_message(metro_time):
    from pushbullet import Pushbullet

    pb = Pushbullet(conn['pushbullet_api_key'])

    # If device name is provided, push to this device only
    to = pb.get_device(
        conn['pushbullet_device']) if conn['pushbullet_device'] else pb

    to.push_note("Time to go home!",
                 "You have {0} minutes for the metro.".format(metro_time))
    print("Message pushed")
def send_image():

    if len(sys.argv) < 2:
        print('Missing image in arguments')
        return

    pb = Pushbullet(PUSHBULLET_API_KEY)
    image = sys.argv[1]
    with open(image, "rb") as pic:
        file_data = pb.upload_file(pic, "photo.jpg")

    device = pb.get_device('S10')
    push = pb.push_file(**file_data, device=device)
class PushNotification:
    def __init__(self):
        with open("/home/payam/Workspace/piNotification/settings.yaml",
                  'r') as stream:
            try:
                self.settings = yaml.safe_load(stream)
                self.pushbullet = Pushbullet(self.settings['access_token'])
                self.device = self.pushbullet.get_device(
                    self.settings['device_name'])
            except yaml.YAMLError as exc:
                print(exc)

    def notify(self, notificationType, message):
        self.device.push_note(notificationType, message)
Esempio n. 14
0
    def unlockVehicleFaceAuth(self, status):
        #Checks if user id or password is correct or not
        if status == 'True':
            pb = Pushbullet("o.Cj5JI5pc44aSBeGILk4y9ndEBiLzyWUf")
            print(pb.devices)
            dev = pb.get_device('HUAWEI TAS-L29')

            #Sends push notification to phone
            push = dev.push_note("NOTICE: ", "Vehicle Unlocked!!")
            reply = "Vehicle Unlocked!!"

        #If incorrect sends error message
        else:
            reply = "Unauthorised"
        return reply
Esempio n. 15
0
    def unlockVehicle(self, username, password):

        #Checks if user id or password is correct or not
        if obj.authenticate(username, password) == True:
            pb = Pushbullet("o.Cj5JI5pc44aSBeGILk4y9ndEBiLzyWUf")
            print(pb.devices)
            dev = pb.get_device('HUAWEI TAS-L29')

            #Sends push notification to phone
            push = dev.push_note("NOTICE: ", "Vehicle Unlocked!!")
            reply = "Vehicle Unlocked!!"

        #If incorrect sends error message
        else:
            reply = "Incorrect Username or Password"
        return reply
Esempio n. 16
0
File: a.py Progetto: 10sr/junks
def main():
    with open("token.secret") as f:
        token = f.read().strip()
    print(token)

    pb = Pushbullet(token)
    # print(pb.push_note("this is title", "hoehoe"))
    for d in pb.devices:
        print(d.nickname)
        print(d.device_iden)

    myiphone = pb.get_device("yuk-iPhoneSE-g")
    print(myiphone)
    print(myiphone.push_note("title", "body"))

    return
class PushbulletApi:
    def __init__(self):
        self.configFile = json.load(
            open(
                os.path.join(os.environ['OneDrive'], "PythonData", "config",
                             "pushbullet.json")))
        self.pb = Pushbullet(self.configFile['apiValue'])
        self.myDevice = self.pb.get_device(self.configFile['deviceName'])

    def pushSomething(self, item):
        push = self.pb.push_note(item.siteName,
                                 item.description,
                                 device=self.myDevice)

    def testApi(self):
        pb = PushbulletApi()
        pb.pushSomething("Travelator", "New vacation in Caraibe!")
Esempio n. 18
0
def main(title=''):
    to_push = str(pyperclip.paste())
    if len(to_push) < 1 or len(to_push) > 200:
        print('Content empty or too large to push')
        exit(0)
    try:
        with open(pickle_dump_file_path, 'rb') as pb_pickle_file:
            pb = pickle.load(pb_pickle_file)
    except:
        pb = Pushbullet(api_key)
        try:
            with open(pickle_dump_file_path, 'wb') as pb_pickle_file:
                pickle.dump(pb, pb_pickle_file)
        except:
            print('Error dumping pickle file')
    motog5 = pb.get_device('Motorola Moto G (5)')
    motog5.push_note(title, to_push)
Esempio n. 19
0
def send_to_pushbullet(new_list_of_id):
    print_if_debug_is_set("\n--")
    print_if_debug_is_set("In send_to_pushbullet:")
    from pushbullet import Pushbullet
    try:
        pb = Pushbullet('o.mjx5s4pc2ScCZFUoqcA8WH307cIdeXfB')
        print_if_debug_is_set("Adrien Faucon devices: " + str(pb.devices))
        my_smartphone = pb.get_device('LGE Nexus 5')

        if len(new_list_of_id) == 0:
            print_if_debug_is_set("Nothing to send")
        else:
            for id in new_list_of_id:
                url = "http://www.immoweb.be/fr/Global.Estate.cfm?IdBien=" + str(
                    id)
                push = pb.push_note("New house!", url, device=my_smartphone)
    except Exception as e:
        print(str(e))
Esempio n. 20
0
class PushbulletManager():
    '''
    Classe qui s'occupe du service Pushbullet (voir dans NewsScreen).
    Elle initie la connexion avec le service, et permet l'envoi de liens et de textes au besoin,
    par defaut vers le telephone de Pierre (Nexus 6P).
    '''
    def __init__(self):
        API = 'o.NzPTn5UX6rCsuEB1gcYouTluy1GO2Wti'

        self.pb = Pushbullet(API)
        self.nexusDevice = self.pb.get_device("Huawei Nexus 6P")

    def send_test(self):
        push = self.nexusDevice.push_link("Cool site", "https://lemonde.com")

    def send_link(self, title, link):
        print "pushing link :" + link
        push = self.nexusDevice.push_link(title, link)

    def send_text(self, title, text):
        push = self.nexusDevice.send_text(title, text)
Esempio n. 21
0
def init_device(pushusername):
    """Initialize the device that receives notification."""

    # Notification option (Default: Y)
    # ans = raw_input('Do you need Pushbullet notification? (Y/n): ')
    # while ans.strip().upper() not in ['Y', '', 'N']:
    #     ans = raw_input('Do you need Pushbullet notification? (Y/n): ')

    # if ans.strip().upper() == 'N':
    #     # Do not need notification
    #     return VoidDevice()

    # Check configuration file 'conf.json'
    if pushusername == 'yuxin':
        configname = 'conf_yuxin.json'
    elif pushusername == 'nan':
        configname = 'conf_nan.json'
    elif pushusername == 'jien':
        configname = 'conf_jien.json'

    if not os.path.exists(configname):
        conf = {
            'pushbullet_access_token': '',
            'device_name': ''
        }

        # Dump template file
        with open(configname, 'w') as fp:
            json.dump(conf, fp)

        print >> sys.stderr, 'Please set "conf.json" at first.'
        sys.exit(1)

    # Load configuration file
    with open(configname, 'r') as fp:
        conf = json.load(fp)

    # Please refer to related document on 'pushbullet.com'
    access_token = conf.get('pushbullet_access_token', None)
    device_name = conf.get('device_name', None)

    # Check access token
    if access_token is None:
        print >> sys.stderr, 'Please set your own pushbullet access token.'
        sys.exit(1)

    try:
        pb = Pushbullet(access_token)
    except pushbullet.errors.InvalidKeyError:
        print >> sys.stderr, 'Wrong api key!'
        sys.exit(1)

    # Check device name
    if device_name is None:
        print >> sys.stderr, 'Please set your own device name.'
        sys.exit(1)

    try:
        device = pb.get_device(device_name)
    except pushbullet.errors.InvalidKeyError:
        print >> sys.stderr, 'Wrong device name!'
        device_names = [device.nickname for device in pb.devices]
        print >> sys.stderr, 'Please select from: %s.' % (
            ','.join(device_names))
        sys.exit(1)

    # Print the information of the device
    print device
    return device
Esempio n. 22
0
from pushbullet import Pushbullet

pb = Pushbullet("o.N9fN9fxDfWLsjqaChdWJ2SmFRbgIrY0i")

dev = pb.get_device("Galaxy S9 Plus")
push = dev.push_note("Waarschuwing!!","Je kastje is opengemaakt!!")
Esempio n. 23
0
File: sms.py Progetto: tuxme/jarvis
#!/usr/bin/python
from pushbullet import Pushbullet
api_key = "[API KEY pushbullet]"
pb = Pushbullet(api_key)
device = pb.devices[1]
device = pb.get_device('HTC HTC One M9')

VerfiTEL = "NA"

#print device

#push = pb.push_sms(device, "0624881548", "06")

import sys, getopt, os


def main(argv):
    VerfiTEL = "NA"
    TEL = ''
    TEXTE = ''
    try:
        opts, args = getopt.getopt(argv, "ht:m:", ["tel=", "msg="])
    except getopt.GetoptError:
        #print 'sms.py -tel <msisdn> -msg <message>'
        print "Mauvais parametre"
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print "Mauvais parametre"
            sys.exit()
        elif opt in ("-t", "--tel"):
Esempio n. 24
0
import serial,string, time

from pushbullet import Pushbullet


room1=[0,0] #LISTS THAT STORES THE DATA FROM EACH ROOM

room2=[0,0]

pb = Pushbullet("o.Zg1TUbOapFyqotaPLAHzGwCCpmeKgToi")#API KEY FROM PUSH BULLET APP

print(pb.devices)#PRINT OYR DEVICES


dev = pb.get_device('Xiaomi Redmi Note 4')#DEVICE WHERE THE INTRUDER MESSSAGE WILL BE SENT

	while True:	#WHILE LOOP THAT CHECKS THE INPUT AND DETERMINES IF THE ALARM IS SET AND INTRUDERS HAVE BEEN DETECTED
    
	   ser = serial.Serial('/dev/ttyUSB0',9600)#SERIAL PORT WHERE WE GET THE DATA FROM
    
	   data = ser.readline()
    
	   data = data.split()#SPLIT THE DATA AND PUT IT ON A LIST
    
	   size = len(data)
    
           print(data)
    
	   if size == 1:#IF THE SIZE IS ONE THEN WE HAVE AN ALARM
	
Esempio n. 25
0
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver  # Need to use this one if monitoring a mounted share from another computer, like the NAS

print(time.ctime() + " Starting")

SS_DIR = '/mnt/surveillance'
PB_KEY = 'YOUR_PRIVATE_PUSHBULLET_KEY'
PB_ID = 'YOUR_PUSHBULLET_ID'
AR_KEY = 'YOUR_PRIVATE_AUTOREMOTE_KEY'
#OG_FILE  = '/home/bruce/mh/local/data/logs/ss_monitor.vlog.txt'
LOG_FILE1 = '/home/bruce/mh/www/ss/ss_monitor.vlog.txt'
LOG_FILE2 = '/home/bruce/mh/www/ss/ss_monitor.slog.txt'
RESTART = 6  # How many hours between restarts

pb = Pushbullet(PB_KEY)
nuc = pb.get_device(PB_ID)


def ar_to_cell(camera):
    r = requests.get("http://autoremotejoaomgcd.appspot.com/sendmessage?key=" +
                     AR_KEY + "&message=motion=:=" + str(camera))


class Camera:
    list = {}

    def __init__(self, name):
        self.name = name
        self.file_v = ''
        self.time_v = 0
        self.keep = 0
Esempio n. 26
0
def download(link, newdevice, video, delete, send):
    """Download a youtube video or playlist
    in best audio and video quality
    by providing a link, and then send to the
    preferred device, or override it with `--newdevice`
    option.

    Provide the device name for `--newdevice` in quotes for e.g. "OnePlus One".

    Please run `moboff initialise` if this is your first time.
    """
    os.chdir(real_path_of_MobOff)

    if os.path.exists('moboff_cfg.json'):
        with open('moboff_cfg.json') as json_file:
            data = json.load(json_file)
            api_key = data['user']['api_key']
            device = data['user']['device']
            directory = data['user']['directory']
    else:
        click.secho("Please run `moboff initialise` first.",
                    fg='red',
                    bold=True)
        quit()

    try:
        pb = Pushbullet(api_key)
    except pushbullet.errors.InvalidKeyError:
        click.secho(
            "API key you previously entered is no longer valid. Please rerun moboff initialise."
        )
        quit()

    phone = device

    if newdevice:
        click.secho(
            "Overriding preferred device : {0} with given device : {1}".format(
                device, newdevice))
        phone = newdevice

    try:
        to_device = pb.get_device(phone)
    except pushbullet.errors.PushbulletError:
        if newdevice:
            click.secho(
                "{0} isn't setup with Pushbullet. "
                "Please either set it up or check the spelling of entered device"
                .format(newdevice))
        else:
            click.secho(
                "The default device you entered initially doesn't exist anymore. "
                "Please rerun moboff initialise.")
        quit()

    try:
        os.chdir(directory)
    except OSError:
        click.secho(
            "The directory previously selected to download music can't be accessed."
            " Please rerun moboff initialise.")
        quit()

    os.mkdir("{0}/temp".format(directory))
    os.chdir("{0}/temp".format(directory))

    print("This may take a while.")

    if video is True:
        downloadcommand = [
            "youtube-dl", "--metadata-from-title", "%(artist)s - %(title)s",
            "-f", "bestvideo+bestaudio", "--add-metadata", "--output",
            "%(artist)s - %(title)s.%(ext)s", link
        ]
    else:
        downloadcommand = [
            "youtube-dl", "--metadata-from-title", "%(artist)s - %(title)s",
            "--extract-audio", "--audio-format", "mp3", "--audio-quality", "0",
            "--add-metadata", "--output", "%(artist)s - %(title)s.%(ext)s",
            link
        ]

    try:
        subprocess.check_output(downloadcommand, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError:
        print(
            "Please check your URL, it shouldn't be a private playlist link (eg liked videos)"
        )
        quit()

    click.secho("File successfully downloaded.", fg="green", bold=True)
    types = ('*.mp3', '*.mp4', '*.mkv')
    list_of_files = []
    for files in types:
        list_of_files.extend(glob.glob(files))

    for file in list_of_files:
        print("File to send : {0}".format(file))
        with open(file, "rb") as song:
            file_data = pb.upload_file(song, file)
        to_device.push_file(**file_data)
        print("The file has been sent to your {0}.".format(to_device))

    if send:
        for i, device in enumerate(pb.chats, 1):
            print("{0} : {1}".format(i, device))
        index = int(
            rawinput(
                "Enter the corresponding chat no. for the person you want to send the file to. "
            ))
        try:
            chat = pb.chats[index - 1]
            for file in list_of_files:
                print("File to send : {0}".format(file))
                with open(file, "rb") as song:
                    file_data = pb.upload_file(song, file)
                pb.push_file(**file_data, chat=chat)
        except:
            print("Contact does not exist.")
        else:
            print("The file has been sent to ", chat)

    for file in list_of_files:
        if file.endswith((".mp3", "mp4", ".mkv")):
            os.rename("{0}/temp/{1}".format(directory, file),
                      "{0}/{1}".format(directory, file))

    os.rmdir("{0}/temp".format(directory))
    os.chdir(directory)

    if delete:
        for file in list_of_files:
            os.remove(file)
Esempio n. 27
0
#!/usr/bin/python
import sys
import os
import time
import subprocess
from pushbullet import Pushbullet

server_name = subprocess.check_output(
    "cat pylinuxbot.log |grep command_line | grep ngrok.io | cut -d' ' -f 10 | cut -d= -f 2 | cut -d: -f 2",
    shell=True)
server_name = server_name.rstrip('\n')

if (server_name != ""):
    pb = Pushbullet("o.tfsE1vln5IaF7p7aUmOwusJZHItPiB3F")
    hw = pb.get_device('Samsung SM-G955F')
    hw.push_note("PPTRemote", "Server name")
    hw.push_note("", server_name)
else:
    print("Error getting server name")
    print("cat pylinuxbot.log")
Esempio n. 28
0
def notify_s10(title, body):
    pb = Pushbullet(PUSHBULLET_API_KEY)
    device = pb.get_device('S10')
    push = pb.push_note(title, body, device=device)
    print('Notified')
Esempio n. 29
0
        time.sleep(1)
    if Reading != IsOpen:
        IsOpen = 1
        if Reading == 1:
            IsOpenbool = "true"
        else:
            IsOpenbool = "false"

        #broadcast with picture
        r = requests.get('https://100k-faces.glitch.me/random-image')
        print(r.url)
        urllib.request.urlretrieve(r.url, "image.jpg")
        image = Image.open("image.jpg")
        print(image.size)
        image = Image.open('image.jpg')
        new_image = image.resize((128, 128))
        new_image.save('image128.jpg')
        time.sleep(2)
        print(new_image.size)
        time.sleep(2)
        with open("image128.jpg", "rb") as imageFile:
            bar = base64.b64encode(imageFile.read())
        os.path.getsize('image128.jpg')

        data = str(SensorID) + " " + str("1") + " " + str(int(
            time.time())) + " " + str(IsOpenbool) + " " + str(bar)
        print(data)
        dev = pb.get_device('OnePlus IN2023')
        push = dev.push_note("ALERT!!", "SOMEONE IS IN YOUR SLIKSKAB")
        s.sendto(bytes(data, "UTF-8"), ('<broadcast>', BROADCAST_TO_PORT))
        time.sleep(1)
flag2 = 0
flag = 0
flag1 = 0
while (True):
    now = datetime.now()
    morning_8am = now.replace(hour=8, minute=0, second=0, microsecond=0)
    morning_8_30am = now.replace(hour=8, minute=30, second=0, microsecond=0)
    if now > morning_8am and now < morning_8_30am:
        if flag == 0:
            print("yes")
            main("cup")
            flag = 1
    afternoon_1_30pm = now.replace(hour=13, minute=30, second=0, microsecond=0)
    afternoon_2pm = now.replace(hour=14, minute=0, second=0, microsecond=0)
    if now > afternoon_1_30pm and now < afternoon_2pm:
        if flag1 == 0:
            print("yes")
            main("cup")
            flag1 = 1
    night_8pm = now.replace(hour=0, minute=0, second=0, microsecond=0)
    night_8_30pm = now.replace(hour=0, minute=30, second=0, microsecond=0)
    if now > night_8pm and now < night_8_30pm:
        if flag2 == 0:
            print("yes")
            main("cup")
            flag2 = 1
    txt = speech_recognize()
    if txt == "help":
        dev = pb.get_device('OnePlus 6')
        push = dev.push_note("Alert!!", "Patient needs help immidiately")
    main("cup")
Esempio n. 31
0
from pushbullet import Pushbullet

#Put your access token here, for examle: o.bdkFgaQxqdvUVukSitumShX3DoszszQh
pb = Pushbullet("<your access token>")

#Get all devices that the current user has access to.
print(pb.devices)

#Get a device
dev = pb.get_device("Galaxy S7 Edge")

#1. Push Notification
push = dev.push_note("Alert!", "This PUSH-notification sent from Raspberry!")

# push is a dictionary containing the data returned by the Pushbullet API.
print('A dictionalry after 1:')
print(push)

#2. SMS-message
push = pb.push_sms(dev, "+31612345678", "This SMS sent from Raspberry!")
print('A dictionalry after 2:')
print(push)

#3. Push a file from file system
with open("thief.jpg", "rb") as pic:
    file_data = pb.upload_file(pic, "picture.jpg")
push = pb.push_file(**file_data)
print('A dictionalry after 3:')
print(push)

#4. Push a file already uploaded somewhere
Esempio n. 32
0
from picamera import PiCamera
from datetime import datetime
import time
from pushbullet import Pushbullet
from gpiozero import Button
from self import self

# connecting to push bullet api
pb = Pushbullet("o.xWndImaQeTc7WvQC6tK3yyTAJVdBKxrU")
# push = pb.push_note("Title","body")

# check the available devices
print(pb.devices)
# set your device
huawei = pb.get_device('HUAWEI HMA-L29')


class bellcam:
    now = datetime.now()
    button = Button(18)
    filename = ''

    def take_photo(self):
        global filename
        camera = PiCamera()
        # change this naming convention as it is not working
        filename = 'bell.jpg'
        camera.resolution = (800, 600)
        camera.capture('/home/pi/Desktop/cleaniot/' + (filename))
        camera.close()
        bellcam.push_notification(self)
Esempio n. 33
0
def push_noti(message):
    # load the key from the pushbullet_api_key.txt
    key = open('pushbullet_api_key.txt', 'r').read()
    pb = Pushbullet(key)
    dev = pb.get_device('Google Pixel 4a (5G)')
    dev.push_note('Automation Notification', message)
Esempio n. 34
0
# Must be updated here, I believe the new API doesn't allow this to work
from bs4 import BeautifulSoup
import time
import requests
from pushbullet import Pushbullet
from pushbullet import Listener

# Your Pushbullet API Key
pb = Pushbullet("*******")

# Target Device Name
device = pb.get_device('*******')


def get_artist_name():
    page = requests.get("https://www.heart.co.uk/berkshire/")
    soup = BeautifulSoup(page.content, 'html.parser')
    artist_info = soup.find('span',
                            itemprop="byArtist").find_all(text=True,
                                                          recursive=False)
    current_artist_name = (artist_info[0].strip())
    return current_artist_name


def pushMessage(device, msg):
    pushTitle = "Heart Radio Notification"
    push = device.push_note(pushTitle, msg)
    print("Message was sent!")


def contest_artist_name():
Esempio n. 35
0
from pushbullet import Pushbullet
apiKey = 'o.jsMGG789aqsV47OChBCGlPIJjQGli3Qz'
apiKeyRob = "o.uKvCG8jgepkDdoQBoUFzVJ84zCgyQ0VU"

pb = Pushbullet(apiKey)
pbRob = Pushbullet(apiKeyRob)

xperia = pb.get_device('Xperia M2')
oneplus = pbRob.get_device('OnePlus One')

def sendNotificationToMattia(title,body):
    push = xperia.push_note(title, body)
       

def sendNotificationToRoberto(title,body):
    push = oneplus.push_note(title, body)

    




import sys

from pushbullet import Pushbullet
pb = Pushbullet("o.eWNRCJhOPJTOnAgJ4BpJUFUemBuPsylv")

#get all your devices
print(pb.devices)

#send to specific device
xiaomi = pb.get_device('Xiaomi Redmi 4X')
push = xiaomi.push_note("[Experiment " + sys.argv[1] + "]",
                        "Please check results on [email protected]")
Esempio n. 37
0
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver   # Need to use this one if monitoring a mounted share from another computer, like the NAS

print(time.ctime() + " Starting")

SS_DIR    = '/mnt/surveillance'
PB_KEY    = 'YOUR_PRIVATE_PUSHBULLET_KEY'
PB_ID     = 'YOUR_PUSHBULLET_ID'
AR_KEY    = 'YOUR_PRIVATE_AUTOREMOTE_KEY'
#OG_FILE  = '/home/bruce/mh/local/data/logs/ss_monitor.vlog.txt'
LOG_FILE1 = '/home/bruce/mh/www/ss/ss_monitor.vlog.txt'
LOG_FILE2 = '/home/bruce/mh/www/ss/ss_monitor.slog.txt'
RESTART   = 6   # How many hours between restarts

pb        = Pushbullet(PB_KEY)
nuc       = pb.get_device(PB_ID)

def ar_to_cell (camera):
    r = requests.get("http://autoremotejoaomgcd.appspot.com/sendmessage?key=" + AR_KEY + "&message=motion=:=" + str(camera))
        
class Camera:
    list = {}
    def __init__(self, name):
        self.name = name
        self.file_v   = ''
        self.time_v   = 0
        self.keep     = 0
        self.notified = 0
        self.list[name] = self

def co_by_name(name):