some News about the project
AEON HEM2 calibrated, I saw there was a difference between readed value and the value from the plugwise system, now they are more in sync
the strange part is the HEM2 was giving much higher values than plugwise, even with load it was always 22% higher

so now the system logs $hem2 = ($hem2 * 0.78)
GeoFenceas I'm using the bTrace app for some time now it only displayed my location on the site and home panel, but how cool would it be to make some use of it

so I start coding a new php plugin, this plugin creates a geofence around our home, as soon as I enter the fence the system perform actions
for example if I come back from work, and I'm less than 3km away from my home it will send an NMA to my wife that I'm on the way home..
that way she can prepare me a drink

nice homecoming hehe (**glad she does not read this lol **)
but also stuff like turn on the heating when no-body is home etc. lots of possibilities..
also nice is combining the gps coordinates with google api to generate address based on coordinates
some sample code for geofence in php
- Code: Select all
function distance($lat1, $lon1, $lat2, $lon2) {
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
$km = $miles * 1.609344;
return $km;
}
and function for latitude / longitude to address conversion based on google api
- Code: Select all
function geo2address($lat,$long) {
$url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$long&sensor=false";
$adrData=file_get_contents( $url);
$address = json_decode($adrData);
$a=$address->results[0];
$adr = explode(",",$a->formatted_address);
return $adr[0] . $adr[1];
}