Exemple #1
0
 def pushOver(self, message):
     try:
         po = Pushover(Coop.PUSHOVER_TOKEN)
         po.user(Coop.PUSHOVER_USER)
         msg = po.msg(message)
         msg.set("title", "Pips´s kleine Hühnerfarm")
         # po.send(msg)
     except Exception as e:
         logger.error(e)
Exemple #2
0
	def __sendToPushover(text):
		try:
			po = Pushover(PUSHOVER_TOKEN)
			po.user(PUSHOVER_USER)
			msg = po.msg(text)
			msg.set("title", PUSHOVER_TITLE)
			po.send(msg)
			log.debug('Sent message to Pushover.')
		except:
			log.error('Pushover exception!')
Exemple #3
0
	
	# iterate over configured devices in config file
	for section in config.sections():
		if (section[:7] == 'Device_'):
			newDevice = Device(config[section]['MacAddress'], section[7:], int(config[section]['Threshold']), config[section].getboolean('Twitter'), config[section].getboolean('Pushover'))
			log.info('Device configured: {0}'.format(newDevice.name))
			
	
	# send start up message to Pushover and Twitter
	timePrefix = '{0}: '.format(datetime.now().strftime("%d.%m.%Y %H:%M"))
	message = 'WiScanner started with configured devices: {0}'.format(Device.joinDeviceNames(Device.allDevices))

	try:
		po = Pushover(PUSHOVER_TOKEN)
		po.user(PUSHOVER_USER)
		msg = po.msg(timePrefix + message)
		msg.set("title", PUSHOVER_TITLE)
		po.send(msg)
		log.debug('Sent message to Pushover.')
	except:
		log.error('Pushover exception!')
		
	try:
		twitter = Twython(TWITTER_APP_KEY, TWITTER_APP_SECRET, TWITTER_OAUTH_TOKEN, TWITTER_OAUTH_TOKEN_SECRET)
		twitter.update_status(status=message)
		log.debug('Sent message to Twitter.')
	except:
		log.error('Twitter exception!')
		
	
	while True:
    fb = urlopen(url)
    power = str(fb.read())
    #cut off 'b' at start and '\n' on end of power
    power = power[2:-3]
    return power


po = Pushover(PUSHOVER_APP_KEY)
po.user(PUSHOVER_USER_KEY)
sid = get_sid()

while True:
    power = get_power()

    if is_running == False and int(power) > POWER_THRESHOLD:
        msg = po.msg(MESSAGE_TEXT_WASH_CYCLE_STARTED)
        msg.set("title", MESSAGE_TITLE_WASH_CYCLE_STARTED)
        po.send(msg)
        is_running = True

    if is_running == True and int(power) < POWER_THRESHOLD:
        counter += 1

    if is_running == True and int(power) > POWER_THRESHOLD:
        counter = 0

    if counter == POLL_TIMES:
        msg = po.msg(MESSAGE_TEXT_WASH_CYCLE_ENDED)
        msg.set("title", MESSAGE_TITLE_WASH_CYCLE_ENDED)
        po.send(msg)
        is_running = False
Exemple #5
0
from pushover import Pushover
import requests, json

po_api_token = "aFERV6CYg8UQYjgGm1bMAfU9TurQYf"
po_user_kay = "uYCpaffsy7YGQDTiqPFd88Cu1sRdh9"
wug_api_key = "4a079b9b1c39e4fc"

# Do a weather lookup
wx_url = 'http://api.wunderground.com/api/4a079b9b1c39e4fc/geolookup/conditions/q/MI/Ann_Arbor.json'
raw = requests.get(wx_url)
info = json.loads(raw.text)
location = info['location']['city']
temp_f = info['current_observation']['temp_f']

message = "Temp: %s" % (temp_f)
title = "Wx update for %s" % (location)

po = Pushover(po_api_token)
po.user(po_user_kay)

msg = po.msg(message)
msg.set("title", title)

po.send(msg)