The Zappi EV Charger is connected through a MyEnergi hub to the internet and measurements from the Zappi are available for viewing. The Zappi has current taps (CT) on all the main feeds of the system and appears to be the easiest place to get system wide values for Solar Gen, Grid, AC Battery (Powerwall2) and EV charge.
MyEnergi API
Based on information from GitHub, an initial HTTP call with “*” parameter gets an array of data for all MyEnergi devices including Eddi, Zappi and Harvi, with the 4th element including the ASN (server address) to be used for accessing the MyEnergi server. Authentication require’s the hub’s serial number [14302505] and the password used when setting up the app [in StrongBox].
https://s18.myenergi.net/cgi-jstatus-*
Follow on calls can use “Z” as the last parameter and returns Zappi data only. This differs from the GitHub info with some links extra, and others missing. This is probably App version related.
The significant ones for the moment are in red. Note that although “ectt1” defines “Internal Load”, there does not appear to be a corresponding “ectp1” value as for the other items. This has been calculated in the Node-RED function based on the other values.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
"zappi": [{
"sno": 18133770, // Zappi Serial Number
"dat": "09-04-2022", // Date
"tim": "15:48:12", // Time
"ectt1": "Int Load", // CT 1 Name
"ectt2": "Grid", // CT 2 Name
"ectt3": "Generation", // CT 3 Name
"ectt4": "AC Battery", // CT 4 Name
"ectt5": "None", // CT 4 Name
"ectt6": "None", // CT 4 Name
"ectp1": MISSING, // CT conn#1 Watts
"ectp2": -4521, // CT conn#2 Watts [EXPORT]
"ectp3": 777, // CT conn#3 Watts [SOLAR GEN]
"ectp4": 4877, // CT conn#4 Watts [DISCHARGE]
"ectp5": 2143, // CT conn#5 Watts
"ectp6": 2143, // CT conn#6 Watts
"bsm": 0, // ???
"bst": 0, // ???
"cmt": 254, // Command Timer: counts 1-10 when command sent, then 254=success, 253=failure, 255=never received any commands
"dst": 1, // Use Daylight Savings Time
"div": 0, // Diversion amount Watts
"frq": 49.94, // Supply Frequency Hz
"fwv": "3560S3.123", // Firmware Version
"gen": 784, // Generated Watts
"grd": -4596, // Watts to/from grid?
"pha": 1, // Phases
"pri": 1, // Priority
"sta": 3, // Status 1=Paused 3=Diverting/Charging 5=Complete
"tz": 0, // ???
"vol": 2440, // Supply voltage (*10?)
"che": 16.83, // Charge added in kWh
"bss": 0, // ???
"lck": 16, // Lock Status (4 bits : 1st digit - ? : 2nd digit - 1 unlocked, 0 locked)
"pst": "A", // Status A=EV Disconnected, B1=EV Connected, B2=Waiting for EV, C1=EV Ready to Charge, C2= Charging, F= Fault
"zmo": 1, // Zappi Mode - 1=Fast, 2=Eco, 3=Eco+, 4=Stopped
"pwm": 5300, // ???
"zs": 258, // ???
"rac": 8, // ???
"rrac": -4, // ???
"zsh": 1, // ???
"zsl": 2, // ???
"mgl": 50, // Minimum Green Level
"sbh": 17, // Smart Boost Start Time Hour
"sbk": 20, // Smart Boost kWh to add
}]
}
Node-RED Function
Every minute prompt an HTTP request, feed response into function to extract the wanted values, then post to MQTT. OpenHAB can then extract values for display.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Extract data from MyEnergi Zappi input
//
// Input: Javascript object from HTTP JSON response
// Outputs 1-4: power levels in Watts
// Output 5: Zappi mode
var modes = ["Fast", "Eco", "Eco+", "Stopped"];
const obj = msg.payload.zappi[0];
const grid = obj.ectp2;
const gen = obj.ectp3;
const batt = obj.ectp4;
// Mode starts at 1, adjust for zero based array
const mode = obj.zmo - 1;
var load = grid + gen + batt;
msg.payload = '{"load":' + load + ', "grid":' + grid + ', "gen":' + gen + ', "batt":' + batt + ', "zmode":"' + modes[mode] + '"}';
return msg;
HabPanel Widget : TODO
The HabPanel uses code in a Template widget to display the state of the associated light and to change the light state when pressed. It uses a pair of SVG icons that I found online, and made some amendments to suit my function and colour scheme.
References / Resources
- An analysis of the MyEnergi App data calls (GitHub)