evcc-io / evcc

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

evcc shows doubled power values for PV, Batt, ... of MQTT values #12180

Closed MarkusMit closed 9 months ago

MarkusMit commented 9 months ago

[EDIT] The problem is already resolved. It was presumably caused by residue of playing around with the experimental "Device Configuration" UI. For details see below comment.

Describe the bug

This morning I noticed that evcc shows double the value for PV production than what is actually produced. Looking closer I discovered all power values, PV production, Battery power, consumption are all doubled. Not sure since when this is happening, I think last weekend it wasn't. Yesterday evening I updated evcc, NodeRed, HA OS and HA core. Tried downgrading evcc and NodeRed back again already, but with no effect.

evcc gets data from MQTT (via NodeRed). MQTT is reporting the correct values. evcc logs already the doubled values: grafik grafik

Steps to reproduce

Home Assistant, on Raspberry Pi 4

addons

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/10 11:07:41 evcc 0.124.1
[main  ] INFO 2024/02/10 11:07:41 using config file: /config/evcc.yaml
[main  ] INFO 2024/02/10 11:07:41 starting ui and api at :7070
[mqtt  ] INFO 2024/02/10 11:07:41 connecting evcc-583042014 at tcp://localhost:1883
[mqtt  ] DEBUG 2024/02/10 11:07:41 tcp://localhost:1883 connected
[main  ] ERROR 2024/02/10 11:07:46 creating vehicle IONIQ5 failed: cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: unexpected status: 400 (Bad Request): Invalid values (4003)
[site  ] INFO 2024/02/10 11:07:46 site config:
[site  ] INFO 2024/02/10 11:07:46   meters:      grid ✓ pv ✓ battery ✓
[site  ] INFO 2024/02/10 11:07:46     grid:      power ✓ energy ✓ currents ✓
[site  ] INFO 2024/02/10 11:07:46     pv 1:      power ✓ energy ✓ currents ✓
[site  ] INFO 2024/02/10 11:07:46     pv 2:      power ✓ energy ✓ currents ✓
[site  ] INFO 2024/02/10 11:07:46     battery 1: power ✓ energy ✗ currents ✗ soc ✓ capacity ✓
[site  ] INFO 2024/02/10 11:07:46     battery 2: power ✓ energy ✗ currents ✗ soc ✓ capacity ✓
[site  ] INFO 2024/02/10 11:07:46   vehicles:
[site  ] INFO 2024/02/10 11:07:46     vehicle 1: range ✗ finish ✗ status ✗ climate ✗ wakeup ✗
[site  ] WARN 2024/02/10 11:07:46 interval <30s can lead to unexpected behavior, see https://docs.evcc.io/docs/reference/configuration/interval
[site  ] DEBUG 2024/02/10 11:07:46 ----
[site  ] DEBUG 2024/02/10 11:07:46 pv power: 4122W
[site  ] DEBUG 2024/02/10 11:07:46 battery 1 power: -1740W
[site  ] DEBUG 2024/02/10 11:07:46 battery 1 soc: 77%
[site  ] DEBUG 2024/02/10 11:07:46 battery 2 power: -1740W
[site  ] DEBUG 2024/02/10 11:07:46 battery 2 soc: 77%
[site  ] DEBUG 2024/02/10 11:07:46 battery soc: 77%
[site  ] DEBUG 2024/02/10 11:07:46 battery power: -3480W
[site  ] DEBUG 2024/02/10 11:07:46 grid power: -10W
[site  ] DEBUG 2024/02/10 11:07:46 grid currents: [0.8 0.9 0.9]A
[site  ] DEBUG 2024/02/10 11:07:46 site power: -3390W
[site  ] DEBUG 2024/02/10 11:07:59 ----
[site  ] DEBUG 2024/02/10 11:08:00 pv power: 4110W
[site  ] DEBUG 2024/02/10 11:08:00 battery 1 power: -1700W
[site  ] DEBUG 2024/02/10 11:08:00 battery 1 soc: 77%
[site  ] DEBUG 2024/02/10 11:08:00 battery 2 power: -1700W
[site  ] DEBUG 2024/02/10 11:08:00 battery 2 soc: 77%
[site  ] DEBUG 2024/02/10 11:08:00 battery soc: 77%
[site  ] DEBUG 2024/02/10 11:08:00 battery power: -3400W
[site  ] DEBUG 2024/02/10 11:08:00 grid power: -16W
[site  ] DEBUG 2024/02/10 11:08:00 grid currents: [0.9 0.9 0.9]A
[site  ] DEBUG 2024/02/10 11:08:00 site power: -3316W

What type of operating system are you running?

HomeAssistant Add-on

Version

0.124.1

MarkusMit commented 9 months ago

addendum: Checking the MQTT broker further, I noticed, that evcc seems to double the pv plant and battery internally: grafik

MarkusMit commented 9 months ago

addendum II: I just remembered that last week - in connectiont with the new "GoodWe over WiFi" - I shortly played around with the "Device Configuration" UI, adding additional pv and battery ("GoodWe over WiFi"), but since I didn't receive any values there as well (see #12040), I removed them again, so I only have my evcc.yaml configured devices there: grafik

But could it be that there's some residue from that experiment somewhere in the system, that now doubles my pv and battery?

[EDIT] Got rid of that (assumed) residue! I restored an old backup of evcc addon, and then updated that one to the latest version again. Now the doubled PV and Batt are gone again:

Using config file: /config/evcc.yaml
starting evcc: 'EVCC_DATABASE_DSN=/data/evcc.db evcc --config /config/evcc.yaml'
[main  ] INFO 2024/02/10 11:59:30 evcc 0.124.1
[main  ] INFO 2024/02/10 11:59:30 using config file: /config/evcc.yaml
[main  ] INFO 2024/02/10 11:59:30 starting ui and api at :7070
[mqtt  ] INFO 2024/02/10 11:59:30 connecting evcc-1663023739 at tcp://localhost:1883
[mqtt  ] DEBUG 2024/02/10 11:59:30 tcp://localhost:1883 connected
[site  ] INFO 2024/02/10 11:59:32 site config:
[site  ] INFO 2024/02/10 11:59:32   meters:      grid ✓ pv ✓ battery ✓
[site  ] INFO 2024/02/10 11:59:32     grid:      power ✓ energy ✓ currents ✓
[site  ] INFO 2024/02/10 11:59:32     pv 1:      power ✓ energy ✓ currents ✓
[site  ] INFO 2024/02/10 11:59:32     battery 1: power ✓ energy ✗ currents ✗ soc ✓ capacity ✓
[site  ] INFO 2024/02/10 11:59:32   vehicles:
[site  ] INFO 2024/02/10 11:59:32     vehicle 1: range ✓ finish ✓ status ✓ climate ✗ wakeup ✓
[site  ] WARN 2024/02/10 11:59:32 interval <30s can lead to unexpected behavior, see https://docs.evcc.io/docs/reference/configuration/interval