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.

Introducing the new Eyedro EYEFI-3 WiFi connected electricity monitor for 3-phase! Dismiss