evcc: MQTT Topics are not updated after reconnection to Wireless network

Describe the bug

The mqtt topics for evcc are published completely. After some time it happens that not all topics are published anymore. Especially the evcc.status topic is shown as offline. Only after a service restart everything works as expected.

Screenshot 2023-06-06 at 21 16 33

The screenshot demonstrates that some topics are update while others are not and at the same time the status is set to offline.

The data received via modbus tcp is received at processed correctly within evcc and displayed in the web gui. Only the mqtt topic publish seems to stop working.

Steps to reproduce

Wait for a undefined time. It could be 1-2 weeks or some days. From the logs it seems that it happens when the raspberry pi rejoins the multicast group after a wireless disconnect.

Configuration details

network:
  # schema is the HTTP schema
  # setting to `https` does not enable https, it only changes the way URLs are generated
  schema: http
  # host is the hostname or IP address
  # if the host name contains a `.local` suffix, the name will be announced on MDNS
  # docker: MDNS announcements don't work. host must be set to the docker host's name.
  host: evcc
  # port is the listening port for UI and api
  # evcc will listen on all available interfaces
  port: 7070

interval: 10s # control cycle interval
site:
  - title: Zuhause # display name for UI
    meters:
      grid: my_grid # grid meter reference
      pv: # (pvs = veraltet)
        - my_pv # first pv meter reference
      battery: # (batteries = veraltet)
        - my_battery # battery meter reference
    residualPower: 100
    bufferSoc: 80
    prioritySoc: 66

mqtt:
  broker: 192.168.1.112:1883
  topic: evcc # root topic for publishing, set empty to disable publishing
  # clientid: foo
  user: homeassistant
  password: ********

# log settings
log: info
levels:
  site: debug
  lp-1: debug
  lp-2: debug
  cache: error
  db: error

meters:
  - name: my_grid
    type: template
    template: sungrow-hybrid
    usage: grid
    #Modbus TCP
    modbus: tcpip
    id: 1
    host: 192.168.121.120 # Hostname
    port: 502 # Port    
  - name: my_pv
    type: template
    template: sungrow-hybrid
    usage: pv
    #Modbus TCP
    modbus: tcpip
    id: 1
    host: 192.168.121.120 # Hostname
    port: 502 # Port
  - name: my_battery
    type: template
    template: sungrow-hybrid
    usage: battery
    #Modbus TCP
    modbus: tcpip
    id: 1
    host: 192.168.121.120 # Hostname
    port: 502 # Port 
loadpoints:
    - title: Garage
      charger: wallbox1
chargers:
    - name: wallbox1
      type: custom
      status: # charger status A..F
        source: js
        script: |
          var res="A";
          res;
      enabled: 
        source: js
        script: |
          var res=1;
          res;
      enable: # set charger enabled state (true/false or 0/1)
        source: js
        script: |
          console.log(enable);
      maxcurrent:
        source: js
        script: |
          console.log(maxcurrent);

Log details

The log file is to huge for being provided completely. In the syslog I could observe the following:

evcc wpa_supplicant[566]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jun  5 04:52:15 evcc systemd-networkd[653]: wlan0: Gained carrier
Jun  5 04:52:20 evcc systemd-networkd[653]: wlan0: DHCPv4 address 192.168.1.119/24 via 192.168.1.1
Jun  5 04:52:20 evcc avahi-daemon[666]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.1.119.
Jun  5 04:52:20 evcc avahi-daemon[666]: New relevant interface wlan0.IPv4 for mDNS.
Jun  5 04:52:20 evcc avahi-daemon[666]: Registering new address record for 192.168.1.119 on wlan0.IPv4.

followed by the error 

Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/site/homePower: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/chargeCurrent: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/site/greenShare: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/sessionCo2PerKWh: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/sessionEnergy: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/chargeDuration: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/sessionPricePerKWh: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/chargedEnergy: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/charging: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/site/tariffEffectivePrice: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/connected: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/loadpoints/1/enabled: timeout
Jun 5 04:52:23 evcc evcc[737]: [mqtt ] ERROR 2023/06/05 04:52:23 send: evcc/site/warn: timeout

After this error it seems it ends up in the state where only some mqtt topics are published.

What type of operating system are you running?

Linux

Version

evcc version 0.117.4

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Wir verwenden paho- eigentlich der Gold-Standard siw. Ich mache mal zu bis es ein neues Logfile gibt. Ziel müsste sein, das Verhalten für Tests/Analyse zu reproduzieren.