evcc-io / evcc

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

Fail to boot after upgrade from 0.127.2 to 0.127.3 - invalid keys: vin #14556

Closed jivesinger closed 5 months ago

jivesinger commented 5 months ago

Describe the bug

Running HAOS addon 0.127.2 with no issues Upgrade to HAOS addon 0.127.3

Container fails to start with error:

FATAL 2024/06/25 15:52:23 cannot create vehicle 'ev3': cannot create vehicle type 'template': cannot create vehicle type 'custom': decoding failed due to the following error(s): '' has invalid keys: vin

From documentation at https://docs.evcc.io/en/docs/devices/vehicles#mg2mqtt

vehicles:
  - name: my_car
    type: template
    template: mg2mqtt
    title: # Will be displayed in the user interface (optional)
    user: # User account (e.g. email address, user id, etc.)
    vin: W... # Required if you own multiple vehicles of the same brand
    capacity: 50 # Battery capacity in kWh (optional)
    timeout: 1h # optional 

Key 'vin' looks to be optional as I don't own multiple vehicles of the same brand. Commenting out key 'vin' allows evcc to start, but after plugging in the vehicle evcc does not recoginize that the car is connected. Car status remains 'Disconnected'

Log evcc addon 0.127.3 after removing key 'vin'. Car was plugged in immeditatley after charge mode was changed to minpv

[ocpp ] TRACE 2024/06/25 16:17:12 sent JSON message to 1: [3,"ngf8k3hyrjwvixlc6o3deu9w",{"currentTime":"2024-06-25T06:17:12Z"}]
[lp-1 ] DEBUG 2024/06/25 16:17:36 set charge mode: minpv
[ocpp ] TRACE 2024/06/25 16:18:12 received JSON message from 1: [2,"rq67os8fh060gb6pdgm6ql44","Heartbeat",{}]
[ocpp ] TRACE 2024/06/25 16:18:12 sent JSON message to 1: [3,"rq67os8fh060gb6pdgm6ql44",{"currentTime":"2024-06-25T06:18:12Z"}]
[ocpp ] TRACE 2024/06/25 16:18:38 received JSON message from 1: [2,"zdtttvq79tpq492fcdz237n4","StatusNotification",{"connectorId":1,"errorCode":"NoError","status":"Preparing","timestamp":"2024-06-25T06:18:37Z"}]
[ocpp ] TRACE 2024/06/25 16:18:38 sent JSON message to 1: [3,"zdtttvq79tpq492fcdz237n4",{}]
[ocpp ] TRACE 2024/06/25 16:19:38 received JSON message from 1: [2,"zmaqnp1zzgpk6p91f26sys2f","Heartbeat",{}]
[ocpp ] TRACE 2024/06/25 16:19:38 sent JSON message to 1: [3,"zmaqnp1zzgpk6p91f26sys2f",{"currentTime":"2024-06-25T06:19:38Z"}]
[ocpp ] TRACE 2024/06/25 16:20:38 received JSON message from 1: [2,"csqs3psnpygm1r4zo125uliz","Heartbeat",{}]
[ocpp ] TRACE 2024/06/25 16:20:38 sent JSON message to 1: [3,"csqs3psnpygm1r4zo125uliz",{"currentTime":"2024-06-25T06:20:38Z"}]
[ocpp ] TRACE 2024/06/25 16:21:38 received JSON message from 1: [2,"bgjayjex7e6b8ueoas6un5rj","Heartbeat",{}]
[ocpp ] TRACE 2024/06/25 16:21:38 sent JSON message to 1: [3,"bgjayjex7e6b8ueoas6un5rj",{"currentTime":"2024-06-25T06:21:38Z"}]
[ocpp ] TRACE 2024/06/25 16:22:38 received JSON message from 1: [2,"1v6e1yp1s6arzz2ah36s5pyn","Heartbeat",{}]
[ocpp ] TRACE 2024/06/25 16:22:38 sent JSON message to 1: [3,"1v6e1yp1s6arzz2ah36s5pyn",{"currentTime":"2024-06-25T06:22:38Z"}]
[ocpp ] TRACE 2024/06/25 16:23:38 received JSON message from 1: [2,"vjqkh40m3latau5na3qwlg2t","Heartbeat",{}]
[ocpp ] TRACE 2024/06/25 16:23:38 sent JSON message to 1: [3,"vjqkh40m3latau5na3qwlg2t",{"currentTime":"2024-06-25T06:23:38Z"}]

Interestingly, after rolling back to 0.127.2, if I comment out key 'vin', the car is again never recognised as connected, so this behaviour is not new and key 'vin' is NOT optional ?

Steps to reproduce

  1. Upgrade from HAOS addon 0.127.2 to HAOS addon 0.127.3
  2. Issue resolves on rollback to 0.127.2
  3. ...

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: 30s # control cycle interval. Interval <30s can lead to unexpected behavior, see https://docs.evcc.io/docs/reference/configuration/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)
# spjonsortoken:

# 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

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

# 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 # use `deny` to raise modbus errors

# 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:
  - type: template
    template: fronius-solarapi-v1
    usage: grid
    host: 192.168.1.49
    name: grid1
  - type: template
    template: fronius-solarapi-v1
    usage: pv
    host: 192.168.1.49
    name: pv2

# 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:
  - type: template
    template: ocpp
    connector: 1
    connecttimeout: 5m
    timeout: 2m
    getconfiguration: false
    bootnotification: true
    chargingrateunit: W
    name: zjbeny

vehicles:
  - type: template
    template: mg2mqtt
    title: Brum
    user: xxxx@hotmail.com
    vin: LSJWH4096PN209179
    capacity: 51
    phases: 1
    icon: car
    timeout: 1h
    mode: pv
    minCurrent: 6
    maxCurrent: 32
    name: ev3

site:
  - title: My home
    meters:
      grid: grid1
      pv: pv2
    residualPower: 0 # 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: zjbeny # charger
    #meter: charge # charge meter
    mode: "pv" # default charge mode to apply when vehicle is disconnected; use "off" to disable by default if charger is publicly available
    #    phases: 1 # 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: 32 # maximum charge current (default 16A)
    vehicle: ev3
    # remaining settings are experts-only and best left at default values
    priority: 0 # relative priority for concurrent charging in PV mode with multiple loadpoints (higher values have higher priority)
    soc:
      poll:
        mode: connected
        interval: 30s
      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: 3m # 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: AUD # three letter ISO-4217 currency code (default EUR)
  grid:
    # either static grid price (or price zones)
    type: fixed
    price: 0.294 # EUR/kWh
    zones:
      - days: Mon-Fri
        hours: 0-6:59 # off peak
        price: 0.27698
      - days: Mon-Fri
        hours: 7-8:59 # peak
        price: 0.4279
      - days: Mon-Fri
        hours: 9-16:59 # shoulder
        price: 0.36498
      - days: Mon-Fri
        hours: 17-18:59 # peak
        price: 0.4279
      - days: Mon-Fri
        hours: 19-21:59 # shoulder
        price: 0.36498
      - days: Mon-Fri
        hours: 22-23:59 # off peak
        price: 0.27698
      - days: Sat,Sun
        price: 0.27698 # off peak
      - days: Sat,Sun
        hours: 12-13:59 # off peak free
        price: 0.00

    # 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%)

    # type: entsoe # Entso-E european market data
    # domain: BZN|DE-LU # https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html#_areas
    # securitytoken: # api token
    # charges: # optional, additional charges per kWh
    # tax: # optional, additional tax (0.1 for 10%)

    # type: custom # price from a plugin source; see https://docs.evcc.io/docs/reference/plugins
    # price:
    #   source: http
    #   uri: https://example.org/price.json
    #   jq: .price.current

  feedin:
    # rate for feeding excess (pv) energy to the grid
    type: fixed
    price: 0.07 # AUD/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: DE

    # type: ngeso # National Grid Electricity System Operator data (United Kingdom only) https://carbonintensity.org.uk/
    # provides national data if both region and postcode are omitted - do not supply both at the same time!
    # region: 1 # optional, coarser than using a postcode - see https://api.carbonintensity.org.uk/ for full list
    # postcode: SW1A1AA # optional

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

# 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 charging in "${mode}" mode
    stop: # charge stop event
      title: Charge finished
      msg: Finished 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}
    soc: # vehicle soc update event
      title: Soc updated
      msg: Battery charged to ${vehicleSoc:%.0f}%
    guest: # vehicle could not be identified
      title: Unknown vehicle
      msg: Unknown vehicle, guest connected?
  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

[main ] INFO 2024/06/25 15:52:05 evcc 0.127.3
[main ] INFO 2024/06/25 15:52:05 using config file: /config/evcc.yaml
[db ] INFO 2024/06/25 15:52:05 using sqlite database: /config/evcc.db
[mqtt ] INFO 2024/06/25 15:52:05 connecting evcc-1462954333 at tcp://localhost:1883
[mqtt ] DEBUG 2024/06/25 15:52:05 tcp://localhost:1883 connected
[main ] INFO 2024/06/25 15:52:05 listening at :7070
[ocpp-1] DEBUG 2024/06/25 15:52:05 waiting for chargepoint: 5m0s
[ocpp ] INFO 2024/06/25 15:52:22 charge point connected, registering: 1
[main ] FATAL 2024/06/25 15:52:23 cannot create vehicle 'ev3': cannot create vehicle type 'template': cannot create vehicle type 'custom': decoding failed due to the following error(s): '' has invalid keys: vin
[main ] FATAL 2024/06/25 15:52:23 will attempt restart in: 15m0s

What type of operating system are you running?

HomeAssistant Add-on

Version

0.127.3

andig commented 5 months ago

Thank you for the report. Broke this when cleaning up in https://github.com/evcc-io/evcc/pull/14452 in combination with https://github.com/evcc-io/evcc/pull/14245. vin must not be part of the common properties include.