evcc-io / evcc

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

error when accessing configuration via web UI (+PW) #13688

Closed Cheppetto closed 5 months ago

Cheppetto commented 5 months ago

Describe the bug

Error shows up in the log on GET requests (websocket connection)

Steps to reproduce

  1. open webUI
  2. access config enter PW
  3. error appears in log ...

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.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)
sponsortoken:  <nothing to see here>
# telemetry enables aggregated statistics
plant: <nothing to see here>
telemetry: true

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

# 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: Netz
#    type: template
#    template: e3dc
#    usage: grid
#    host: <nothing to see here> # IP-Adresse oder Hostname
#    port: 502 # Port (optional) 
#    id: 2
# !do not uncomment!   power: Power # default value, optionally override # !do not uncomment!
# !do not uncomment!   energy: Sum # default value, optionally override # !do not uncomment!
#  - name: PV
#    type: template
#    template: e3dc
#    usage: pv
#    host: <nothing to see here> # IP-Adresse oder Hostname
#    port: 502 # Port (optional) 
#  - name: HausAkku
#    type: template
#    template: e3dc
#    usage: battery
#    capacity: 24.5 #Akkukapazität netto in kWh (optional)
#    host: <nothing to see here> # IP-Adresse oder Hostname
#    port: 502 # Port (optional) 

# 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: WallboxGarage
    type: template
    template: bender
    host: <nothing to see here> # IP-Adresse oder Hostname
    port: 502 # Port (optional) 

  - name: carport
    type: template
    template: shelly
    host: <nothing to see here> # IP-Adresse oder Hostname
    user: <nothing to see here> # Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.) (optional)
    password: "<nothing to see here>" # Passwort des Benutzerkontos (bei führenden Nullen bitte in einfache Hochkommata setzen) (optional)
    channel: 0 # optional 
    standbypower: 100 # Leistung oberhalb des angegebenen Wertes wird als Ladeleistung gewertet (optional) 

vehicles:
  - name: "<nothing to see here>"
    type: template
    template: evnotify
    title: "<nothing to see here>"
    icon: car
    akey: <nothing to see here>
    token: <nothing to see here>
    capacity: 28 # Akkukapazität in kWh (optional) 
    phases: 1
    minCurrent: 6
    maxCurrent: 32

# site describes the EVU connection, PV and home battery
site:
  title: Home # display name for UI
  residualPower: 300 # 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: <nothing to see here> # display name for UI
    charger: WallboxGarage # charger
#    meter: bender # charge meter
    mode: "pv" # set default charge mode, use "off" to disable by default if charger is publicly available
    vehicle: "<nothing to see here>" # Referenz auf Standardfahrzeug
    phases: # 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)
    # 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:
      # 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: always
        # poll interval defines how often the vehicle API may be polled if NOT charging
        interval: 1m
      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)

  - title: Carport # display name for UI
    charger: carport # charger
# electrical connection (normal charger: default 3 for 3 phase, 1p3p charger: 0 for "auto" or 1/3 for fixed phases)
    mode: "pv" # set default charge mode, use "off" to disable by default if charger is publicly available
    # 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: 32 # maximum charge current (default 16A)
    #vehicle: "Ioniq" # Referenz auf Standardfahrzeug
    phases: 1
    mincurrent: 10
    maxcurrent: 10
    # 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:
      # 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: 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: EUR # 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: 2-5
    #    price: 0.2 # EUR/kWh
    #  - days: Sat,Sun
    #    price: 0.15 # EUR/kWh

    # or variable tariffs
     type: awattar
     region: at # optional, choose at for Austria
     charges: 0.015 # optional, additional charges per kWh
     tax: 0.25 # optional, additional tax (0.1 for 10%)

  feedin:
    # rate for feeding excess (pv) energy to the grid
    type: custom
    price:
      source: http
      uri: <nothing to see here>
      method: GET # default HTTP method
      headers:
        - content-type: application/json
        - Authorization: 'Bearer <nothing to see here>'
        - connection: keep-alive
      timeout: 30m # timeout in golang duration format, see https://golang.org/pkg/time/#ParseDuration
      jq: .state #.tuples[0][1] # parse response json
co2:

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

# influx database
influx:
   url: http://<nothing to see here>:8086
   database: <nothing to see here>
   user: <nothing to see here>
   password: <nothing to see here>

# push messages
messaging:
  events:
    start: # charge start event
      title: Charge of {{.vehicleTitle}} started  
      msg: |  
        Wallbox {{.title}} started charging {{.vehicleTitle}} in {{ toString .mode | upper }} mode.  
        --------------------------  
        evcc Status {{printf `(%d-%02d-%02d %02d:%02d:%02d)` now.Year now.Month now.Day now.Hour now.Minute now.Second}}  
        Netz-Leistung: {{round (divf .gridPower 1000) 3 }} kW  
        Solar-Leistung: {{round (divf .pvPower 1000) 3 }} kW  
        Eigenverbrauch: {{round (divf .homePower 1000) 3 }} kW  
        {{if .batteryConfigured}}Batteriespeicher-Status: {{round (divf .batteryPower 1000) 3 }} kW ({{.batterySoC }} %){{end}}  
    stop: # charge stop event
      title: Charge of {{.vehicleTitle}} finished  
      msg: |  
        Wallbox {{.title}} finished charging {{.vehicleTitle}}   
        with {{round (divf .chargedEnergy 1000) 2 }} kWh in {{.chargeDuration}}.  
        --------------------------  
        evcc Status {{printf `(%d-%02d-%02d %02d:%02d:%02d)` now.Year now.Month now.Day now.Hour now.Minute now.Second}}  
        Netz-Leistung: {{round (divf .gridPower 1000) 3 }} kW  
        Solar-Leistung: {{round (divf .pvPower 1000) 3 }} kW  
        Eigenverbrauch: {{round (divf .homePower 1000) 3 }} kW  
        {{if .batteryConfigured}}Batteriespeicher-Status: {{round (divf .batteryPower 1000) 3 }} kW ({{.batterySoC }} %){{end}} 
    connect: # vehicle connect event
      title: "{{.vehicleTitle}} connected on wallbox {{.title}}"  
      msg: |  
        {{.vehicleTitle}} connected on wallbox {{.title}} at {{round (divf .pvPower 1000) 2 }} kW PV.  
        --------------------------  
        evcc Status {{printf `(%d-%02d-%02d %02d:%02d:%02d)` now.Year now.Month now.Day now.Hour now.Minute now.Second}}  
        Netz-Leistung: {{round (divf .gridPower 1000) 3 }} kW  
        Solar-Leistung: {{round (divf .pvPower 1000) 3 }} kW  
        Eigenverbrauch: {{round (divf .homePower 1000) 3 }} kW  
        {{if .batteryConfigured}}Batteriespeicher-Status: {{round (divf .batteryPower 1000) 3 }} kW ({{.batterySoC }} %){{end}}  
    disconnect: # vehicle connected event
      title: "{{.vehicleTitle}} disconnected of wallbox {{.title}}"  
      msg: |  
        {{.vehicleTitle}} disconnected of wallbox {{.title}} after {{.connectedDuration}}.  
        --------------------------  
        evcc Status {{printf `(%d-%02d-%02d %02d:%02d:%02d)` now.Year now.Month now.Day now.Hour now.Minute now.Second}}  
        Netz-Leistung: {{round (divf .gridPower 1000) 3 }} kW  
        Solar-Leistung: {{round (divf .pvPower 1000) 3 }} kW  
        Eigenverbrauch: {{round (divf .homePower 1000) 3 }} kW  
        {{if .batteryConfigured}}Batteriespeicher-Status: {{round (divf .batteryPower 1000) 3 }} kW ({{.batterySoC }} %){{end}}  
  services:
    - type: telegram
      token: "<nothing to see here>"
      chats: 
      - <nothing to see here>

Log details

http: panic serving 192.168.233.178:34346: runtime error: index out of range [0] with length 0\ngoroutine 1470 [running]:\nnet/http.(*conn).serve.func1()\n\tnet/http/server.go:1898 +0xbe\npanic({0x2c1c7a0?, 0xc0018eea08?})\n\truntime/panic.go:770 +0x132\ngithub.com/evcc-io/evcc/util/logstash.element.areaLevel({0xc00117e300?, 0xc001ae7570?})\n\tgithub.com/evcc-io/evcc/util/logstash/element.go:16 +0xd9\ngithub.com/evcc-io/evcc/util/logstash.(*logger).Areas(0x10?)\n\tgithub.com/evcc-io/evcc/util/logstash/log.go:88 +0x1e5\ngithub.com/evcc-io/evcc/util/logstash.Areas(...)\n\tgithub.com/evcc-io/evcc/util/logstash/log.go:17\ngithub.com/evcc-io/evcc/server.logAreasHandler({0x3b09490, 0xc001820a20}, 0x6?)\n\tgithub.com/evcc-io/evcc/server/http_site_handler.go:251 +0x2b\nnet/http.HandlerFunc.ServeHTTP(0xc0017a7560?, {0x3b09490?, 0xc001820a20?}, 0x41d745?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/gorilla/handlers.(*cors).ServeHTTP(0xc0010fd320, {0x3b09490, 0xc001820a20}, 0xc0006807e0)\n\tgithub.com/gorilla/handlers@v1.5.2/cors.go:54 +0x335\ngithub.com/gorilla/handlers.CompressHandler.CompressHandlerLevel.func1({0x3b05180, 0xc000936c40}, 0xc0006807e0)\n\tgithub.com/gorilla/handlers@v1.5.2/compress.go:141 +0x576\nnet/http.HandlerFunc.ServeHTTP(0xc0006807e0?, {0x3b05180?, 0xc000936c40?}, 0x2b60360?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/evcc-io/evcc/server.(*HTTPd).RegisterSystemHandler.ensureAuthHandler.func2.1({0x3b05180, 0xc000936c40}, 0xc0006807e0)\n\tgithub.com/evcc-io/evcc/server/http_auth.go:140 +0x94\nnet/http.HandlerFunc.ServeHTTP(0x2b95860?, {0x3b05180?, 0xc000936c40?}, 0xc?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/evcc-io/evcc/server.jsonHandler.func1({0x3b05180, 0xc000936c40}, 0xc0006807e0)\n\tgithub.com/evcc-io/evcc/server/http_site_handler.go:72 +0xf6\nnet/http.HandlerFunc.ServeHTTP(0xc0006806c0?, {0x3b05180?, 0xc000936c40?}, 0x50630f?)\n\tnet/http/server.go:2166 +0x29\ngithub.com/gorilla/mux.(*Router).ServeHTTP(0xc000a84840, {0x3b05180, 0xc000936c40}, 0xc0015a9e60)\n\tgithub.com/gorilla/mux@v1.8.1/mux.go:212 +0x1e2\nnet/http.serverHandler.ServeHTTP({0xc0017a7530?}, {0x3b05180?, 0xc000936c40?}, 0x6?)\n\tnet/http/server.go:3137 +0x8e\nnet/http.(*conn).serve(0xc0010fd0e0, {0x3b0c528, 0xc001659a70})\n\tnet/http/server.go:2039 +0x5e8\ncreated by net/http.(*Server).Serve in goroutine 1\n\tnet/http/server.go:3285 +0x4b4

What type of operating system are you running?

Linux

Version

HaaS OS

andig commented 5 months ago
http: panic serving 192.168.233.178:34346: runtime error: index out of range [0] with length 0
goroutine 1470 [running]:
net/http.(*conn).serve.func1()
    net/http/server.go:1898 +0xbe
panic({0x2c1c7a0?, 0xc0018eea08?})
    runtime/panic.go:770 +0x132
github.com/evcc-io/evcc/util/logstash.element.areaLevel({0xc00117e300?, 0xc001ae7570?})
    github.com/evcc-io/evcc/util/logstash/element.go:16 +0xd9
github.com/evcc-io/evcc/util/logstash.(*logger).Areas(0x10?)
    github.com/evcc-io/evcc/util/logstash/log.go:88 +0x1e5
github.com/evcc-io/evcc/util/logstash.Areas(...)
    github.com/evcc-io/evcc/util/logstash/log.go:17
github.com/evcc-io/evcc/server.logAreasHandler({0x3b09490, 0xc001820a20}, 0x6?)
    github.com/evcc-io/evcc/server/http_site_handler.go:251 +0x2b
net/http.HandlerFunc.ServeHTTP(0xc0017a7560?, {0x3b09490?, 0xc001820a20?}, 0x41d745?)
    net/http/server.go:2166 +0x29
github.com/gorilla/handlers.(*cors).ServeHTTP(0xc0010fd320, {0x3b09490, 0xc001820a20}, 0xc0006807e0)
    github.com/gorilla/handlers@v1.5.2/cors.go:54 +0x335
github.com/gorilla/handlers.CompressHandler.CompressHandlerLevel.func1({0x3b05180, 0xc000936c40}, 0xc0006807e0)
    github.com/gorilla/handlers@v1.5.2/compress.go:141 +0x576
net/http.HandlerFunc.ServeHTTP(0xc0006807e0?, {0x3b05180?, 0xc000936c40?}, 0x2b60360?)
    net/http/server.go:2166 +0x29
github.com/evcc-io/evcc/server.(*HTTPd).RegisterSystemHandler.ensureAuthHandler.func2.1({0x3b05180, 0xc000936c40}, 0xc0006807e0)
    github.com/evcc-io/evcc/server/http_auth.go:140 +0x94
net/http.HandlerFunc.ServeHTTP(0x2b95860?, {0x3b05180?, 0xc000936c40?}, 0xc?)
    net/http/server.go:2166 +0x29
github.com/evcc-io/evcc/server.jsonHandler.func1({0x3b05180, 0xc000936c40}, 0xc0006807e0)
    github.com/evcc-io/evcc/server/http_site_handler.go:72 +0xf6
net/http.HandlerFunc.ServeHTTP(0xc0006806c0?, {0x3b05180?, 0xc000936c40?}, 0x50630f?)
    net/http/server.go:2166 +0x29
github.com/gorilla/mux.(*Router).ServeHTTP(0xc000a84840, {0x3b05180, 0xc000936c40}, 0xc0015a9e60)
    github.com/gorilla/mux@v1.8.1/mux.go:212 +0x1e2
net/http.serverHandler.ServeHTTP({0xc0017a7530?}, {0x3b05180?, 0xc000936c40?}, 0x6?)
    net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc0010fd0e0, {0x3b0c528, 0xc001659a70})
    net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 1
    net/http/server.go:3285 +0x4b4
horst789github commented 5 months ago

selbes problem mit der version 1.126.0 , braucht ihr was von mir oder reicht euch die info das ich das problem auch habe.

andig commented 5 months ago

Schau mal bitte in die Browser Netzwerkkonsole- gibts da einen API-Aufruf vorher? Welchen?

andig commented 5 months ago

Closed in https://github.com/evcc-io/evcc/commit/7a3390a06a4032370555fa6f9b6f88ce3370ab27