Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oscillating setpoint in Export mode when BOTH solar production and grid powers are published via MQTT #901

Open
jamarju opened this issue Aug 31, 2024 · 6 comments

Comments

@jamarju
Copy link

jamarju commented Aug 31, 2024

Hello, first and foremost thanks for this GREAT project, both the hardware and the software are fantastic!

It seems that there is an issue in the divert control system, where the current setpoint keeps going up and down without settling. This happens when both solar power production AND grid import/export values are reported through MQTT.

I'm latest firmware (5.2.0). My current set-up is as follows (screenshots below):

  • Self production: enabled
  • Mode: Export
  • Feed: +Import/-Export power from Home Assistant

I was also experimenting with Production mode, which is set up this way:

  • Mode: Production
  • Feed: PV production feed from the inverters via Home Assistant

But note that my currently selected mode is: Export.

In this scenario, the setpoint oscillates. I have compiled the firmware in debug mode (target openevse_wifi_tft_v1_dev) with the -D ENABLE_DEBUG_DIVERT option enabled. See an example trace and walkthrough below:

{"amp":19360,"voltage":233.5,"power":4520.56}
voltage = 233.50
Igrid_ie = -12.87
amps = 19.36
Igrid_ie = -32.23
reserve = 1.28
_available_current = 30.94
_smoothed_available_current = 33.07
_charge_rate = 30
min_charge_time_remaining = 0
{"claims_version":1}
{"divert_update":0,"grid_ie":-3004,"divert_active":true,"charge_rate":30,"trigger_current":6,"voltage":233.5,"available_current":30.94029979,"smoothed_available_current":33.0734289,"pilot":21,"min_charge_end":0}
{"pilot":30}
{"amp":19360,"voltage":233.5,"power":4520.56}
{"evse_connected":1,"amp":19360,"voltage":233.5,"power":4520.56,"pilot":30,"max_current":33,"temp":355,"temp_max":355,"temp1":false,"temp2":355,"temp3":false,"temp4":false,"state":3,"status":"active","flags":1344,"vehicle":1,"colour":6,"manual_override":0,"freeram":113556,"divertmode":2,"srssi":-63,"time":"2024-08-31T11:32:40Z","local_time":"2024-08-31T13:32:40+0200","offset":"+0200","uptime":228263,"session_elapsed":2249,"session_energy":2766.183585,"total_energy":627.4020846,"total_day":2.766183585,"total_week":14.66208464,"total_month":14.66208464,"total_year":14.66208464,"total_switches":50,"elapsed":2249,"wattsec":9958260.906,"watthour":627402.0846}
{"amp":19360,"voltage":233.5,"power":4520.56}
{"session_elapsed":2251,"session_energy":2769.037816,"total_energy":627.4049388,"total_day":2.769037816,"total_week":14.66493888,"total_month":14.66493888,"total_year":14.66493888,"total_switches":50}
{"amp":21780,"voltage":233.5,"power":5085.63}
{"amp":21780,"voltage":233.5,"power":5085.63}
voltage = 233.50
Igrid_ie = -12.87
amps = 21.78
Igrid_ie = -34.65
reserve = 1.28
_available_current = 33.36
_smoothed_available_current = 33.09
_charge_rate = 33
min_charge_time_remaining = 0
{"claims_version":2}
{"divert_update":0,"grid_ie":-3004,"divert_active":true,"charge_rate":33,"trigger_current":6,"voltage":233.5,"available_current":33.36029979,"smoothed_available_current":33.09193007,"pilot":30,"min_charge_end":0}
{"pilot":33}
{"amp":25300,"voltage":233.5,"power":5907.55}
{"amp":25300,"voltage":233.5,"power":5907.55}
{"amp":28820,"voltage":233.5,"power":6729.47}
{"voltage":232}
voltage = 232.00
Igrid_ie = 7.02
amps = 28.82
Igrid_ie = -21.80
reserve = 1.29
_available_current = 20.51
_smoothed_available_current = 33.03
_charge_rate = 20
min_charge_time_remaining = 0
{"claims_version":3}
{"divert_update":0,"grid_ie":1628,"divert_active":true,"charge_rate":20,"trigger_current":6,"voltage":232,"available_current":20.50965517,"smoothed_available_current":33.02917571,"pilot":33,"min_charge_end":0}
_pause_timer = 0
{"pilot":20}
{"session_elapsed":2257,"session_energy":2778.093795,"total_energy":627.4139948,"total_day":2.778093795,"total_week":14.67399486,"total_month":14.67399486,"total_year":14.67399486,"total_switches":50}
{"amp":25960,"voltage":232,"power":6022.72}
{"amp":25960,"voltage":232,"power":6022.72}
{"amp":18260,"voltage":232,"power":4236.32}

Walking through the trace:

  1. The trace starts out while the car it's charging at 19.36A
  2. A new +I/-E report comes via MQTT: -12.87A
  3. Car amps are subtracted from grid amps (-12.87 - 19.36 = -32.23), 1.28 amps are reserved, 30.94 available, thus new setpoint is: 30. So far so good.
  4. A new PV production report comes via MQTT, doesn't matter its value as it's not used because we are in Export mode. However, and I believe here is where the bug lies, the setpoint calculation code is called again here.
  5. Car amps (21.78), which are on its way to ramping up to their current setpoint (30), are subtracted from the OLD grid amps, which hasn't updated yet (-12.87 - 21.78 = -34.65), 1.28 amps are reserved, 33.36 are available and new setpoint is 33.
  6. A new +I/-E report comes via MQTT: +7.02A as the previous setpoint overshot the actual available current.
  7. Car amps are subtracted from grid amps (7.02 - 28.82 = -21.8), 1.29 are reserved, 20.51 available thus the new setpoint is 20A.

This over-shooting / under-shooting the setpoint (30 -> 33 -> 20) keeps going on forever.

If I stop reporting PV production from Home Assistant, the issue resolves.

However, that would prevent me from using the Production mode.

I believe the solution should be to not call divert.update_state(); from MQTT callback if topic_string == mqtt_solar and we're in Export mode but I'm not aware of other implications.

I can raise a PR with a suggested solution for review.

Thanks again!

Export mode config screenshot

image

Production mode config screenshot

image
@jeremypoulter
Copy link
Collaborator

Hum... You shouldn't be able to setup to use both Grid IE and Solar at the same time. They should be mutually exclusive, so if that is happening then the bug is that we are allowing both to be selected. Can you describe how you set these up?

@jamarju
Copy link
Author

jamarju commented Aug 31, 2024

Hi Jeremy. I just set it up the way it looks in the screenshots.

Then, on the Home Assistant side, I have 3 automations that publish the following topics:

  • PV power: ha/sensor/inverters_input_power
  • Grid +I/-E: ha/sensor/power_meter_active_power_pos_import
  • Voltage: ha/sensor/power_meter_voltage

You are correct in that the two modes are mutually exclusive (ie. only one can be selected in the combobox), but the problem is that both mqtt_solar and mqtt_grid_ie remain set to their respective topics, thus on mqttmsg_callback divert.update_state() gets called twice.

This is strange as OpenEVSE should only be subscribed to either PV power or grid power topics, not both. I'll dig a bit deeper and come back, maybe it's the announcements that are actually wrong.

@jeremypoulter
Copy link
Collaborator

Does a reboot 'fix' the issue?

@jeremypoulter
Copy link
Collaborator

I think this is an issue with not unsubscribing from one topic when you change the config: https://github.com/OpenEVSE/openevse_esp32_firmware/blob/master/src/mqtt.cpp#L381-L390 so if you reboot it should work ok, even if both are configured

@jamarju
Copy link
Author

jamarju commented Sep 6, 2024

Sorry for the delay, the car was fully charged so I didn't have the chance to test this.

I have enabled MQTT debug prints via -D ENABLE_DEBUG_MQTT additionally to -D ENABLE_DEBUG_DIVERT.

I can confirm that the problem persists after restarting the WiFi module via UI:

image

As a reminder, the topics announced from HA are:

  • ha/sensor/inverters_input_power = PV prodution watts
  • ha/sensor/power_meter_voltage = grid volts
  • ha/sensor/power_meter_active_power_pos_import = grid +I/-E watts

Also note I have two inverters, this is not relevant to this problem but explains why there are twice the inverters_input_power as the topic is announced whenever any of the inverters get an update.

Relevant messages BEFORE REBOOT:

MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/power_meter_voltage
--
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--

AFTER REBOOT:

MQTT received:
Topic: ha/sensor/power_meter_voltage
--
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/power_meter_voltage
--
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/power_meter_voltage
--
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/inverters_input_power
--
MQTT received:
Topic: ha/sensor/power_meter_voltage
--
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Here is the full trace in case it helps.
BEFORE REBOOT:

MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 6988.0
solar:6988W
voltage = 232.80
Igrid_ie = -6.72
amps = 13.20
Igrid_ie = -19.92
reserve = 0.43
_available_current = 19.49
_smoothed_available_current = 31.04
_charge_rate = 19
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":125}
{"divert_update":0,"grid_ie":-1565,"divert_active":true,"charge_rate":19,"trigger_current":6,"voltage":232.8,"available_current":19.49295533,"smoothed_available_current":31.04484028,"pilot":15,"min_charge_end":0}
{"amp":13200,"voltage":232.8,"power":3072.96}
{"pilot":19}
Claims has changed, publishing to MQTT
{"amp":13200,"voltage":232.8,"power":3072.96}
{"session_elapsed":1910,"session_energy":2891.219549,"total_energy":639.0942515,"total_day":2.891219549,"total_week":2.891219549,"total_month":2.891219549,"total_year":26.35425158,"total_switches":76}
{"amp":15180,"voltage":232.8,"power":3533.904}
MQTT received:
Topic: ha/sensor/power_meter_voltage
Payload: 234.1
voltage:234.1
{"voltage":234.1000061}
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Payload: -551.0
grid:-551W
voltage = 234.10
Igrid_ie = -2.35
amps = 15.18
Igrid_ie = -17.53
reserve = 0.43
_available_current = 17.11
_smoothed_available_current = 30.98
_charge_rate = 17
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":126}
{"divert_update":0,"grid_ie":-551,"divert_active":true,"charge_rate":17,"trigger_current":6,"voltage":234.1000061,"available_current":17.10652707,"smoothed_available_current":30.97532265,"pilot":19,"min_charge_end":0}
_pause_timer = 0
{"amp":15180,"voltage":234.1,"power":3553.638}
{"pilot":17}
Claims has changed, publishing to MQTT
{"amp":16940,"voltage":234.1,"power":3965.654}
{"amp":16940,"voltage":234.1,"power":3965.654}
{"amp":15180,"voltage":234.1,"power":3553.638}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 6976.0
solar:6976W
voltage = 234.10
Igrid_ie = -2.35
amps = 15.18
Igrid_ie = -17.53
reserve = 0.43
_available_current = 17.11
_smoothed_available_current = 30.91
_charge_rate = 17
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"divert_update":0,"grid_ie":-551,"divert_active":true,"charge_rate":17,"trigger_current":6,"voltage":234.1,"available_current":17.10652713,"smoothed_available_current":30.90615174,"pilot":17,"min_charge_end":0}
{"session_elapsed":1916,"session_energy":2897.082295,"total_energy":639.1001143,"total_day":2.897082295,"total_week":2.897082295,"total_month":2.897082295,"total_year":26.36011433,"total_switches":76}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"session_elapsed":1921,"session_energy":2902.690134,"total_energy":639.1057221,"total_day":2.902690134,"total_week":2.902690134,"total_month":2.902690134,"total_year":26.36572216,"total_switches":76}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"session_elapsed":1927,"session_energy":2908.297972,"total_energy":639.11133,"total_day":2.908297972,"total_week":2.908297972,"total_month":2.908297972,"total_year":26.37133,"total_switches":76}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"evse_connected":1,"amp":15180,"voltage":234.1,"power":3553.638,"pilot":17,"max_current":33,"temp":355,"temp_max":355,"temp1":false,"temp2":355,"temp3":false,"temp4":false,"state":3,"status":"active","flags":1344,"vehicle":1,"colour":6,"manual_override":0,"freeram":124540,"divertmode":2,"srssi":-61,"time":"2024-09-06T12:12:52Z","local_time":"2024-09-06T14:12:52+0200","offset":"+0200","uptime":483005,"session_elapsed":1932,"session_energy":2912.78444,"total_energy":639.1158164,"total_day":2.91278444,"total_week":2.91278444,"total_month":2.91278444,"total_year":26.37581647,"total_switches":76,"elapsed":1932,"wattsec":1.048602398e7,"watthour":639115.8164}
{"session_elapsed":1933,"session_energy":2913.906797,"total_energy":639.1169388,"total_day":2.913906797,"total_week":2.913906797,"total_month":2.913906797,"total_year":26.37693883,"total_switches":76}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"session_elapsed":1938,"session_energy":2919.517597,"total_energy":639.1225496,"total_day":2.919517597,"total_week":2.919517597,"total_month":2.919517597,"total_year":26.38254963,"total_switches":76}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"session_elapsed":1944,"session_energy":2925.126422,"total_energy":639.1281584,"total_day":2.925126422,"total_week":2.925126422,"total_month":2.925126422,"total_year":26.38815845,"total_switches":76}
{"amp":15180,"voltage":234.1,"power":3553.638}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 6447.0
solar:6447W
voltage = 234.10
Igrid_ie = -2.35
amps = 15.18
Igrid_ie = -17.53
reserve = 0.43
_available_current = 17.11
_smoothed_available_current = 30.26
_charge_rate = 17
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"divert_update":0,"grid_ie":-551,"divert_active":true,"charge_rate":17,"trigger_current":6,"voltage":234.1,"available_current":17.10652713,"smoothed_available_current":30.25503203,"pilot":17,"min_charge_end":0}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15180,"voltage":234.1,"power":3553.638}
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Payload: -1419.0
grid:-1419W
voltage = 234.10
Igrid_ie = -6.06
amps = 15.18
Igrid_ie = -21.24
reserve = 0.43
_available_current = 20.81
_smoothed_available_current = 30.21
_charge_rate = 20
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":127}
{"divert_update":0,"grid_ie":-1419,"divert_active":true,"charge_rate":20,"trigger_current":6,"voltage":234.1,"available_current":20.8143443,"smoothed_available_current":30.20794641,"pilot":17,"min_charge_end":0}
_pause_timer = 0
Claims has changed, publishing to MQTT
{"pilot":20}
{"amp":15180,"voltage":234.1,"power":3553.638}
{"amp":15620,"voltage":234.1,"power":3656.642}
{"session_elapsed":1950,"session_energy":2930.768766,"total_energy":639.1338008,"total_day":2.930768766,"total_week":2.930768766,"total_month":2.930768766,"total_year":26.3938008,"total_switches":76}
{"amp":15620,"voltage":234.1,"power":3656.642}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 6453.0
solar:6453W
voltage = 234.10
Igrid_ie = -6.06
amps = 15.62
Igrid_ie = -21.68
reserve = 0.43
_available_current = 21.25
_smoothed_available_current = 30.16
_charge_rate = 21
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":128}
{"divert_update":0,"grid_ie":-1419,"divert_active":true,"charge_rate":21,"trigger_current":6,"voltage":234.1,"available_current":21.2543443,"smoothed_available_current":30.16329013,"pilot":20,"min_charge_end":0}
{"pilot":21}
Claims has changed, publishing to MQTT
{"amp":18040,"voltage":234.1,"power":4223.164}
{"amp":18040,"voltage":234.1,"power":4223.164}
{"amp":18920,"voltage":234.1,"power":4429.172}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"session_elapsed":1956,"session_energy":2937.401881,"total_energy":639.1404339,"total_day":2.937401881,"total_week":2.937401881,"total_month":2.937401881,"total_year":26.40043391,"total_switches":76}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"session_elapsed":1961,"session_energy":2944.473878,"total_energy":639.1475059,"total_day":2.944473878,"total_week":2.944473878,"total_month":2.944473878,"total_year":26.40750591,"total_switches":76}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"evse_connected":1,"amp":19140,"voltage":234.1,"power":4480.674,"pilot":21,"max_current":33,"temp":356,"temp_max":356,"temp1":false,"temp2":356,"temp3":false,"temp4":false,"state":3,"status":"active","flags":1344,"vehicle":1,"colour":6,"manual_override":0,"freeram":121136,"divertmode":2,"srssi":-61,"time":"2024-09-06T12:13:26Z","local_time":"2024-09-06T14:13:26+0200","offset":"+0200","uptime":483039,"session_elapsed":1966,"session_energy":2950.131973,"total_energy":639.153164,"total_day":2.950131973,"total_week":2.950131973,"total_month":2.950131973,"total_year":26.413164,"total_switches":76,"elapsed":1966,"wattsec":1.06204751e7,"watthour":639153.164}
{"session_elapsed":1967,"session_energy":2951.54712,"total_energy":639.1545791,"total_day":2.95154712,"total_week":2.95154712,"total_month":2.95154712,"total_year":26.41457915,"total_switches":76}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}
{"amp":19140,"voltage":234.1,"power":4480.674}


---

AFTER REBOOT

MQTT received:
Topic: ha/sensor/power_meter_voltage
Payload: 233.0
voltage:233.0
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Payload: 35.0
grid:35W
voltage = 233.10
Igrid_ie = 0.15
amps = 29.92
Igrid_ie = -29.77
reserve = 0.43
_available_current = 29.34
_smoothed_available_current = 0.00
_charge_rate = 29
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"divert_update":0,"grid_ie":35,"divert_active":false,"charge_rate":29,"trigger_current":6,"voltage":233.1,"available_current":29.34084942,"smoothed_available_current":0,"pilot":33,"min_charge_end":0}
_pause_timer = 0
{"voltage":233}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"session_elapsed":2138,"session_energy":3224.646472,"total_energy":639.4276784,"total_day":3.224646472,"total_week":3.224646472,"total_month":3.224646472,"total_year":26.68767851,"total_switches":78}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 8044.0
solar:8044W
voltage = 233.00
Igrid_ie = 0.15
amps = 29.92
Igrid_ie = -29.77
reserve = 0.43
_available_current = 29.34
_smoothed_available_current = 1.43
_charge_rate = 29
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"divert_update":0,"grid_ie":35,"divert_active":false,"charge_rate":29,"trigger_current":6,"voltage":233,"available_current":29.34060086,"smoothed_available_current":1.430957989,"pilot":33,"min_charge_end":0}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"session_elapsed":2144,"session_energy":3235.655412,"total_energy":639.4386874,"total_day":3.235655412,"total_week":3.235655412,"total_month":3.235655412,"total_year":26.69868744,"total_switches":78}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
{"session_elapsed":2149,"session_energy":3246.662415,"total_energy":639.4496944,"total_day":3.246662415,"total_week":3.246662415,"total_month":3.246662415,"total_year":26.70969445,"total_switches":78}
{"amp":29920,"voltage":233,"power":6971.36}
{"evse_connected":1,"amp":29920,"voltage":233,"power":6971.36,"pilot":33,"max_current":33,"temp":358,"temp_max":358,"temp1":false,"temp2":358,"temp3":false,"temp4":false,"state":3,"status":"disabled","flags":1344,"vehicle":1,"colour":6,"manual_override":0,"freeram":127360,"divertmode":2,"srssi":-60,"time":"2024-09-06T12:16:35Z","local_time":"2024-09-06T14:16:35+0200","offset":"+0200","uptime":34,"session_elapsed":2149,"session_energy":3246.662415,"total_energy":639.4496944,"total_day":3.246662415,"total_week":3.246662415,"total_month":3.246662415,"total_year":26.70969445,"total_switches":78,"elapsed":2149,"wattsec":1.168798469e7,"watthour":639449.6944}
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29920,"voltage":233,"power":6971.36}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 8031.0
solar:8031W
voltage = 233.00
Igrid_ie = 0.15
amps = 29.92
Igrid_ie = -29.77
reserve = 0.43
_available_current = 29.34
_smoothed_available_current = 7.24
_charge_rate = 29
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":1}
{"divert_update":0,"grid_ie":35,"divert_active":false,"charge_rate":29,"trigger_current":6,"voltage":233,"available_current":29.34060086,"smoothed_available_current":7.23924587,"pilot":33,"min_charge_end":0}
{"pilot":29}
Claims has changed, publishing to MQTT
{"amp":29920,"voltage":233,"power":6971.36}
{"amp":29260,"voltage":233,"power":6817.58}
{"session_elapsed":2155,"session_energy":3257.615082,"total_energy":639.460647,"total_day":3.257615082,"total_week":3.257615082,"total_month":3.257615082,"total_year":26.72064711,"total_switches":78}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
{"session_elapsed":2161,"session_energy":3267.489011,"total_energy":639.470521,"total_day":3.267489011,"total_week":3.267489011,"total_month":3.267489011,"total_year":26.73052104,"total_switches":78}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
{"amp":26840,"voltage":233,"power":6253.72}
MQTT received:
Topic: ha/sensor/power_meter_voltage
Payload: 233.3
voltage:233.3
{"voltage":233.3000031}
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Payload: 83.0
grid:83W
voltage = 233.30
Igrid_ie = 0.36
amps = 26.84
Igrid_ie = -26.48
reserve = 0.43
_available_current = 26.06
_smoothed_available_current = 10.65
_charge_rate = 26
min_charge_time_remaining = 0
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":2}
{"divert_update":0,"grid_ie":83,"divert_active":true,"charge_rate":26,"trigger_current":6,"voltage":233.3000031,"available_current":26.05560224,"smoothed_available_current":10.65007262,"pilot":29,"min_charge_end":0}
_pause_timer = 0
{"pilot":26}
Claims has changed, publishing to MQTT
{"amp":26840,"voltage":233.3,"power":6261.772}
{"session_elapsed":2166,"session_energy":3277.368031,"total_energy":639.4804,"total_day":3.277368031,"total_week":3.277368031,"total_month":3.277368031,"total_year":26.74040006,"total_switches":78}
{"amp":26840,"voltage":233.3,"power":6261.772}
{"amp":25080,"voltage":233.3,"power":5851.164}
{"amp":23980,"voltage":233.3,"power":5594.534}
{"amp":23980,"voltage":233.3,"power":5594.534}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 8035.0
solar:8035W
voltage = 233.30
Igrid_ie = 0.36
amps = 23.98
Igrid_ie = -23.62
reserve = 0.43
_available_current = 23.20
_smoothed_available_current = 11.65
_charge_rate = 23
min_charge_time_remaining = 546
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":3}
{"divert_update":0,"grid_ie":83,"divert_active":true,"charge_rate":23,"trigger_current":6,"voltage":233.3,"available_current":23.19560223,"smoothed_available_current":11.65315778,"pilot":26,"min_charge_end":546}
{"pilot":23}
Claims has changed, publishing to MQTT
{"amp":23980,"voltage":233.3,"power":5594.534}
{"session_elapsed":2172,"session_energy":3286.489787,"total_energy":639.4895218,"total_day":3.286489787,"total_week":3.286489787,"total_month":3.286489787,"total_year":26.74952182,"total_switches":78}
{"amp":23980,"voltage":233.3,"power":5594.534}
{"amp":22000,"voltage":233.3,"power":5132.6}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"session_elapsed":2178,"session_energy":3294.494975,"total_energy":639.4975269,"total_day":3.294494975,"total_week":3.294494975,"total_month":3.294494975,"total_year":26.75752701,"total_switches":78}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"session_elapsed":2183,"session_energy":3302.194944,"total_energy":639.5052269,"total_day":3.302194944,"total_week":3.302194944,"total_month":3.302194944,"total_year":26.76522698,"total_switches":78}
{"amp":20900,"voltage":233.3,"power":4875.97}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 8039.0
solar:8039W
voltage = 233.30
Igrid_ie = 0.36
amps = 20.90
Igrid_ie = -20.54
reserve = 0.43
_available_current = 20.12
_smoothed_available_current = 13.19
_charge_rate = 20
min_charge_time_remaining = 533
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":4}
{"divert_update":0,"grid_ie":83,"divert_active":true,"charge_rate":20,"trigger_current":6,"voltage":233.3,"available_current":20.11560223,"smoothed_available_current":13.18713871,"pilot":23,"min_charge_end":533}
{"evse_connected":1,"amp":20900,"voltage":233.3,"power":4875.97,"pilot":23,"max_current":33,"temp":359,"temp_max":359,"temp1":false,"temp2":359,"temp3":false,"temp4":false,"state":3,"status":"active","flags":1344,"vehicle":1,"colour":6,"manual_override":0,"freeram":123476,"divertmode":2,"srssi":-61,"time":"2024-09-06T12:17:09Z","local_time":"2024-09-06T14:17:09+0200","offset":"+0200","uptime":68,"session_elapsed":2183,"session_energy":3302.194944,"total_energy":639.5052269,"total_day":3.302194944,"total_week":3.302194944,"total_month":3.302194944,"total_year":26.76522698,"total_switches":78,"elapsed":2183,"wattsec":1.18879018e7,"watthour":639505.2269}
Claims has changed, publishing to MQTT
{"pilot":20}
{"amp":20900,"voltage":233.3,"power":4875.97}
{"amp":18920,"voltage":233.3,"power":4414.036}
{"amp":18920,"voltage":233.3,"power":4414.036}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"session_elapsed":2189,"session_energy":3309.38968,"total_energy":639.5124216,"total_day":3.30938968,"total_week":3.30938968,"total_month":3.30938968,"total_year":26.77242171,"total_switches":78}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"session_elapsed":2195,"session_energy":3316.033631,"total_energy":639.5190656,"total_day":3.316033631,"total_week":3.316033631,"total_month":3.316033631,"total_year":26.77906566,"total_switches":78}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"amp":18040,"voltage":233.3,"power":4208.732}
{"amp":18040,"voltage":233.3,"power":4208.732}
MQTT received:
Topic: ha/sensor/power_meter_voltage
Payload: 235.8
voltage:235.8
{"voltage":235.8000031}
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Payload: -2110.0
grid:-2110W
voltage = 235.80
Igrid_ie = -8.95
amps = 18.04
Igrid_ie = -26.99
reserve = 0.42
_available_current = 26.56
_smoothed_available_current = 15.97
_charge_rate = 26
min_charge_time_remaining = 519
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":5}
{"divert_update":0,"grid_ie":-2110,"divert_active":true,"charge_rate":26,"trigger_current":6,"voltage":235.8000031,"available_current":26.56417292,"smoothed_available_current":15.9710391,"pilot":20,"min_charge_end":519}
_pause_timer = 0
{"pilot":26}
Claims has changed, publishing to MQTT
{"amp":18040,"voltage":235.8,"power":4253.832}
{"amp":18480,"voltage":235.8,"power":4357.584}
{"session_elapsed":2200,"session_energy":3322.755421,"total_energy":639.5257874,"total_day":3.322755421,"total_week":3.322755421,"total_month":3.322755421,"total_year":26.78578745,"total_switches":78}
{"amp":18480,"voltage":235.8,"power":4357.584}
{"amp":21560,"voltage":235.8,"power":5083.848}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 8043.0
solar:8043W
voltage = 235.80
Igrid_ie = -8.95
amps = 21.56
Igrid_ie = -30.51
reserve = 0.42
_available_current = 30.08
_smoothed_available_current = 16.88
_charge_rate = 30
min_charge_time_remaining = 514
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":6}
{"divert_update":0,"grid_ie":-2110,"divert_active":true,"charge_rate":30,"trigger_current":6,"voltage":235.8,"available_current":30.08417303,"smoothed_available_current":16.88123766,"pilot":26,"min_charge_end":514}
{"amp":21560,"voltage":235.8,"power":5083.848}
{"pilot":30}
Claims has changed, publishing to MQTT
{"amp":23760,"voltage":235.8,"power":5602.608}
{"amp":25520,"voltage":235.8,"power":6017.616}
{"session_elapsed":2206,"session_energy":3331.008749,"total_energy":639.5340407,"total_day":3.331008749,"total_week":3.331008749,"total_month":3.331008749,"total_year":26.79404078,"total_switches":78}
{"amp":25520,"voltage":235.8,"power":6017.616}
{"amp":27720,"voltage":235.8,"power":6536.376}
{"amp":27720,"voltage":235.8,"power":6536.376}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"session_elapsed":2212,"session_energy":3341.192555,"total_energy":639.5442245,"total_day":3.341192555,"total_week":3.341192555,"total_month":3.341192555,"total_year":26.80422459,"total_switches":78}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"session_elapsed":2217,"session_energy":3351.591013,"total_energy":639.554623,"total_day":3.351591013,"total_week":3.351591013,"total_month":3.351591013,"total_year":26.81462305,"total_switches":78}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"evse_connected":1,"amp":27940,"voltage":235.8,"power":6588.252,"pilot":30,"max_current":33,"temp":360,"temp_max":360,"temp1":false,"temp2":360,"temp3":false,"temp4":false,"state":3,"status":"active","flags":1344,"vehicle":1,"colour":6,"manual_override":0,"freeram":125332,"divertmode":2,"srssi":-61,"time":"2024-09-06T12:17:43Z","local_time":"2024-09-06T14:17:43+0200","offset":"+0200","uptime":102,"session_elapsed":2217,"session_energy":3351.591013,"total_energy":639.554623,"total_day":3.351591013,"total_week":3.351591013,"total_month":3.351591013,"total_year":26.81462305,"total_switches":78,"elapsed":2217,"wattsec":1.206572765e7,"watthour":639554.623}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":27940,"voltage":235.8,"power":6588.252}
MQTT received:
Topic: ha/sensor/inverters_input_power
Payload: 8052.0
solar:8052W
voltage = 235.80
Igrid_ie = -8.95
amps = 27.94
Igrid_ie = -36.89
reserve = 0.42
_available_current = 36.46
_smoothed_available_current = 22.43
_charge_rate = 36
min_charge_time_remaining = 494
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":7}
{"divert_update":0,"grid_ie":-2110,"divert_active":true,"charge_rate":36,"trigger_current":6,"voltage":235.8,"available_current":36.46417303,"smoothed_available_current":22.43238668,"pilot":30,"min_charge_end":494}
{"pilot":33}
{"session_elapsed":2223,"session_energy":3361.989471,"total_energy":639.5650214,"total_day":3.361989471,"total_week":3.361989471,"total_month":3.361989471,"total_year":26.8250215,"total_switches":78}
Claims has changed, publishing to MQTT
{"amp":27940,"voltage":235.8,"power":6588.252}
{"amp":28600,"voltage":235.8,"power":6743.88}
{"amp":28600,"voltage":235.8,"power":6743.88}
{"amp":29920,"voltage":235.8,"power":7055.136}
{"amp":29920,"voltage":235.8,"power":7055.136}
{"session_elapsed":2229,"session_energy":3372.778973,"total_energy":639.5758109,"total_day":3.372778973,"total_week":3.372778973,"total_month":3.372778973,"total_year":26.83581101,"total_switches":78}
{"amp":29920,"voltage":235.8,"power":7055.136}
MQTT received:
Topic: ha/sensor/power_meter_voltage
Payload: 232.5
voltage:232.5
{"voltage":232.5}
MQTT received:
Topic: ha/sensor/power_meter_active_power_pos_import
Payload: 121.0
grid:121W
voltage = 232.50
Igrid_ie = 0.52
amps = 29.92
Igrid_ie = -29.40
reserve = 0.43
_available_current = 28.97
_smoothed_available_current = 23.05
_charge_rate = 28
min_charge_time_remaining = 488
_evse->getMinCurrent() = 6
trigger_current = 6.00
{"claims_version":8}
{"divert_update":0,"grid_ie":121,"divert_active":true,"charge_rate":28,"trigger_current":6,"voltage":232.5,"available_current":28.96946237,"smoothed_available_current":23.05447169,"pilot":33,"min_charge_end":488}
_pause_timer = 0
{"pilot":28}
Claims has changed, publishing to MQTT
{"amp":29040,"voltage":232.5,"power":6751.8}
{"amp":29040,"voltage":232.5,"power":6751.8}
{"amp":25960,"voltage":232.5,"power":6035.7}
{"amp":25960,"voltage":232.5,"power":6035.7}
{"session_elapsed":2235,"session_energy":3383.051541,"total_energy":639.5860835,"total_day":3.383051541,"total_week":3.383051541,"total_month":3.383051541,"total_year":26.84608357,"total_switches":78}
{"amp":25960,"voltage":232.5,"power":6035.7}
{"amp":25960,"voltage":232.5,"power":6035.7}

@lutorm
Copy link

lutorm commented Oct 15, 2024

I'm also occasionally seeing the shaper setpoint oscillate (without solar divert, just normal shaper). As was alluded to above, it seems to happen because the reported grid power comes in late, and the shaper code subtracts off the instantaneous charge current. If the charge current has ramped up but is not yet reflected in the power value, the shaper will calculate a too large available current. Once the charge current has ramped up to this value and it's reflected in the power, the shaper cuts back sharply. This causes the charge current to drop but until this is reflected in the power value, an abnormally low available current is calculated and this usually causes the charge to stop. Then the cycle repeats, leading to repeated current overshoots and relay chatter.

It's generally iffy to construct differences of quantities that aren't measured in the same timebase, like the internal charge current and the live power, since transients will lead to abnormal values. I'd suggest we put a filter on the shaper output _maxpwr to damp these transients. A simple IIR filter should suffice. Yes, putting a filter on it will slow down the ramp down when max power is exceeded, but a single short exceedance seems preferred over the repeated relay chatter that can happen now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants