filcole / pycarwings2

Python library for interacting with the NissanConnect EV (aka CARWINGS) telematics service.
Apache License 2.0
33 stars 20 forks source link

ValueError: could not convert string to float: '' #40

Closed epiniguin closed 1 year ago

epiniguin commented 2 years ago

Hi! I use pycarwings2 integration of Home Assistant. Home Assistant uses the latest pycarwings2 2.13. Periodically it gives an error:

Logger: homeassistant
Source: components/nissan_leaf/__init__.py:359
First occurred: 16:26:49 (1 occurrences)
Last logged: 16:26:49

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/nissan_leaf/__init__.py", line 253, in async_update_data
    await self.async_refresh_data(now)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/nissan_leaf/__init__.py", line 306, in async_refresh_data
    server_response = await self.async_get_battery()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/nissan_leaf/__init__.py", line 359, in async_get_battery
    start_server_info = await self.hass.async_add_executor_job(
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.9/site-packages/pycarwings2/pycarwings2.py", line 402, in get_latest_battery_status
    return CarwingsLatestBatteryStatusResponse(response)
  File "/srv/homeassistant/lib/python3.9/site-packages/pycarwings2/responses.py", line 661, in __init__
    self.battery_percent = 100 * float(self.battery_remaining_amount) / 12
ValueError: could not convert string to float: ''
filcole commented 1 year ago

Thanks for reporting. Fixed by #43