Efergy Ego Binding

I have searched and found no reference to Efergy so can only assume no one has developed a binding for this yet. Efergy Ego is a smart switch which can be turned on and off and monitors power usage. It uses WIFI 2.4G.

I’m even unsure if Efergy provide an API to allow this.

Does anyone have anymore information on this?

Nice to see another device that is available in New Zealand!

What I’d do is get a software tool that monitors network traffic. I’d then load up the phone app for Efergy and control the switch. You might be able to use the HTTP binding in OpenHAB to replicate those commands?

I’m still a novice so could be completely wrong but this is the approach I’d take if there isn’t a binding already…

At NZ$65 it’s about the same price as the Belkin WeMo stuff which does have a binding… Although the belkin stuff doesn’t report power usage…

Good luck!

Thanks for the response TommySharp.

I have infact captured some packets using wireshark. It seems to be using QUIC protocol.

See attached screenshot. I’m unfamilar with this protocol. Are there any similar bindings to use as a base?

I’ve just got an Efergy Engage and am looking at linking it with OpenHAB.

I’ve found this which could be a good place to start

http://www.energyhive.com/content/about/develop

Hi Jacob,
did you had a chance to find out how to bind the efergy with openhab?

I’m also using the Efergy Engage Hub since 3 years and very happy with it.

I was wondering how complex is it to create a binding for the efergy and openhab.

Regards,
Marc.

Hi Marc,

All I’ve managed to get is the current power usage with the API I posted about before. Here is an example:

In your items file (make sure you add your token)

Number Efergy_Power_Usage               "Current power usage [%.01f kWh]"       <energy>        (Power_Usage)           { http="<[http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=YOURTOKEN:60000:JS(efergy_current_power.js)]" }

Then create a file called configuration/transform/efergy_current_power.js with the contents

JSON.parse(input)[0].data[0][Object.keys(JSON.parse(input)[0].data[0])[0]]*0.001;

It would be nice to have an actual binding in openhab but my Java isn’t great and this workaround does the job for me.

Hope this helps
Jacob

Glad to find this discussion, I also have an energy for a year, do not have OpenHab yet, but are looking for excuses to load openHab, this could be one for me -will be tracking this tread. Thank you all for investigating!

I need to get the http to pull result every 8 seconds or so. How do i do that?

Could this reference be of any help ?

How can I parse with JSON the string:
[{“cid”:“PWER”,“data”:[{“1510396870000”:683}],“sid”:“789009”,“units”:“kWm”,“age”:2},{“cid”:“PWER_GAC”,“data”:[{“1510396866000”:1962}],“sid”:“770843”,“units”:null,“age”:6}]
to have the second value (1962)? Can you help me?
I tried with JSON.parse(input)[1].data[0][Object.keys(JSON.parse(input)[0].data[0])[0]]*0.001; but does’t work …

Here is what I did using an item

String ConsommationEfergy "Consommation actuelle [%s]"  <LogoEfergy>  { http="<[https://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=yourtokenhere:60000:JS(GetEfergyStringConsomm.js)]" }

based on this javascript transform:

myConsom2();
function myConsom2(){
	var json = JSON.parse(input);
	var ss = "0";
	var ss1 = "Efergy - Probleme de lecture";
	var dn;
	
	// ajouté Avril 2018 
	if (json.hasOwnProperty("error"))
		return "Error Reading JSON data";	
	
	try {	
		if (json.error && json !== null) {
			return "Error Reading JSON data";
		} else {
			for (var index in json) {
				var reading = 0;
				var ts = 0;
				for (var d in json[index].data[0]) {
					reading = json[index].data[0][d];
					// ts est le last reading time
					ts = d;
				}

				if (json[index].cid === 'PWER') {
					if (reading !== null) {
						dn = reading / 1000;
						if (isNaN(dn)) 
							ss = "0";
						else
							ss = dn.toFixed(3);
						
						var utcSeconds = ts / 1000; 
						var dddd = new Date(0); // The 0 there is the key, which sets the date to the epoch
						dddd.setUTCSeconds(utcSeconds);
						//console.log(dddd);
						ss1 = ss + " kW @ " +  dddd.toTimeString().split(' ')[0] + ' ----  ' + json[index].age + ' seconds ago'; 
						// console.log(ss1); // donne 3.238 kW @ 05:24:24   3 seconds ago
								
                         
						// $('#pwer_reading').text(reading/1000 + ' kW');
						// $('#sensor_id').text('SensorID:' + json[index].sid);
						// $('#pwer_age').text('last reading:' + json[index].age + ' seconds ago');
					}
				}
			}
		}
		return  ss1;
	} catch (e) {
        return "Error Reading JSON data";
    }	
}

Just change PWER for PWER_GAC to get your second device value

1 Like