note; I have all my scripts setup so that the lwt (last will and testament) publishes 'offline' if the scripts die.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from ouimeaux.environment import Environment | |
def on_switch(switch): #discover light switches and register listeners | |
print('******** Switch found:'+ switch.name+ ', Current state : '+str(switch.get_state())) | |
x = switch.name.replace(" ", "") #remove spaces | |
x = env.get_switch(switch.name) | |
x.register_listener(on_change) | |
def on_change(value): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<title>Test subcriber</title> | |
<head> | |
<script src="vendor/mqttws31.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
//mqtt broker setup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = $_SERVER['DOCUMENT_ROOT']; | |
$path .= "/dbconnection/temperature_dbinfo.php"; | |
require($path); | |
$interval = $_GET['interval']; | |
$location = $_GET['location']; | |
$con = mysql_connect($mysqlserver,$username,$password); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Upwey Temperatures</title> | |
</head> | |
<script type="text/javascript" src="/javascript/jquery_1.8.2/jquery.min.js"></script> | |
<script src="http://code.highcharts.com/stock/highstock.js"></script> | |
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#add this first part to the top of the functions file | |
#for reversegeo | |
import time | |
#import logging | |
from urllib import urlencode | |
from urllib2 import urlopen | |
#this filter will reverse geo the address for you | |
def OwnTracksConvertWithAdd(data): |
How Far 2 Home
This function was designed as a proof of concept and will return the estimated driving distance the device (using owntracks here) is from the GPS coordinates specified in the functions file
For example;
2014-03-24 15:45:00,484 INFO [log] matthew iphone is 38mins away from home
Requiements
reqires;
Just a simple example for mqtt/websockets/html/js subscription and publishing of topics/messages in chrome console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Historical Temperature Data</title> | |
</head> | |
<style type="text/css"> | |
#bubbles { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from urllib import urlencode | |
from httplib import HTTPSConnection, HTTPException | |
from ssl import SSLError | |
pushalot_authorizationtoken = 'xxxxxxxxxxxxxxx' | |
pushalot_title = 'title' | |
pushalot_body = 'body' |