evcc-io / evcc

Sonne tanken ☀️🚘
https://evcc.io
MIT License
3.18k stars 571 forks source link

Anzahl der gespeicherten Ladevorgänge geringer als über messaging gemeldete Ladevorgänge #14042

Closed hrpv closed 3 months ago

hrpv commented 3 months ago

Describe the bug

Die Anzahl der im csv gepeicherten Ladevorgänge ist geringer als die über das Messaging in Telegram gemeldeten Ladevorgänge. Ausserdem scheinen die Variablen chargedEnergy und chargeDuration manchmal zwischen den Ladevorgängen nicht zurückgesetzt zu werden sondern werden immer weiter inkrementiert. Die Anzahl der Ladevorgänge scheint im Messenger richtig zu sein, aber die chargedEnergy und chargeDuration stimmt nur nach Neustart von evcc wieder Es sieht so aus als ob das bei echten Autos und Wallboxen nicht passiert, fehlendes Disconnect als Trigger?

yaml msg: Finished "${title}" charging ${chargedEnergy:%.1fk}kWh in ${chargeDuration}.

Beispiel aus Telegram, viel zu hoher Wert für chargeDuration und chargedEnergy Wallbox-Ule, [23.05.2024 12:52] Started "Wärmepumpe" charging in "pv" mode

Wallbox-Ule, [23.05.2024 13:10] Finished "Wärmepumpe" charging 8.3kWh in 18h21m31s.

Steps to reproduce

Inhalt csv Ladevorgänge vergleichen mit Anzahl der Ladevorgänge über Messenger Telegram session-2024-05 (2).csv telegram.txt

Configuration details

#restrict to localhost (raspberry)
#uri: 0.0.0.0:7070 # uri for ui
#uri: 127.0.0.1:7070 # uri for ui
#uri: 192.168.168.48:7070 # uri for ui
network:
  schema: http
  host: 192.168.168.48
  port: 7070

interval: 10s # control cycle interval

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

# log settings
# set log: error fuer serie

# log: debug
# levels:
  # core: debug
  # lp-1: debug
  # lp-2: debug

log: error
levels:
  core: debug
  lp-1: info
  lp-2: info

#hems Im Moment nur SMA Home Manager
#deviceid und vendorid: fest gepinnt, damit aenderungen von /etc/machine-id keine wirkung haben
# https://github.com/evcc-io/evcc/discussions/2394
# es wird nur die niedrigste device id eingetragen, die ladepunkte werden fortlaufend nummeriert
hems:
  type: sma
  allowcontrol: false # set true to allow SHM controlling charger in PV modes
  vendorid: 28081973 # Hartkodierte konstante
  deviceid: xxx # abgleitet aus /etc/machine-id 

# meter definitions
# name can be freely chosen and is used as reference when assigning meters to site and loadpoints
# for examples see https://github.com/evcc-io/config#meters
meters:

- type: template
  template: sma-home-manager 
  usage: grid  
  host: 192.168.168.35  
  name: grid1
- type: template
  template: sma-inverter-speedwire 
  usage: pv  
  host: 192.168.168.36  
  password: xxx  
  name: pv2
- type: template
  template: sma-inverter-speedwire 
  usage: pv  
  host: 192.168.168.37  
  password: xxx  
  name: pv3
- type: template
  template: sma-sbs-modbus
  usage: battery  
  host: 192.168.168.45
  modbus: tcpip
  id: 3
  port: 502
  name: battery4

#ORNO modbus Zaehler, Abfrage ueber mbmd, publishung über mqtt 
#Vorteil: Zahelerdetails im  Webbrowswer sichbtbar für Debugging hilfreich
- name: chargemeter
  type: custom   # Typ des Zählers
  power:
    source: mqtt
    broker: 127.0.0.1:1883
    topic: mbmd/orno3p1-1/Power
    timeout: 60s # don't accept values older than timeout
  energy: 
    source: mqtt
    broker: 127.0.0.1:1883
    topic: mbmd/orno3p1-1/Import
    timeout: 60s # don't accept values older than timeout
#
# #ORNO modbus Zaehler, direkte Abfrage Ohne mbmd, 
# - name: chargemeter
  # type: modbus   # Typ des Zählers
  # model: ORNO3p
  # id: 1
  # device: /dev/ttyUSB0
  # baudrate: 9600
  # comset: "8E1" # "8E1" needs be quoted as string or will error
# #

#Wärmpepumpe meter, bedient von vzlogger -> mqtt ohne middleware
- name: wpmeter
  type: custom
  power:
    source: mqtt
    broker: 127.0.0.1:1883
    topic: vzlogger/data/chn1/agg
    jq: .value
    timeout: 60s # don't accept values older than timeout
  energy: 
    source: mqtt
    broker: 127.0.0.1:1883
    topic: vzlogger/data/chn0/agg
    jq: .value
    scale: 0.001
    timeout: 60s # don't accept values older than timeout

# charger definitions
# name can be freely chosen and is used as reference when assigning charger to vehicle
# for examples see https://github.com/evcc-io/config#chargers
chargers:
- name: warp        # Konfigurationsname der Wallbox
  type: template    # Typ der Wallbox
  template: tinkerforge-warp3
#  fw2: #true gibts wohl nicht mehr
  host: 127.0.0.1 # Hostname oder Adresse des MQTT-Brokers
  port: 1883
  topic: warp3/2aQv   # Der Topic-Präfix
#  usemeter: false    # true für WARP Charger Pro, false für Smart
  timeout: 30s

#wärmepumpe über fritzbox sgready H2 Zuschaltung Brauchwasser bei 2x230x6 = 2.7 kW (2 Phaseen)
- name: wpcharger
  type: fritzdect
  uri: https://192.168.168.1 # FRITZ!Box ip address (local)
  user: fritzxxxx # FRITZ!Box username (Has to have Smart Home privileges!)
  password: xxxxx # FRITZ!Box password
  ain: '116300164942' # switch actor identification number without blanks (see AIN number on switch sticker)
  standbypower: -1 # treat as charging above this power, 
                   # if negative ignore power, charging (State C) is defined by charge enabled only
#  standbypower: 0.2 # treat as charging above this power, float fritzbox ist sehr genau in mW

# vehicle definitions
# name can be freely chosen and is used as reference when assigning vehicle to loadpoint
# for examples see https://github.com/evcc-io/config#vehicles
vehicles:
- name: my_car
  type: template
  template: enyaq
  title: Skoda Enyaq RH
  user: xxx@justmail.de
  password: 'xxxx'
  vin: TMBxxxxx # Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind (optional)
  capacity: 58 # Akkukapazität in kWh (optional)
  timeout: 10s # optional 
- name: custom             # Konfigurationsname
  type: custom
  title: Mein Test Auto # display name for UI
  capacity: 50 # byttery capacity (kWh)
  onIdentify: # set defaults when vehicle is identified
#    minSoC: 20 # charge to at least 20% independent of charge mode
#    targetSoC: 90 # limit charge to 90%
  soc:  # battery soc (%)
     source: script # plugin type
     cmd: /bin/sh -c 'echo 50'
     timeout: 5s
#Vehicle ist MUSS sonst kommt immer target charging not possible bei Wärmepumpe
- name: wpauto             # Konfigurationsname
  type: custom
  title: WP # display name for UI
  capacity: 100 # byttery capacity (kWh)
  onIdentify: # set defaults when vehicle is identified
#    minSoC: 20 # charge to at least 20% independent of charge mode
#    targetSoC: 95 # limit charge to 90%
  soc:  # battery soc (%)
     source: script # plugin type
     cmd: /bin/sh -c 'echo 35'
     timeout: 5s
    # # ...
  # status: C # optional charge status (A..F)
    # source: # plugin type
    # # ...
  # range: 200 # optional electric range (km)
    # source: # plugin type
    # # ...
  # cache: 5m # optional cache duration

site:
  title: Home Ule
  meters:
    grid: grid1
    pv:
    - pv2
    - pv3
    battery:
    - battery4

# site describes the EVU connection, PV and home battery
# site:
  # title: Home # display name for UI
  # residualPower: 0 # kein extra  Hausverbrauchschätzung, alles erfasst   
  # meters:
    # grid: gridmeter # grid meter
    # # pvs: list of pv inverters/ meters
    # pv: pvmeter
# # byd house battery
    # battery: batterymeter # battery meter
# #  prioritySoC: 95 # give home battery priority up to this soc (empty to disable)
# #  bufferSoC: 95 # ignore home battery discharge above soc (empty to disable)
# #
# # loadpoint describes the charger, charge meter and connected vehicle

loadpoints:
- title: Garage # display name for UI
  charger: warp # charger
  phases: 3
  mode: pv  ## Standard-Lademodus. pv bedeutet, dass nur Photovoltaikstrom geladen wird.
#  resetOnDisconnect: true # set defaults when vehicle disconnects
  meter: chargemeter
#    charge: charge # charge meter
  vehicle: my_car
  # vehicles: # use if multiple vehicles allowed to charge on this loadpoint
  # - ID.3
  # - custom
  # - e-Up
  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
#    min: 0 # immediately charge to 0% regardless of mode unless "off" (disabled)
#    target: 100 # always charge to 100%
    estimate: true # was false set true to interpolate between api updates
  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: 10m # threshold must be exceeded for this long
    threshold: 200 # maximum import power (W)
  guardduration: 5m # switch charger contactor not more often than this (default 10m)
  mincurrent: 6 # minimum charge current (default 6A)
  maxcurrent: 16 # maximum charge current (default 16A)
# idee für wp ist von hier
# https://github.com/evcc-io/evcc/discussions/1231
- title: Wärmepumpe # display name for UI
##  charger: wpcustom # charger
  charger: wpcharger
  mode: pv
#  resetOnDisconnect: true # set defaults when vehicle disconnects
  meter: wpmeter
  vehicle: wpauto
  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
      mode: charging
      # poll interval defines how often the vehicle API may be polled if NOT charging
      interval: 10m
#    min: 0 # immediately charge to 0% regardless of mode unless "off" (disabled)
#    target: 100 # always charge to 100%
    estimate: false # set true to interpolate between api updates
  enable: # pv mode enable behavior
    delay: 10m # threshold must be exceeded for this long
    threshold: 0 # minimum export power (W). If zero, export must exceed minimum charge power to enable
  disable: # pv mode disable behavior
    delay: 3m # threshold must be exceeded for this long
    threshold: 300 # maximum import power (W)
  guardduration: 20m # switch charger contactor not more often than this (default 10m)
  mincurrent: 6 # minimum charge current (default 6A)
  maxcurrent: 7 # maximum charge current (default 16A)
  phases: 2 # ev phases (default 3)

# tariffs are the fixed or variable tariffs
# cheap can be used to define a tariff rate considered cheap enough for charging
tariffs:
  currency: EUR # (default EUR)
  grid:
    # static grid price
    type: fixed
    price: 0.30 # [currency]/kWh

  feedin:
    # rate for feeding excess (pv) energy to the grid
    type: fixed
    price: 0.0944 # [currency]/kWh

# 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: Charge started
      msg: Started "${title}" charging in "${mode}" mode
    stop: # charge stop event
      title: Charge finished
      msg: Finished "${title}" charging ${chargedEnergy:%.1fk}kWh in ${chargeDuration}.
    connect: # vehicle connect event
      title: Car connected
      msg: "Car connected at ${pvPower:%.1fk}kW PV"
    disconnect: # vehicle connected event
      title: Car disconnected
      msg: Car disconnected after ${connectedDuration}
  services: # zweimal den telegram bot connecten geht nicht!!!, anderes token, gleiche chatid geht
  - type: telegram
    token: 5004492384:AAGyHQynb_UxJ8fjAXfs8txxxxxxx
    chats: 
    - -xxxxxxx
  # - # list of chat ids
  # - 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>

Log details

no errors seen
[site  ] DEBUG 2024/05/23 21:22:04 ----
[lp-1  ] DEBUG 2024/05/23 21:22:04 charge power: 5W
[lp-2  ] DEBUG 2024/05/23 21:22:04 charge power: 1009W
[site  ] DEBUG 2024/05/23 21:22:04 pv power: 0W
[site  ] DEBUG 2024/05/23 21:22:04 battery soc: 72%
[site  ] DEBUG 2024/05/23 21:22:04 battery power: 694W
[site  ] DEBUG 2024/05/23 21:22:04 grid meter: -14W
[site  ] DEBUG 2024/05/23 21:22:04 grid powers: [300 232 -546]W
[site  ] DEBUG 2024/05/23 21:22:04 grid currents: [1.64 1.38 -2.41]A
[site  ] DEBUG 2024/05/23 21:22:04 site power: 680W
[lp-1  ] DEBUG 2024/05/23 21:22:04 charge total import: 737.120kWh
[lp-1  ] DEBUG 2024/05/23 21:22:04 charger status: A

What type of operating system are you running?

Linux

Version

evcc version 0.126.2 (940ce81a)

VolkerK62 commented 3 months ago

Im Ladelog werden Sessions gespeichert, keine einzelnen Ladevorgänge. Eine Session beginnt mit dem anstecken und endet mit dem abstecken. Bei schaltbaren Steckdosen endet die Session entweder durch einen Neustart oder durch schalten auf "aus".

hrpv commented 3 months ago

Ich teste mal die schaltbare Steckdose kurz vor Mitternaccht per cron job auszuschalten und so einen Eintrag im Ladelog zu erzeugen: mosquitto_pub -t evcc/loadpoints/2/mode/set -m "off"