yp87 / leaf2mqtt

Pull in data from the Nissan Connect platform for the LEAF and publish over MQTT
GNU General Public License v3.0
42 stars 39 forks source link

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

Open maegibbons opened 1 year ago

maegibbons commented 1 year ago

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 commented 1 year ago

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

Skeletorjus commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

Happyboy0980 commented 1 year ago

Working now..

image

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

ExMacro commented 12 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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.