OpenEVSE / openevse_esp32_firmware

OpenEVSE V4 WiFi gateway using ESP32
155 stars 107 forks source link

[BUG] Solar Divert is closing and opening the contactor even is the car is not connected #774

Open mathieucarbou opened 7 months ago

mathieucarbou commented 7 months ago
OpenEVSE    8.2.3.EU    
OpenEVSE Wifi v5.0.2

My EV car is disconnected since 8:30 this morning.

Starting at ~ 10:15 to 11:20, we can see that I have enough solar production excess so the divert mode is allowing the charge, then is stopped allowing the charge, and again later.

The problem is that the EVSE is closing the contactor for nothing, because the EV car is not connected. This increases the wear of the contactor considerably. In a few month, because of this behaviour, I've reached 1114 swicthes. Just today, I got 8 more switches, while the car was disconnected.

I am using default parameters for divert:

image

I am closely monitoring the EVSE box from Home Assistant. Here is proof of what is happening. I can add more sensors if required.

image

Question

What is the contactor closing and opening when the vehicule is disconnected ?

Thanks!

Note 1: I've checked today and we actually ear the sound of the contactor switching.

Note 2: today I was running with a smooth decay of 300 sec instead of 600 sec. Switched back to 600 sec juste now before the screenshot.

mathieucarbou commented 7 months ago

I have added an automation in HA to automatically switch solar divert on/off (and also set a claim) depending on the VE state


  - alias: "OpenEVSE: Switch Soalr Divert"
    max_exceeded: silent
    trigger:
      - platform: state
        entity_id: binary_sensor.openevse_vehicle_connected
    condition: []
    action:
      - if:
          - condition: state
            entity_id: binary_sensor.openevse_vehicle_connected
            state: "on"
        then:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.openevse_solar_divert
          - service: select.select_option
            data:
              option: Auto
            target:
              entity_id: select.openevse_charge_control
          - wait_template: "{{states.select.openevse_charge_control.state == 'Auto'}}"
            continue_on_timeout: true
          - service: select.select_option
            data:
              option: Allow Charge
            target:
              entity_id: select.openevse_charge_status
          - wait_template: "{{states.select.openevse_charge_status.state == 'Allow Charge'}}"
            continue_on_timeout: true
        else:
          - service: select.select_option
            data:
              option: Pause Charge
            target:
              entity_id: select.openevse_charge_status
          - wait_template: "{{states.select.openevse_charge_status.state == 'Pause Charge'}}"
            continue_on_timeout: true
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.openevse_solar_divert

VE connected:

image

VE disconnected:

image

Ref: OpenEVSE MQTT integration

jeremypoulter commented 7 months ago

Just because the change is active doesn't mean the contactor is closed. It definitely won't be. The OpenEVSE only closes the contactor when in the charging state (3), which can only happen when the vehicle is connected, so if you graph it the EVSE states you will see it won't switch to state 3 without the vehicle connection even when active

jeremypoulter commented 7 months ago

That being said there may be a bug in the total relay switches code that is miss-representing when the relay is switched. I don't recall where that number is coming from

mathieucarbou commented 7 months ago

Just because the change is active doesn't mean the contactor is closed. It definitely won't be. The OpenEVSE only closes the contactor when in the charging state (3), which can only happen when the vehicle is connected, so if you graph it the EVSE states you will see it won't switch to state 3 without the vehicle connection even when active

So why did I ear today several times the contactor closing and opening back again depending on the solar divert states ?

mathieucarbou commented 7 months ago

I will try to find a way to reproduce and take a video. This is the evening.

I often ear the contactor inside the box opening at the end of the day even if the car is not connected and when divert is active and I have less excess. It's not new, it has always been like that since a few months from memory.

mathieucarbou commented 7 months ago

That being said there may be a bug in the total relay switches code that is miss-representing when the relay is switched. I don't recall where that number is coming from

if we look at the graph, the switch count increase match the state change of the divert: when divert is allowing the charge (probably evse state is not sleeping anymore) then counter might be incremented perhaps, regardless whether a car is connected or not.