Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As Of Today Battery Details like SOC, PLUGGED, CHARGING are not updating #61

Open
maegibbons opened this issue Jun 11, 2023 · 10 comments
Open
Assignees

Comments

@maegibbons
Copy link

maegibbons commented Jun 11, 2023

As Of Today Battery Details like SOC, PLUGGED, CHARGING are not updating.

LEAF_TYPE
after2019. 40kw UK

Expected behavior
Updates to happen. Climate and Location are still updating JUST Battery details

My Leaf is also failing so pretty sure that this is an underlying library issue.

If you can test and report to Tobias

Krs

Mark

@DerEichler
Copy link

My Leaf and the addon work for me as far as I can see.

@Skeletorjus
Copy link
Contributor

My values didn't update either. My Leaf has had an update yesterday addressing this, and after recreating the leaf2mqtt-container it seems to be working fine again.

@Happyboy0980
Copy link

Happyboy0980 commented Jun 15, 2023

It seems that the Leaf2mqtt is getting the right data again, but somehow it is not pushed to HA any more .. ?

image

All my sensor in HA don't update after the last update while other MQTT itmes are working fine.
In MQTT explorer, is see now the old value (in my case SOC of 81% and a few lines below the new Value (9%)...

Diving in the logs :

image

image

image

@DerEichler
Copy link

Do you use the addon or the container? I just redid my setup with using the addon (easy to install, just fill in all the fields with data, otherwise the creation will fail) and everything works fine for me.

@Happyboy0980
Copy link

All works fine after re install, accept above error still there..

@Happyboy0980
Copy link

Working now..

image

But since it is not duration any more.. not really nice...

@ExMacro
Copy link

ExMacro commented Sep 15, 2023

I'm having the same problem but only with the leaf/battery/charging and 'leaf/battery/connected. I uninstalled and reinstalled the add-on but it didn't make a difference. Any ideas on how to fix this?

The error is:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 591, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'true'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 305, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, in state
    raise ValueError(
ValueError: Sensor sensor.leaf_battery_charging has device class 'battery', state class 'None' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'true' (<class 'str'>)

@ExMacro
Copy link

ExMacro commented Nov 11, 2023

For me adding the payloads into the config worked for battery charging.

mqtt:
  binary_sensor:
    - name: leaf_battery_charging
      # Since VIN is not specified, it will represent the state from the first vehicle in the account.
      state_topic: "leaf/battery/charging"
      payload_off: "false"
      payload_on: "true"
      device_class: battery_charging

@ExMacro
Copy link

ExMacro commented Nov 11, 2023

For me adding the payloads into the config worked for battery charging.

mqtt:
  binary_sensor:
    - name: leaf_battery_charging
      # Since VIN is not specified, it will represent the state from the first vehicle in the account.
      state_topic: "leaf/battery/charging"
      payload_off: "false"
      payload_on: "true"
      device_class: battery_charging

.. and adding the payloads into the config also fixes the "leaf/battery/connected". Everything works now again!

@DerEichler
Copy link

I got the Connected Sensor working with the new payload thingy but the charging sensor is still not working, which is sad because that enables the add on to allow the faster refresh rate of the battery percentage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants