EYEFI /getdata command (Sample Code)

The Eyedro EYEFI-x models include a built in web server that you may query with the /getdata command to retrieve the instantaneous measurement values.

While the EYEFI module is not provisioned for the internet (the out of the box configuration), you may only use the /getdata command locally by first connecting direct to the module WIFI network. Eg. EyedroWifi [00B-12345] will appear in your WIFI options list. While connected directly to the EYEFI module accessing the /dashboard, and /settings pages, and the /getdata command are the same format.

http://192.168.1.1/dashboard
http://192.168.1.1/settings
http://192.168.1.1/getdata

After the EYEFI module is provisioned for the internet (SSID, Security, Password are configured per Quick Start Guide), then it will connect to your local network and will be assigned a new IP address from your local network. For this blog post I am using IP address 192.168.0.134 but your IP address will most likely be different, and can be found by logging into your router to see a list of connected devices and their respective IP address.

While the EYEFI module is provisioned for the internet it will communicate with the MyEyedro cloud service 24/7. The module will open a second network port at port 8080 that can be queried in parallel. The format of the /getdata command is shown below. Please note that you’ll replace the IP address (192.168.0.34) with your own.

http://192.168.0.34:8080/getdata

The output of the command is in JSON format. The example response below is from querying an EYEFI-2 (2 sensor model).

{
  "data": [ [988, 11665, 11800, 1360, 0], [989, 11665, 4854, 560, 0] ]
}

The ‘data’ array includes 2 elements, one for each sensor (A first, B second, etc). Each sub-array includes 5 values that are:

1st: Power factor in milli-units meaning ‘988’ = 0.988
2nd: Voltage in cV meaning ‘11665’ = 116.65V
3rd: Amperage in mA meaning ‘11800’ = 11.8A
4th: Wattage in W meaning ‘988’ = 988W
5th: Ignore. Used by factory only.

When viewing the /dashboard page you’ll see that it updates itself every few seconds. It is running a small piece of javascript code that calls the /getdata command as part of the update. The below html and javascript code example can be used as a starting point to create your own software. Save the file to your PC with an .html file extension, edit to replace the IP address with your own, then open the html file in a browser. The javascript should run in the background and update your simple html table with data values.

<!DOCTYPE html&gt;
<html&gt;
<head&gt;
<title&gt;Eyedro Sample Code: EYEFI-x /getdata command</title&gt;
<style&gt;table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
</style&gt;
</head&gt;
<body&gt;
<header&gt;<h2&gt;EYEFI-x /getdata command</h2&gt;</header&gt;
<table&gt;
<thead&gt;
<tr&gt;<th&gt;</th&gt;<th&gt;Power<br&gt;Factor</th&gt;<th&gt;Voltage<br&gt;(V)</th&gt;<th&gt;Current<br&gt;(A)</th&gt;<th&gt;Power<br&gt;(W)</th&gt;</tr&gt;
</thead&gt;
<tbody&gt;
<tr&gt;<td&gt;Sensor A</td&gt;<td id='0f'&gt;</td&gt;<td id='0v'&gt;</td&gt;<td id='0i'&gt;</td&gt;<td id='0p'&gt;</td&gt;</tr&gt;
<tr&gt;<td&gt;Sensor B</td&gt;<td id='1f'&gt;</td&gt;<td id='1v'&gt;</td&gt;<td id='1i'&gt;</td&gt;<td id='1p'&gt;</td&gt;</tr&gt;
</tbody&gt;
</table&gt;
<script&gt;
window.onload=function(){
	var data=[[1,2,3,4,5],[1,2,3,4,5]];
	update=function(data){
		var WattageSum=0;
		for (var j=0;j<2;j++){
			var PowerFactor=data[j][0]/1000;
			document.getElementById(j+'f').innerHTML=PowerFactor.toFixed(3);
			var Voltage=data[j][1]/100;
			document.getElementById(j+'v').innerHTML=Voltage.toFixed(3);
			var Amperage=data[j][2]/1000;
			document.getElementById(j+'i').innerHTML=Amperage.toFixed(3);
			var Wattage=data[j][3];
			document.getElementById(j+'p').innerHTML=Wattage.toFixed(0);
			WattageSum += Wattage;
		}
		var timer=setTimeout(function(){
			var xhttp=new XMLHttpRequest();
			if (xhttp==null){
				timer=setTimeout(function(){ location.reload(true); }, 3000);
				return;
			}
			xhttp.onreadystatechange=function(){
				if (this.readyState==4){
					if (this.status==200){
						var json=JSON.parse(this.responseText);
						update(json.data);
					}
					else{
						alert('Error ('+this.status+') requesting data from server.');
					}
				}
			};
			xhttp.open('POST', 'http://192.168.0.134:8080/getdata', true);
			xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			xhttp.send();
		}, 2000);
		window.onunload=function(){
			if (timer!=null){
				clearTimeout(timer);
			}
		}
	};
	update(data);
};
</script&gt;
<br&gt;
<footer&gt;Copyright © 2009-2019 Eyedro Green Solutions Inc.</footer&gt;
</body&gt;</html&gt;

Please contact us at Eyedro Support (support@eyedro.com) if you have questions, comments, etc.

Eyedro Keeps Eye on Hydro Usage – The Waterloo Region Record

Eyedro Keeps Eye on Hydro Usage – The Waterloo Region Record

KITCHENER — Auston Gough figures he saved about $50 a month on electricity bills this past winter after he installed devices that measure his hydro usage by the second and relay the information to his tablet.

Gough lives in a two-bedroom apartment above King Street in downtown Kitchener and was spending about $400 for electricity every two months this past winter. His place is heated with electric baseboards and has a dishwasher.

Gough spent $129 for a kit from Eyedro Green Solutions Inc., a new company in the Communitech Hub. He clamped sensors on the main line feeding the electrical panel, and then hooked up a small box that sends detailed information on electricity consumption to his tablet.

Gough used to keep one baseboard heater cranked up high and the other three almost turned off. He quickly learned that doing that was hugely inefficient. He changed the settings so that all the heaters run intermittently.

Gough learned that the four light bulbs in the bathroom used as much hydro as his dishwasher. So he switched to high-efficiency bulbs. He only runs his dishwasher when electricity rates are lower.

“I just made some fairly minor changes and I was using less power, which is great,” Gough said.

The downtown bartender is an early adopter of the technology developed by Eyedro. The company already has customers — residential, institutional and industrial — in 10 countries.

Read the full article Eyedro Keeps Eye on Hydro Usage, by Terry Pender at http://www.therecord.com/news-story/4526526-eyedro-keeps-eye-on-hydro-usage/

 

Visit Eyedro at Schaedler yesco Expo 2014

Visit Eyedro at Schaedler yesco Expo 2014

Visit us at the Schaedler yesco Expo 2014 on March 24-25 in Hershey, Pennsylvania – Booth 531. We’ll be hosting the “Real-Time Electricity Monitoring” seminar on March 24, 1pm. If you’re unable to attend but still interested in the seminar then please contact us to schedule a 1 on 1 webinar at a time that fits your schedule (info@eyedro.com).

 

Schaedler yesco Expo 2014.

Schaedler yesco Expo 2014.

Schaedler yesco Expo 2014 schedule.

Schaedler yesco Expo 2014 schedule.

Eyedro's New WiFi Electricity Monitor Now Available - Introductory Pricing in Effect! Dismiss