Dielee / volvo2mqtt

Home Assistant addon for connecting AAOS Volvos
MIT License
143 stars 30 forks source link

Error with mutiple cars #9

Closed christoph-ng closed 1 year ago

christoph-ng commented 1 year ago
          Something is still wrong :-(

PS: I could not reopen the ticket

If I run the command with empty vin it's just running once and getting an error. If I put both vins in the command ( "vin": ["VIN1", "VIN2"]) it's the same

root@vm-docker:/data/docker/volvo2mqtt# docker run --rm=true  --pull=always -e CONF_updateInterval=30 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "", "username": "", "password": ""}' -e CONF_volvoData='@json {"username": "XXXX", "password": "XXXX", "vin": "", "vccapikey": "XXXX"}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:latest
latest: Pulling from dielee/volvo2mqtt
Digest: sha256:15806260614d8f899fab82afd0ed3e2759e77daea771d5192bbca6f94d43ea62
Status: Image is up to date for ghcr.io/dielee/volvo2mqtt:latest
Starting volvo2mqtt version v1.0.5
Vin: ['VIN1', 'VIN2'] found!
Starting GET call against https://api.volvocars.com/connected-vehicle/v1/vehicles/{0}
Starting GET call against https://api.volvocars.com/connected-vehicle/v1/vehicles/{0}
Sending mqtt update...
Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors
Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status
Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors
Traceback (most recent call last):
  File "/volvoAAOS2mqtt/./main.py", line 9, in <module>
    update_loop()
  File "/volvoAAOS2mqtt/mqtt.py", line 76, in update_loop
    update_car_data()
  File "/volvoAAOS2mqtt/mqtt.py", line 107, in update_car_data
    state = volvo.api_call(sensor["url"], "GET", vin, sensor["id"])
  File "/volvoAAOS2mqtt/volvo.py", line 129, in api_call
    response = recharge_response[vin]
KeyError: 'VIN2'

If I run this separately its working fine for both vin's

root@vm-docker:/data/docker/volvo2mqtt# docker run --rm=true  --pull=always -e CONF_updateInterval=30 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "XXX", "username": "", "password": ""}' -e CONF_volvoData='@json {"username": "XXX", "password": "XXX", "vin": "VIN1", "vccapikey": "XXX"}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:latest
latest: Pulling from dielee/volvo2mqtt
Digest: sha256:15806260614d8f899fab82afd0ed3e2759e77daea771d5192bbca6f94d43ea62
Status: Image is up to date for ghcr.io/dielee/volvo2mqtt:latest
Starting volvo2mqtt version v1.0.5
Vin: ['VIN1'] found!
Starting GET call against https://api.volvocars.com/connected-vehicle/v1/vehicles/{0}
Sending mqtt update...
Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors
Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status
Mqtt update done. Next run in 30 seconds.
Sending mqtt update...
Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors
Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status
Mqtt update done. Next run in 30 seconds.
root@vm-docker:/data/docker/volvo2mqtt# docker run --rm=true  --pull=always -e CONF_updateInterval=30 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "XXX", "username": "", "password": ""}' -e CONF_volvoData='@json {"username": "XXX", "password": "XXX", "vin": "VIN2", "vccapikey": "XXX"}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:latest
latest: Pulling from dielee/volvo2mqtt
Digest: sha256:15806260614d8f899fab82afd0ed3e2759e77daea771d5192bbca6f94d43ea62
Status: Image is up to date for ghcr.io/dielee/volvo2mqtt:latest
Starting volvo2mqtt version v1.0.5
Vin: ['VIN2'] found!
Starting GET call against https://api.volvocars.com/connected-vehicle/v1/vehicles/{0}
Sending mqtt update...
Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors
Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status
Mqtt update done. Next run in 30 seconds.

Originally posted by @christoph-ng in https://github.com/Dielee/volvo2mqtt/issues/3#issuecomment-1598272657

Dielee commented 1 year ago

My fault! Will fix this now!

Dielee commented 1 year ago

Please test v1.0.6!

christoph-ng commented 1 year ago

Looks good - very nice tool !!!!

a1d889cfd5dd: Pull complete 79c1cefad474: Pull complete Digest: sha256:97d893015a215f6c1ff613e588389c2d3df68fd950f825028c040072167858ee Status: Downloaded newer image for ghcr.io/dielee/volvo2mqtt:latest Starting volvo2mqtt version v1.0.7 Vin: ['XXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXX'] found! Starting GET call against https://api.volvocars.com/connected-vehicle/v1/vehicles/{0} Starting GET call against https://api.volvocars.com/connected-vehicle/v1/vehicles/{0} Sending mqtt update... Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status Mqtt update done. Next run in 30 seconds. Sending mqtt update... Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status Mqtt update done. Next run in 30 seconds. Sending mqtt update... Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/doors Starting GET call against https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status Mqtt update done. Next run in 30 seconds.