/MyEnergi-App-Api

Investigation of the MyEnergi App

MyEnergi-App-Api

Investigation of the MyEnergi App

Myenergi have released a mobile app to view and control their Zappi and Eddi products. A public API was not released.

This repository will be used to document my investigation into the API the app is using, so that the data and calls may be used in my own Home Automation system.

With thanks to members of the myenergi.info forum:

  • sashton
  • fintan.farrell
  • MilesB

who have contributed updates, and to the folks at MyEnergi who haven't officialy sanctioned this investigation but havent asked us to stop either.

Tools Used

Charles Proxy is used as an SSL proxy between the app and the Myenergi server endpoint.

Findings

The app makes https requests to the myenergi.net host using Digest Authentication using the qop directive as "auth"

To build the base URL, get the last digit of the hub serial and make a base url like https://s<lastdigit>.myenergi.net/

New server migration if you are on the new server then your URL will be https://s18.myenergi.net/. Calling Director will always confirm your correct URL.

The New Approach is that an first call to https://director.myenergi.net will give a x_myenergi-asn header back with the server URL.

An initial request is made to /cgi-jstatus-E the server responds with a status 401 Unauthorized and requests authentication returning the realm: "MyEnergi Telemetry", qop: "auth", an initial nonce, a Stale flag, and algorithm: "MD5"

To authenticate, pass the Myenergi hub's serial number as the username, and the password setup in the app as the password.

A json response to the inital request to /cgi-jstatus-E can be obtained through a browser using the hub serial number and app password when requested for credentials.

A simple curl command will do the same:

curl --digest -u **HUB**:**PASSWORD** -H 'accept: application/json' -H 'content-type: application/json' --compressed 'https://s<lastdigit>.myenergi.net/cgi-jstatus-E'

Status Messages

/cgi-jstatus-*

Make an initial call to </cgi-jstatus-*> The response will return arrays of devices and the appropriate end point to issue all new calls against. Example response:

[ 
   { 
      "eddi":[ 
         { 
            "dat":"09-09-2019",
            "tim":"16:55:50",
            "ectp1":1,
            "ectp2":1,
            "ectt1":"Grid",
            "ectt2":"Generation",
            "frq":50.15,
            "gen":304,
            "grd":4429,
            "hno":1,
            "pha":3,
            "sno":10088888,
            "sta":1,
            "vol":0.0,
            "ht1":"Tank 1",
            "ht2":"Tank 2",
            "tp1":-1,
            "tp2":-1,
            "pri":2,
            "cmt":254,
            "r1a":1,
            "r2a":1,
            "r2b":1,
            "che":1
         }
      ]
   },
   { 
      "zappi":[ 
         { 
            "dat":"09-09-2019",
            "tim":"16:55:50",
            "div":3596,
            "ectp1":4369,
            "ectp2":295,
            "ectt1":"Grid",
            "ectt2":"Generation",
            "frq":50.01,
            "gen":304,
            "grd":4429,
            "pha":1,
            "sno":10077777,
            "sta":4,
            "vol":240.2,
            "pri":1,
            "cmt":254,
            "zmo":3,
            "tbh":9,
            "tbm":15,
            "tbk":2,
            "pst":"C2",
            "bsm":1,
            "mgl":100,
            "sbh":14,
            "sbk":5
         }
      ]
   },
   { 
      "harvi":[ 

      ]
   },
   { 
      "asn":"s7.myenergi.net"
   }
]
! All subsequent calls should be made to the asn value above

/cgi-jstatus-E

The server responds with a json object:

{
	"eddi": [{
                "bsm": 1,		// Boost Mode - 1 if boosting
		"che": 1		// total kWh tranferred this session (today?)
		"cmt": 254,		// Command Timer - counts 1 - 10 when command sent, then 254 - success, 253 - failure, 255 - never received any commands
		"dat": "07-06-2019",	//date
		"div": 928,		//Diversion amount Watts
		"dst": 1		//Daylight Savings Time enabled
		"ectp1": -7,		//physical CT connection 1 value
		"ectp2": 6,		//physical CT connection 2 value
		"ectt1": "Grid",	//CT 1 name
		"ectt2": "Generation",	//CT 2 name
		"frq": 50.07,		//Supply Frequency
		"fwv": 1234,		//firmware version
		"gen": 2054,		//Generated Watts
		"grd": 969,		//Current Watts from Grid (negative if sending to grid)
		"hno": 1,		// Currently active heater (1/2)
		"ht1": "Tank 1",	//Heater 1 name
		"ht2": "Tank 2",	//Heater 2 name
		"pha": 3,		//phase number or number of phases?
		"pri": 2,		//priority
		"r1a": 1,		// Have never seen this ? 
		"r2a": 1,		// Have never seen this  ?
		"r2b": 1,		// Have never seen this  ?
                "rbt": 3600,		// If boosting, the remaining boost time in of seconds
		"sno": 10088888,	//Changed Eddi Serial Number
		"sta": 3,		//Status 1=Paused, 3=Diverting, 4=Boost, 5=Max Temp Reached, 6=Stopped
		"tim": "07:28:45",	//time
		"tp": 50,		//temperature probe 1 (50 C)
		"tp2": -1,		//temperature probe 2
		"vol": 2395,		//Voltage out (divide by 10)
	}]
}

This gives us the basic data used on the app's main screen. The app also makes calls to

/cgi-jstatus-Z (For Zappi data)

{
	"zappi": [{
		"che": 1,			//Charge added in KWh
		"cmt": 253,		//Command Timer- counts 1 - 10 when command sent, then 254 - success, 253 - failure, 255 - never received any comamnds
		"dat": "07-06-2019",	//Date	
		"div": 1376,		//Diversion amount Watts (does not appear if zero)
		"dst": 1,			// Use Daylight Savings Time
		"ectp1": 920,		//Physical CT connection 1 value Watts
		"ectp2": 2143,		//Physical CT connection 2 value Watts
		"ectp3": 2143,		//Physical CT connection 3 value Watts
		"ectp4": 2143,		//Physical CT connection 4 value Watts
		"ectp5": 2143,		//Physical CT connection 5 value Watts
		"ectp6": 2143,		//Physical CT connection 6 value Watts
		"ectt1": "Grid",		//CT 1 Name	
		"ectt2": "Generation",	//CT 2 Name	
		"ectt3": " ",		//CT 3 Name
		"ectt4": " ",		//CT 4 Name
		"frq": 49.95,		//Supply Frequency
		"fwv": 1234		//Firmware Version
		"gen": 2143,		//Generated Watts
		"grd": 1017,		//Watts from grid?
		"lck": 10,		//Lock Status (4 bits : 1st digit - ? : 2nd digit - 1 unlocked, 0 locked)
		"mgl": 100,		//Minimum Green Level
		"pha": 1,			// Phases
		"pri": 1,			//priority
		"pst": "A",		//Status A=EV Disconnected, B1=EV Connected, B2=Waiting for EV, C1=EV Ready to Charge, C2= Charging, F= Fault
		"sbh": 14,		//Smart Boost Start Time Hour
		"sbk": 5			//Smart Boost KWh to add
		"sbm": 15,		//Smart Boost Start Time Minute
		"sno": 10077777,        	//Changed Zappi Serial Number		
		"sta": 3,			//Status  1=Paused 3=Diverting/Charging 5=Complete
		"tbh": 9,			//boost hour?
		"tbk": 90,		//boost KWh   - Note charge remaining for boost = tbk-che
		"tbm": 15,		//boost minute?
		"tim": "07:28:46",	//Time	
		"vol": 244.4,		//Supply voltage
		"zmo": 3,			//Zappi Mode - 1=Fast, 2=Eco, 3=Eco+, 4=Stopped
	}]
}

Lock Status

'lck' - representation of current PIN lock settings and zappi lock status Bit 0: Locked Now Bit 1: Lock when plugged in Bit 2: Lock when unplugged. Bit 3: Charge when locked. Bit 4: Charge Session Allowed (Even if locked)

Note that charging will be allowed if:- Locked Now=0 or Locked Now=1 and Charge When Locked=1 or Charge Session Allowed=1

  `/cgi-jstatus-H`  (For Harvi data) - I do have a harvi, but removed it from my installation and ran cat5 to the zappi.
  
```json
{
  "harvi": [
    {
      "sno": 10077777,
      "dat": "07-06-2019",
      "tim": "12:57:11",
      "ectp1": 176,
      "ectt1": "Grid",
      "ectt2": "None",
      "ectt3": "None",
      "ect1p": 1,
      "ect2p": 1,
      "ect3p": 1
    }
  ]
}

In addition to these status requests, the App also makes repeated calls to

/cgi-set-heater-priority-E10088888

Note - the last 8 digits of the request are my Eddi Serial Number - which can be found in the data returned from the call to cgi-jstatus-E

(I have included this in the Status section as it doesnt appear to set anything, but does return the hpri (Heater Priority?) and a cpm value)

This returns

{
	"hpri": 1,
	"cpm": 15
}

Tapping the Zappi or Eddi icon on the main screen causes the app to call new end points relating to the appliance:

Eddi

/cgi-jstatus-E10088888

{
	"eddi": [{
		"dat": "07-06-2019",
		"tim": "07:34:49",
		"ectp1": 3,
		"ectt1": "Grid",
		"ectt2": "Generation",
		"frq": 50.08,
		"gen": 2656,
		"grd": 131,
		"hno": 1,
		"pha": 3,
		"sno": 10088888,    //Serial Changed
		"sta": 1,
		"vol": 4.1,
		"ht1": "Tank 1",
		"ht2": "Tank 2",
		"tp1": -1,
		"tp2": -1,
		"pri": 2,
		"cmt": 254,
		"r1a": 1,
		"r2a": 1,
		"r2b": 1,
		"che": 1
	}]
}

**NOTE - the Eddi response above does not include a "div" property. This response was captured when the eddi was not diverting. It looks like properties that have the value zero are dropped from the object. Assuming that this is the same for Zappi too. **

Zappi

/cgi-jstatus-Z10077777

{
	"zappi": [{
		"dat": "07-06-2019",
		"tim": "07:30:29",
		"div": 2512,
		"ectp1": 5,
		"ectp2": 3190,
		"ectt1": "Grid",
		"ectt2": "Generation",
		"frq": 49.95,
		"gen": 3125,
		"grd": 18,
		"pha": 1,
		"sno": 10077777,           //Serial Changed
		"sta": 3,
		"vol": 241.6,
		"pri": 1,
		"cmt": 253,
		"tbh": 9,
		"tbm": 15,
		"tbk": 90,
		"pst": "A",
		"mgl": 100
	}]
}

Eddi Boost Time

/cgi-boost-time-E10088888

{
	"boost_times": [{
		"slt": 11,
		"bsh": 7,
		"bsm": 30,
		"bdh": 0,
		"bdm": 0,
		"bdd": "01111100"
	}, {
		"slt": 12,
		"bsh": 18,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "01111100"
	}, {
		"slt": 13,
		"bsh": 8,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000011"
	}, {
		"slt": 14,
		"bsh": 19,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000011"
	}, {
		"slt": 21,
		"bsh": 7,
		"bsm": 30,
		"bdh": 0,
		"bdm": 0,
		"bdd": "01111100"
	}, {
		"slt": 22,
		"bsh": 18,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "01111100"
	}, {
		"slt": 23,
		"bsh": 8,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000011"
	}, {
		"slt": 24,
		"bsh": 19,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000011"
	}]
}

Set boost times

cgi-boost-time-E10077777-<slot id>-<start time>-<duration>-<day spec>

  • start time and duration are both numbers like 60*hours+minutes
  • day spec is as bdd above

Zappi Boost Times

/cgi-boost-time-Z10077777

{
	"boost_times": [{
		"slt": 11,		//Slot
		"bsh": 14,		//boost start hour
		"bsm": 0,		//boost start minute
		"bdh": 0,		//boost duration hour
		"bdm": 15,		//boost duration minute
		"bdd": "01111111"	//boost days of week Monday through Sunday
	}, {
		"slt": 12,
		"bsh": 14,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000000"
	}, {
		"slt": 13,
		"bsh": 0,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000000"
	}, {
		"slt": 14,
		"bsh": 0,
		"bsm": 0,
		"bdh": 0,
		"bdm": 0,
		"bdd": "00000000"
	}]
}

Historic Data

Minute by Minute

Eddi

/cgi-jday-E10088888-2019-6-7

Response truncated

{
	"U10088888": [{
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 28249,
		"gen": 159,
		"v1": 2428,
		"frq": 4995,
		"nect1": 106,
		"nect2": 53
	}, {
		"min": 1,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 32160,
		"gen": 180,
		"v1": 2430,
		"frq": 4996,
		"nect1": 120,
		"nect2": 60
	}, {
		"min": 2,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 32040,
		"gen": 180,
		"v1": 2429,
		"frq": 4996,
		"nect1": 120,
		"nect2": 60
	}, {
		"min": 3,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 32280,
		"gen": 180,
		"v1": 2430,
		"frq": 4998,
		"nect1": 60,
		"nect2": 60
	}, 
  ...

The first object in the data array does not have a "min" property; - perhaps a bug as it looks like it is minute 0, not an overview of the whole day - this is repeated after minute 59. Also note that after hour 0, the data objects include an "hr" property, which is not included in the first 60 elements on the array. Data from later in the array as an example.

{
		"min": 14,
		"hr": 1,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 26640,
		"gen": 180,
		"v1": 2443,
		"frq": 4999,
		"nect1": 120,
		"nect2": 60
	}
Zappi

/cgi-jday-Z10077777-2019-6-8

response truncated

{
	"U10077777": [{
		"dow": "Sat",
		"dom": 8,
		"mon": 6,
		"yr": 2019,
		"imp": 42900,
		"exp": xxxxx,
		"gen": 180,
		"gep": xxxxx,
		"h1d": xxxxx,
		"h2d": xxxxx,
		"h3d": xxxxx,
		"v1": 2448,
		"frq": 5007,
		"nect1": 42900
	}, {
		"min": 1,		//Minute
		"dow": "Sat",		//Day of week
		"dom": 8,		//Day of month
		"mon": 6,		//Month
		"yr": 2019,		//Year
		"imp": 42900,		//Imported Joules this minute; divide by 60 get average Watts; divide by 3600000 to get kWh
		"exp": xxxxx,		//Exported Joules
		"gen": 180,		//???
		"gep": xxxxx,		//Generated Joules
		"h1d": xxxxx,		//Phase 1 used Joules for charging
		"h2d": xxxxx,		//Phase 2 used Joules for charging
		"h3d": xxxxx,		//Phase 3 used Joules for charging
		"v1": 2446,		//Voltage
		"frq": 5006,		//Frequency
		"nect1": 42900
	}, 
...

Hourly

Eddi

/cgi-jdayhour-E10088888-2019-6-7

{
	"U10088888": [{
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 1789189,
		"gen": 11139
	}, {
		"hr": 1,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 1912708,
		"gep": 458700,
		"gen": 11501
	}, {
		"hr": 2,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 1658167,
		"gen": 12053
	}, {
		"hr": 3,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 1839060,
		"gen": 12900
	}, {
		"hr": 4,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 1319580,
		"gep": 461160,
		"gen": 300
	}, {
		"hr": 5,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 66240,
		"exp": 145680,
		"gep": 3156420,
		"h1d": 870540
	}, {
		"hr": 6,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 201120,
		"exp": 157680,
		"gep": 5845080,
		"h1d": 2622300
	}, {
		"hr": 7,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 226800,
		"exp": 287640,
		"gep": 8880060,
		"h1d": 1075920,
		"h1b": 10860
	}, {
		"hr": 8,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 198660,
		"exp": 403800,
		"gep": 7010880,
		"h1d": 2020380
	}, {
		"hr": 9,
		"dow": "Fri",
		"dom": 7,
		"mon": 6,
		"yr": 2019,
		"imp": 162480,
		"exp": 9480,
		"gep": 627540,
		"h1d": 196860,
		"h1b": 7140
	}]
}

Note missing hr property for first object in array

Zappi

/cgi-jdayhour-Z10077777-2019-6-6

{
	"U10077777": []
}

No data.

Control

Zappi

To change the Zappi mode between Fast, Eco, Eco+ call these endpoints. Serial numbers are included in the URL - be sure to replace 10077777 with your Zappi Serial Number

Fast

/cgi-zappi-mode-Z10077777-1-0-0-0000

Eco

/cgi-zappi-mode-Z10077777-2-0-0-0000

Eco+

/cgi-zappi-mode-Z10077777-3-0-0-0000

Boost 5KWh

/cgi-zappi-mode-Z10077777-0-10-5-0000

where 0 is Boost - 10 is Boost Mode - 5 is the KWh to add

Smart Boost 5KWh - complete by 2pm

/cgi-zappi-mode-Z10077777-0-11-5-1400

where 0 is Boost - 11 is Smart Boost Mode - 5 is the KWh to add, 1400 is the time the boost should complete.

Stop Boost

/cgi-zappi-mode-Z10077777-0-2-0-0000

All requests return this

{
	"status": 0,
	"statustext": ""
}

Minimum Green Level 60%

/cgi-set-min-green-Z10077777-60 returns

{
	"mgl": 60
}

Minimum Green Level 100%

/cgi-set-min-green-Z10077777-100 returns

{
	"mgl": 100
}

Eddi Manual boost

Eddi can be set to boost - Example endpoints. Serial numbers are included in the URL - be sure to replace 10088888 with your Eddi Serial Number. The other options are:

  • 10 - Start Manual Boost
  • 1/2 - heater number (or 11/12 for Relay 1/2)
  • minutes (set to 0 to cancel)

20 minute manual boost

/cgi-eddi-boost-E10088888-10-1-20

60 minute manual boost

/cgi-eddi-boost-E10088888-10-1-60

Cancel boost

/cgi-eddi-boost-E10088888-1-1-0

Eddi to Stopped

/cgi-eddi-mode-E10088888-0

Eddi to Normal

/cgi-eddi-mode-E10088888-1

All requests return this

{
	"status": 0,
	"statustext": ""
}

Eddi heater priority

Each Eddi can have 2 heaters attached. To get which one is the current one that has priority call /cgi-set-heater-priority-E10088888

The priority can be set like /cgi-set-heater-priority-E10088888-2 to make the second heater have priority

Still to come...

  • Understanding of response properties
  • Zappi manual / smart / timed boosts - will need to wait for new firmware as App shows car not connected, and will not allow manipulation.