core: Nissan Leaf integration error

The problem

Nissan Leaf integration periodically reports an error. After that it stops working, only HA restarting resolves the problem.

What version of Home Assistant Core has the issue?

2022.3.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Nissan Leaf

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nissan_leaf/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

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: ''

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

It’s a pycarwings2 bug. In pycarwings2/responses.py it should make a change. line 661, in init

 else:
            if self.battery_remaining_amount == '':
                self.battery_percent = 0
            else:
                self.battery_percent = 100 * float(self.battery_remaining_amount) / 12

Right yes, figured that out the other day, you now need to login on the website and subscribe, for free.

It’s a pycarwings2 bug. In pycarwings2/responses.py it should make a change. line 661, in init

 else:
            if self.battery_remaining_amount == '':
                self.battery_percent = 0
            else:
                self.battery_percent = 100 * float(self.battery_remaining_amount) / 12

Where and how do I do that?

Still an issue on 2022.9.1

Same here, was excited to bring home my new car yesterday, first thing I do today with it is try to integrate it to HA, no go…

Logger: homeassistant.components.nissan_leaf Source: components/nissan_leaf/init.py:163 Integration: Nissan Leaf (documentation, issues) First occurred: 8:39:54 AM (1 occurrences) Last logged: 8:39:54 AM

An unknown error occurred while connecting to Nissan: <class ‘pycarwings2.pycarwings2.CarwingsError’>

and

Logger: pycarwings2.pycarwings2 Source: /usr/local/lib/python3.9/site-packages/pycarwings2/pycarwings2.py:166 First occurred: 8:39:54 AM (1 occurrences) Last logged: 8:39:54 AM

carwings error INVALID PARAMS: -2010