evcc-io / evcc

Solar Charging ☀️🚘
https://evcc.io
MIT License
3.63k stars 676 forks source link

`goodwe-wifi` -> "Keine Messwerte" #12040

Closed MarkusMit closed 9 months ago

MarkusMit commented 9 months ago

Describe the bug

In my Home Assistant setup, I tried to change my evcc configuration from MQTT to the new GoodWe over WiFi (#11750) but unfortunately I only get "Keine Messwerte" on the evcc UI.

I tried both, configuration with and without uri, but the result is the same. Unfortunately, the documentation is not very ... explanatory ... in that regard of when to configure a uri and when not.

Also setting the log level to debug did not add anything helpful.

Steps to reproduce

GoodWe GW10K-ET Inverter, with Battery and WiFi Module.

Home Assistant, on Raspberry Pi 4

evcc addon 0.124.0

FritzBox WiFi

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: homeassistant.local
  # port is the listening port for UI and api
  # evcc will listen on all available interfaces
  port: 7070

interval: 13s # control cycle interval

# database configuration for persisting charge sessions and settings
# database:
#   type: sqlite
#   dsn: <path-to-db-file>

# sponsor token enables optional features (request at https://sponsor.evcc.io)
sponsortoken: *****
plant: *****

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

# telemetry enables aggregated statistics
#
# Telemetry allows collecting usage data (grid and green energy, charge power).
# Data is aggregated, no individual charging sessions are tracked. The collected,
# anonymous data can be retrieved using https://api.evcc.io.
#
# See https://github.com/evcc-io/evcc/pull/4343 or details.
#
# For time being, this is only available to sponsors, hence data is associated with
# the sponsor token's identity.
#
# telemetry: true

# modbus proxy for allowing external programs to reuse the evcc modbus connection
# each entry will start a proxy instance at the given port speaking Modbus TCP and
# relaying to the given modbus downstream device (either TCP or RTU, RS485 or TCP)
modbusproxy:
  #  - port: 5200
  #    uri: solar-edge:502
  #    # rtu: true
  #    # readonly: true

# meter definitions
# name can be freely chosen and is used as reference when assigning meters to site and loadpoints
# for documentation see https://docs.evcc.io/docs/devices/meters
meters:
  - name: goodwe_grid
    type: template
    template: goodwe-wifi # https://docs.evcc.io/docs/devices/meters/#goodwe-over-wifi
    usage: grid
    uri: http://*****.fritz.box # HTTP(S) Adresse (optional) 
  - name: pv
    type: template
    template: goodwe-wifi # https://docs.evcc.io/docs/devices/meters/#goodwe-over-wifi
    usage: pv
    uri: http://*****.fritz.box # HTTP(S) Adresse (optional) 
  - name: batteryPV
    type: template
    template: goodwe-wifi # https://docs.evcc.io/docs/devices/meters/#goodwe-over-wifi
    usage: battery
    uri: http://*****.fritz.box # HTTP(S) Adresse (optional) 

#meters:
#  - name: goodwe_grid
#    type: custom
#    power: # Leistung (W)
#      source: mqtt
#      topic: pv/netto
#      scale: -1
#      timeout: 15s # don't accept values older than timeout
#    energy: # optional energy (kWh)
#      source: mqtt # plugin type
#      topic: meter/import_day
#      scale: 1
#      timeout: 14h # don't accept values older than timeout
#    #soc: # optional battery soc (%)
#    #  source: mqtt
#    #  topic: bat/soc
#    currents: # optional currents (A)
#      - source: mqtt # L1 plugin type
#        topic: meter/current_l1
#        scale: 1
#        timeout: 30s # don't accept values older than timeout
#      - source: mqtt # L2 plugin type
#        topic: meter/current_l2
#        scale: 1
#        timeout: 30s # don't accept values older than timeout
#      - source: mqtt # L3 plugin type
#        topic: meter/current_l3
#        scale: 1
#        timeout: 30s # don't accept values older than timeout
#        # ...
#  - name: pv
#    type: custom
#    power: # Leistung (W)
#      source: mqtt
#      topic: pv/power
#      scale: 1
#      timeout: 15s # don't accept values older than timeout
#    energy: # optional energy (kWh)
#      source: mqtt # plugin type
#      topic: pv/gen_day
#      scale: 1
#      timeout: 30s # don't accept values older than timeout
#    currents: # optional currents (A)
#      - source: mqtt # L1 plugin type
#        topic: pv/current_1
#        scale: 1
#        timeout: 30s # don't accept values older than timeout
#      - source: mqtt # L2 plugin type
#        topic: pv/current_2
#        scale: 1
#        timeout: 30s # don't accept values older than timeout
#      - source: mqtt # L3 plugin type
#        topic: pv/current_3
#        scale: 1
#        timeout: 30s # don't accept values older than timeout
#  - name: batteryPV
#    type: custom
#    power: # Leistung (W)
#      source: mqtt
#      topic: bat/pwr
#      scale: 1
#      timeout: 15s # don't accept values older than timeout 
#    soc: # optional battery soc (%)
#      source: mqtt
#      topic: bat/soc
#      scale: 1
#      timeout: 15s # don't accept values older than timeout
#    capacity: 10.1
##    currents: # optional currents (A)
##      - source: mqtt # L1 plugin type
##        topic: bat/cur
##        scale: 1
##        timeout: 30s # don't accept values older than timeout
##      - source:  # L3 plugin type
##      - source:  # L2 plugin type

# charger definitions
# name can be freely chosen and is used as reference when assigning charger to vehicle
# for documentation see https://docs.evcc.io/docs/devices/chargers
chargers:
  - name: go-eCharger
    type: template
    template: go-e-v3
    host: *****.fritz.box # IP-Adresse oder Hostname
# vehicle definitions
# name can be freely chosen and is used as reference when assigning vehicle to loadpoint
# for documentation see https://docs.evcc.io/docs/devices/vehicles
vehicles:
  - name: myCar
    type: template
    template: hyundai
    title: MeinAuto # Wird in der Benutzeroberfläche angezeigt (optional)
    user: ***** # Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.)
    password: ***** # Passwort des Benutzerkontos (bei führenden Nullen bitte in einfache Hochkommata
    vin: ***** # Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind (optional)
    capacity: ***** # Akkukapazität in kWh (optional)
    language: de # 'de' für Deutsch und 'en' für Englisch (optional) 
#    onIdentify:
#      mode: "off"
site:
  title: Zuhause # display name for UI
  meters:
    grid: goodwe_grid # grid meter
    pv: pv
    #  - goodwe_pv # list of pv inverters/ meters
    battery: batteryPV
     # - goodwe_battery # list of battery meters
    #aux:
    #  - aux # list of auxiliary meters for adjusting grid operating point
  residualPower: 100 # additional household usage margin
  maxGridSupplyWhileBatteryCharging: 0 # ignore battery charging if AC consumption is above this value

# loadpoint describes the charger, charge meter and connected vehicle
loadpoints:
  - title: Garage # display name for UI
    charger: go-eCharger # charger
    #meter: charge # charge meter
    mode: "off" # set default charge mode, use "off" to disable by default if charger is publicly available
    # vehicle: car1 # set default vehicle (disables vehicle detection)
    ###resetOnDisconnect: true # set defaults when vehicle disconnects
    phases: 0 # electrical connection (normal charger: default 3 for 3 phase, 1p3p charger: 0 for "auto" or 1/3 for fixed phases)
    minCurrent: 6 # minimum charge current (default 6A)
    maxCurrent: 16 # maximum charge current (default 16A)

    # remaining settings are experts-only and best left at default values
    priority: 17 # relative priority for concurrent charging in PV mode with multiple loadpoints (higher values have higher priority)
    soc:
      # polling defines usage of the vehicle APIs
      # Modifying the default settings it NOT recommended. It MAY deplete your vehicle's battery
      # or lead to vehicle manufacturer banning you from API use. USE AT YOUR OWN RISK.
      poll:
        # poll mode defines under which condition the vehicle API is called:
        #   charging: update vehicle ONLY when charging (this is the recommended default)
        #   connected: update vehicle when connected (not only charging), interval defines how often
        #   always: always update vehicle regardless of connection state, interval defines how often (only supported for single vehicle)
        mode: charging
        # poll interval defines how often the vehicle API may be polled if NOT charging
        interval: 60m
      estimate: true # set false to disable interpolating between api updates (not recommended)
    enable: # pv mode enable behavior
      delay: 1m # threshold must be exceeded for this long
      threshold: 0 # grid power threshold (in Watts, negative=export). If zero, export must exceed minimum charge power to enable
    disable: # pv mode disable behavior
      delay: 1m # threshold must be exceeded for this long
      threshold: 0 # maximum import power (W)
    guardDuration: 5m # switch charger contactor not more often than this (default 5m)
# tariffs are the fixed or variable tariffs
tariffs:
  currency: EUR # three letter ISO-4217 currency code (default EUR)
  grid:
    # either static grid price (or price zones)
    type: fixed
    price: 0.13 # EUR/kWh
    # zones:
    #   - days: Mo-Fr
    #     hours: 0-8
    #     price: 0.294238 # EUR/kWh
    #   - days: Mo-Fr
    #     hours: 8-20
    #     price: 0.368324 # EUR/kWh
    #   - days: Mo-Fr
    #     hours: 20-0
    #     price: 0.294238 # EUR/kWh
    #   - days: Sa,So
    #     price: 0.294238 # EUR/kWh

    # or variable tariffs
    # type: tibber
    # token: "476c477d8a039529478ebd690d35ddd80e3308ffc49b59c65b142321aee963a4" # access token
    # homeid: "cc83e83e-8cbf-4595-9bf7-c3cf192f7d9c" # optional if multiple homes associated to account

    # type: awattar
    # region: de # optional, choose at for Austria
    # charges: # optional, additional charges per kWh
    # tax: # optional, additional tax (0.1 for 10%)

    # type: octopusenergy
    # tariff: AGILE-FLEX-22-11-25 # Tariff code
    # region: A # optional

    # type: elering # Nordpool
    # region: ee # or lt, lv, fi
    # charges: # optional, additional charges per kWh
    # tax: # optional, additional tax (0.1 for 10%)

    # type: energinet # Energinet using the price in DKK
    # region: dk1 # or dk2
    # charges: # optional, additional charges per kWh
    # tax: # optional, additional tax (0.1 for 10%)
  feedin:
    # rate for feeding excess (pv) energy to the grid
    type: fixed
    price: 0.14 # EUR/kWh

    # type: octopusenergy
    # tariff: AGILE-FLEX-22-11-25 # Tariff code
    # region: A # optional
  co2:
    # co2 tariff provides co2 intensity forecast and is for co2-optimized target charging if no variable grid tariff is specified
    # type: grünstromindex # GrünStromIndex (Germany only)
    # zip: <zip>

    #type: electricitymaps # https://app.electricitymaps.com/map
    # uri: <uri>
    # token: <token>
    #zone: AT

# mqtt message broker
mqtt:
   broker: localhost:1883
  # topic: evcc # root topic for publishing, set empty to disable
   user: *****
   password: *****

# influx database
influx:
  # url: http://localhost:8086
  # database: evcc
  # user:
  # password:

# eebus credentials
eebus:
  # uri: # :4712
  # interfaces: # limit eebus to specific network interfaces
  # - en0
  # certificate: # local signed certificate, required, can be generated via `evcc eebus-cert`
  #   public: # public key
  #   private: # private key

# push messages
messaging:
  events:
    start: # charge start event
      title: Laden gestartet
      msg: Laden im "${mode}" Modus gestartet
    stop: # charge stop event
      title: Laden beendet
      msg: Laden beendet. Ladung ${chargedEnergy:%.1fk}kWh in ${chargeDuration}.
    connect: # vehicle connect event
      title: Auto verbunden
      msg: "Auto verbunden mit ${pvPower:%.1fk}kW PV"
    disconnect: # vehicle connected event
      title: Auto getrennt
      msg: Auto getrennt nach ${connectedDuration}
    soc: # vehicle soc update event
      title: Batterieladung Soc aktualisiert
      msg: Batterie auf ${vehicleSoc:%.0f}% geladen
    guest: # vehicle could not be identified
      title: Unbekanntes Fahrzeug
      msg: Unbekanntes Fahrzeug, Gast verbunden?
  services:
  # - type: pushover
  #   app: # app id
  #   recipients:
  #   - # list of recipient ids
  # - type: telegram
  #   token: # bot id
  #   chats:
  #   - # list of chat ids
  # - type: email
  #   uri: smtp://<user>:<password>@<host>:<port>/?fromAddress=<from>&toAddresses=<to>
  # - type: ntfy
  #   uri: https://<host>/<topics>
  #   priority: <priority>
  #   tags: <tags>

Log details

Using config file: /config/evcc.yaml
starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'
[main  ] INFO 2024/02/03 17:50:15 evcc 0.124.0
[main  ] INFO 2024/02/03 17:50:15 using config file: /config/evcc.yaml
[main  ] INFO 2024/02/03 17:50:15 starting ui and api at :7070
[mqtt  ] INFO 2024/02/03 17:50:15 connecting evcc-1075262415 at tcp://localhost:1883
[mqtt  ] DEBUG 2024/02/03 17:50:16 tcp://localhost:1883 connected
[main  ] DEBUG 2024/02/03 17:50:37 vehicle status: B (IONIQ 5)

What type of operating system are you running?

HomeAssistant Add-on

Version

0.124.0

MarkusMit commented 9 months ago

Update regarding log: Found out that I have to set site: debug to get a little bit more info:

Using config file: /config/evcc.yaml
starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'
[main  ] INFO 2024/02/03 19:41:46 evcc 0.124.0
[main  ] INFO 2024/02/03 19:41:46 using config file: /config/evcc.yaml
[main  ] INFO 2024/02/03 19:41:46 starting ui and api at :7070
[mqtt  ] INFO 2024/02/03 19:41:47 connecting evcc-***** at tcp://localhost:1883
[mqtt  ] DEBUG 2024/02/03 19:41:47 tcp://localhost:1883 connected
[site  ] INFO 2024/02/03 19:41:49 site config:
[site  ] INFO 2024/02/03 19:41:49   meters:      grid ✓ pv ✓ battery ✓
[site  ] INFO 2024/02/03 19:41:49     grid:      power ✓ energy ✗ currents ✗
[site  ] INFO 2024/02/03 19:41:49     pv 1:      power ✓ energy ✗ currents ✗
[site  ] INFO 2024/02/03 19:41:49     battery 1: power ✓ energy ✗ currents ✗ soc ✓ capacity ✗
[site  ] INFO 2024/02/03 19:41:49   vehicles:
[site  ] INFO 2024/02/03 19:41:49     vehicle 1: range ✓ finish ✓ status ✓ climate ✗ wakeup ✓
[site  ] WARN 2024/02/03 19:41:49 interval <30s can lead to unexpected behavior, see https://docs.evcc.io/docs/reference/configuration/interval
[site  ] DEBUG 2024/02/03 19:41:49 ----
[site  ] DEBUG 2024/02/03 19:41:49 pv power: 0W
[site  ] DEBUG 2024/02/03 19:41:49 battery soc: 0%
[site  ] DEBUG 2024/02/03 19:41:49 battery power: 0W
[site  ] DEBUG 2024/02/03 19:41:49 grid power: 0W
[site  ] DEBUG 2024/02/03 19:41:49 site power: 100W
[main  ] DEBUG 2024/02/03 19:41:49 vehicle status: B (MeinAuto)
[site  ] DEBUG 2024/02/03 19:42:02 ----
[site  ] DEBUG 2024/02/03 19:42:02 pv power: 0W
[site  ] DEBUG 2024/02/03 19:42:02 battery soc: 0%
[site  ] DEBUG 2024/02/03 19:42:02 battery power: 0W
[site  ] DEBUG 2024/02/03 19:42:02 grid power: 0W
[site  ] DEBUG 2024/02/03 19:42:02 site power: 100W
[site  ] DEBUG 2024/02/03 19:42:15 ----
[site  ] DEBUG 2024/02/03 19:42:15 pv power: 0W
[site  ] DEBUG 2024/02/03 19:42:15 battery soc: 0%
[site  ] DEBUG 2024/02/03 19:42:15 battery power: 0W
[site  ] DEBUG 2024/02/03 19:42:15 grid power: 0W
...
andig commented 9 months ago

@MarkusMit Goodwe-Wifi requires UDP. I guess that doesn't work in your setup for some reason.

@motze92 the implementation needs to add timeout errors for the case that data is not received. All the readings above should error instead of returning zero.

andig commented 9 months ago

@motze92 should also fix the infinite recursion from

func (m *Server) readData() {
    for _, inverter := range m.inverters {
        addr, err := net.ResolveUDPAddr("udp", inverter.IP+":8899")
        if err != nil {
            return
        }

        if _, err := m.conn.WriteToUDP([]byte{0xF7, 0x03, 0x89, 0x1C, 0x00, 0x7D, 0x7A, 0xE7}, addr); err != nil {
            return
        }
        time.Sleep(5 * time.Second)
        if _, err := m.conn.WriteToUDP([]byte{0xF7, 0x03, 0x90, 0x88, 0x00, 0x0D, 0x3D, 0xB3}, addr); err != nil {
            return
        }
    }
    m.readData()
}
MarkusMit commented 9 months ago

@MarkusMit Goodwe-Wifi requires UDP. I guess that doesn't work in your setup for some reason.

@andig - As far as I understand it, Home Assistant's GoodWe integration also works via UDP (see e.g. goodwe/coordinator.py), and that works quite fine on my setup. Could there be another reason for goodwe-wifi not working?

motze92 commented 9 months ago

Do you use Home Assistant at the same time? The Inverter can't handle multiple clients paralell. Also while you are using the app, sometimes evcc doesn't get values.

MarkusMit commented 9 months ago

I have both in Home Assistant: The GoodWe integration, and I tried to use goodwe-wifi with the evcc addon in HA as well. So that will not work "by design"?

MarkusMit commented 8 months ago

I have both in Home Assistant: The GoodWe integration, and I tried to use goodwe-wifi with the evcc addon in HA as well. So that will not work "by design"?

Shouldn't this be documented?

andig commented 8 months ago

If anyone can confirm that this is the actual problem, happy to take a PR.

roboco6 commented 7 months ago

My first comment, so first of all: huge thanks to the people behind this project. Absolutely impressive work - thank you so much!

I tried all easter weekend to try to get this to work. Some things worked better than expected, but I have problems with the meter data vom the GoodWe inverter.

Setup:

GUI always shows incorrect data - except of the SoC of the battery, which is always accurate.

Screenshots taken at the same time:

Bildschirmfoto 2024-04-01 um 16 27 37 IMG_6757

Apr 01 13:50:09 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:09 ----
Apr 01 13:50:09 raspberrypi evcc[358]: [lp-1  ] DEBUG 2024/04/01 13:50:09 charge power: 0W
Apr 01 13:50:09 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:09 pv power: 3576W
Apr 01 13:50:09 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:09 battery soc: 84%
Apr 01 13:50:09 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:09 battery power: -7220W
Apr 01 13:50:09 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:09 grid meter: 39W
Apr 01 13:50:09 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:09 site power: -7181W
Apr 01 13:50:09 raspberrypi evcc[358]: [lp-1  ] DEBUG 2024/04/01 13:50:09 charge currents: [0 0 0]A
Apr 01 13:50:09 raspberrypi evcc[358]: [lp-1  ] DEBUG 2024/04/01 13:50:09 charger status: A
Apr 01 13:50:37 raspberrypi evcc[358]: [site  ] DEBUG 2024/04/01 13:50:37 ----
sennewald@raspberrypi:~ $ evcc meter
[main  ] INFO 2024/04/01 14:30:31 evcc 0.124.10
[main  ] INFO 2024/04/01 14:30:31 using config file: /etc/evcc.yaml
[db    ] INFO 2024/04/01 14:30:33 using sqlite database: /home/sennewald/.evcc/evcc.db
[main  ] FATAL 2024/04/01 14:30:33 cannot create meter 'grid1': cannot create meter type 'template': cannot create meter type 'goodwe-wifi': listen udp 0.0.0.0:8899: bind: address already in use
open evcc at http://evcc.local:7070
network:
  schema: http
  host: evcc.local # .local suffix announces the hostname on MDNS
  port: 7070

log: debug
levels:
  cache: error

unique installation id
plant: xxx

interval: 30s # control cycle interval

sponsortoken: xxx

# sponsors can set telemetry: true to enable anonymous data aggregation
# see https://github.com/evcc-io/evcc/discussions/4554
telemetry: false

meters:
- type: template
  template: goodwe-wifi 
  usage: grid  
  uri: 192.168.10.197  
  name: grid1
- type: template
  template: goodwe-wifi 
  usage: pv  
  uri: 192.168.10.197  
  name: pv2
- type: template
  template: goodwe-wifi 
  usage: battery  
  uri: 192.168.10.197  
  name: battery3

chargers:
- type: template
  template: abl 
  id: 1  
  host: 192.168.10.195  
  port: 502  
  modbus: rs485tcpip  
  name: wallbox5

vehicles:
- type: template
  template: vw 
  title: ID.4  
  user: xxx 
  password: xxx
  capacity: 52  
  timeout: 10s  
  name: ev4

loadpoints:
- title: Carport
  charger: wallbox5
  vehicle: ev4
  mode: pv

site:
  title: My home
  meters:
    grid: grid1
    pv:
    - pv2
    battery:
    - battery3

My guess: I configured something wrong due to lack of know how.

If someone finds some mistake in my setup - I am more than thankful!

Again - thanks ever so much to the people who made this possible.

Rasmus

andig commented 7 months ago

@roboco6 thanks for the feedback. Make sure evcc is the only client of the inverter. If not working please open new issue with trace log attached.

roboco6 commented 7 months ago

@andig thank you for your quick response. The only other client I could think of would be the "SEMS Portal" which is GoodWe's GUI App - not working as soon as evcc is started (because of only one modbus connection at a time - I have learned here).

I wouldn't know how to cut the connection / do you think that is needed?

The other connection is the administration app "SolarGo" which works over wifi or bluetooth only. Even if that is shut down, the data shown in EVCC is acting weird.