robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
327 stars 60 forks source link

[BUG] Charge percentage spike at 100% #590

Closed virtualdj closed 7 months ago

virtualdj commented 7 months ago

Before you post a new issue - you must first check the following (and check the boxes with an "X" below)

Environment

Describe the bug

Yesterday (02/03/2024) at 21:48 I saw a spike on the battery_level sensor to 100% that triggered some automations. However the battery was not fully charged but I just removed the car to start a trip.

Spike

The automation trace confirms that the value changed suddenly from 72 to 100 in 11 minutes, which is not phisically possible of course.

trigger:
  id: '0'
  idx: '0'
  alias: null
  platform: state
  entity_id: sensor.golf_battery_level
  from_state:
    entity_id: sensor.golf_battery_level
    state: '72'
    attributes:
      state_class: measurement
      model: Golf/None
      last_updated: '2024-03-02T20:33:34+00:00'
      unit_of_measurement: '%'
      assumed_state: true
      device_class: battery
      icon: mdi:battery-charging-80
      friendly_name: Golf Battery level
    last_changed: '2024-03-02T20:27:57.301958+00:00'
    last_updated: '2024-03-02T20:37:59.949830+00:00'
    context:
      id: 01HR0E6K0D9F1NHQRX9JEC0XJ9
      parent_id: null
      user_id: null
  to_state:
    entity_id: sensor.golf_battery_level
    state: '100'
    attributes:
      state_class: measurement
      model: Golf/None
      last_updated: '2024-03-02T20:44:25+00:00'
      unit_of_measurement: '%'
      assumed_state: true
      device_class: battery
      icon: mdi:battery
      friendly_name: Golf Battery level
    last_changed: '2024-03-02T20:48:01.762937+00:00'
    last_updated: '2024-03-02T20:48:01.762937+00:00'
    context:
      id: 01HR0ERYQ26S44TBY1TN9XHNEB
      parent_id: null
      user_id: null

The integration refresh time is 5 minutes, there are some errors in the log below, but they doesn't seem to apply to that time slot and also the updates are normally working well, despite from the logs.

This is not a serious bug, I just opened it to see if I'm the only one that experienced this. Obviously it's not possible to see if the original VW app showed the same percentage because it doesn't keep the history of the values.

Screenshots

History

Traceback/Error logs

2024-03-02 21:53:27.906 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-02 22:48:49.935 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 00:19:20.264 WARNING (MainThread) [volkswagencarnet.vw_connection] Could not fetch vehicle data, error: 'NoneType' object is not iterable
2024-03-03 03:25:02.922 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 04:20:13.959 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 05:15:26.933 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 06:10:39.938 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 07:05:52.980 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 08:01:13.919 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 08:56:46.940 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
2024-03-03 09:52:30.921 WARNING (MainThread) [volkswagencarnet.vw_connection] Token could not be verified!
virtualdj commented 7 months ago

@stickpin I don't know if you're still tracking my car: if you are, maybe you can take a look if you got the same data.

Again, not a big issue, just to see if it's a bug that considers spurious data as 100% charge level.

stickpin commented 7 months ago

@virtualdj I am using credentials only during the development or pre-release regression testing, to avoid rate limit. If you run integration in the debug mode, then please share a full log, so I will be able to analyze what happened. Check the status of the API sensors in the diagnostic section if some of them were failing as well during this time.

In general, I don't have any logic that should show 100% of the battery level in case of failure, so I guess VW started to return 100% for whatever reason.

virtualdj commented 7 months ago

If you run integration in the debug mode, then please share a full log, so I will be able to analyze what happened.

Not this time, unfortunately. Will try to enable it during the next charge but I'm pretty sure it won't happen again soon.

In general, I don't have any logic that should show 100% of the battery level in case of failure, so I guess VW started to return 100% for whatever reason.

Yeah, I agree. Probably if we had developed the VW backend ourselves, it could have worked better! 😅

stickpin commented 7 months ago

@virtualdj I guess, I will close this issue. If this problem happens once again and you have debug logs, please let me know.