EV Charging and load balancing with P1 electricity meter
Posted: Sunday 05 July 2020 13:28
Hello,
I wanted to ask something.
I have an EVSE-WiFi charging station for my new MG ZS EV.
What I want to do is:
I want to aks the EVSE-WiFi to give me al the information about its satus. http://192.168.x.x/getParameters
This JSON response looks like the screenshot. {"type":"parameters","list":[{"vehicleState":1,"evseState":false,"maxCurrent":15,"actualCurrent":10,"actualPower":0,"duration":0,"alwaysActive":false,"lastActionUser":"GUI","lastActionUID":"GUI","energy":0,"mileage":0,"meterReading":0,"currentP1":0,"currentP2":0,"currentP3":0}]}
Meaning of the values:
vehicleState Vehicle state (ready 1/ detected 2/ charging 3)
evseState EVSE State (active/not active)
maxCurrent Maximum Current depending on PP-limit and
actualCurrent Actual configured current in A (e.g. 20A)
actualPower actual power consumption (when S0 meter is used)
duration charging duration in milliseconds
alwaysActive Always Active Mode enabled (true/false)
lastActionUser The user name of the user who performed the last action (activate/deactivate)
lastActionUID The UID of the user who performed the last action (activate/deactivate)
energy charged energy of the current charging process in kWh
mileage charged energy in km
meterReading actual meter reading in kWh
currentP1 actual current in A (phase 1)
currentP2 actual current in A (phase 2)
currentP3 actual current in A (phase 3)
I would be nice the create an virtual switch that changes according the state of the EV charging station.
The next goal is the get load balancing to work so that the total current drain from my household does not exceeds my connection to the grid.
The power measurement I do for my household is with the P1 smart Meter USB.
My idea is to calculate the actual current using the data from the P1 smart Meter USB.
Name.Type.Subtype - Name.Type.Subtype / Voltage
Usage L1.Usage.Electric - Delivery L1.Usage.Electric / 230 = Actual Current
With that actual current I can calculate the maximum current for my car charger.
The EVSE-WiFi has the option to work with an JSON request to set the max Current for that moment.
http://192.168.x.x/setCurrent?current=10 (in this example it will set the max to 10Amp)
I have tested this in an browser and this works.
The hole idea would be:
1. Check the EVSE-WiFi state every minute
2. When status changes to Charging, change virtual Switch
3. Update other virtual devices (electricity meter, Amp meter etc.)
4. Compare the actual total household current to an max. value of "x"
5. When that limit is reached lower the charging value with 1.
6. If there is room left raise the charging current with 1.
7. Keep the comparing on going until charging state is done.
8. After charging is done set max. value to X (so it never starts at is theoretical max.)
I'm an noob in writing an script, especially from scrap.
When I have some peaces of an script I can understand than and make small changes.
Would some like the help me to get this script working.
I wanted to ask something.
I have an EVSE-WiFi charging station for my new MG ZS EV.
What I want to do is:
I want to aks the EVSE-WiFi to give me al the information about its satus. http://192.168.x.x/getParameters
This JSON response looks like the screenshot. {"type":"parameters","list":[{"vehicleState":1,"evseState":false,"maxCurrent":15,"actualCurrent":10,"actualPower":0,"duration":0,"alwaysActive":false,"lastActionUser":"GUI","lastActionUID":"GUI","energy":0,"mileage":0,"meterReading":0,"currentP1":0,"currentP2":0,"currentP3":0}]}
Meaning of the values:
vehicleState Vehicle state (ready 1/ detected 2/ charging 3)
evseState EVSE State (active/not active)
maxCurrent Maximum Current depending on PP-limit and
actualCurrent Actual configured current in A (e.g. 20A)
actualPower actual power consumption (when S0 meter is used)
duration charging duration in milliseconds
alwaysActive Always Active Mode enabled (true/false)
lastActionUser The user name of the user who performed the last action (activate/deactivate)
lastActionUID The UID of the user who performed the last action (activate/deactivate)
energy charged energy of the current charging process in kWh
mileage charged energy in km
meterReading actual meter reading in kWh
currentP1 actual current in A (phase 1)
currentP2 actual current in A (phase 2)
currentP3 actual current in A (phase 3)
I would be nice the create an virtual switch that changes according the state of the EV charging station.
The next goal is the get load balancing to work so that the total current drain from my household does not exceeds my connection to the grid.
The power measurement I do for my household is with the P1 smart Meter USB.
My idea is to calculate the actual current using the data from the P1 smart Meter USB.
Name.Type.Subtype - Name.Type.Subtype / Voltage
Usage L1.Usage.Electric - Delivery L1.Usage.Electric / 230 = Actual Current
With that actual current I can calculate the maximum current for my car charger.
The EVSE-WiFi has the option to work with an JSON request to set the max Current for that moment.
http://192.168.x.x/setCurrent?current=10 (in this example it will set the max to 10Amp)
I have tested this in an browser and this works.
The hole idea would be:
1. Check the EVSE-WiFi state every minute
2. When status changes to Charging, change virtual Switch
3. Update other virtual devices (electricity meter, Amp meter etc.)
4. Compare the actual total household current to an max. value of "x"
5. When that limit is reached lower the charging value with 1.
6. If there is room left raise the charging current with 1.
7. Keep the comparing on going until charging state is done.
8. After charging is done set max. value to X (so it never starts at is theoretical max.)
I'm an noob in writing an script, especially from scrap.
When I have some peaces of an script I can understand than and make small changes.
Would some like the help me to get this script working.