MickMake / HomeAssistantAddons

MIT License
43 stars 26 forks source link

Error - String defined as boolean #35

Open TrueMB opened 11 months ago

TrueMB commented 11 months ago

Hey! I am getting the following error. Everything works, but would be awesome if you could fix this.

Logger: homeassistant.components.mqtt.models
Source: components/sensor/__init__.py:595
Integration: MQTT (documentation, issues)
First occurred: 12:42:32 (1050 occurrences)
Last logged: 15:00:41

Exception raised when updating state of sensor.gosungrow_getpslist_devices_5068541_location, topic: 'homeassistant/sensor/GoSungrow/GoSungrow-getPsList-devices-5068541-location/state' with payload: b'{"value":"%MYADDRESS-STRING%"}'
Exception raised when updating state of sensor.gosungrow_getpslist_devices_5068541_ps_timezone, topic: 'homeassistant/sensor/GoSungrow/GoSungrow-getPsList-devices-5068541-ps_timezone/state' with payload: b'{"value":"GMT+1"}'
Exception raised when updating state of sensor.gosungrow_getpslist_devices_5068541_is_bank_ps, topic: 'homeassistant/sensor/GoSungrow/GoSungrow-getPsList-devices-5068541-is_bank_ps/state' with payload: b'{"value":"false"}'
Exception raised when updating state of sensor.gosungrow_getpslist_devices_5068541_ps_status, topic: 'homeassistant/sensor/GoSungrow/GoSungrow-getPsList-devices-5068541-ps_status/state' with payload: b'{"value":"true"}'
Exception raised when updating state of sensor.gosungrow_getpslist_devices_5068541_ps_name, topic: 'homeassistant/sensor/GoSungrow/GoSungrow-getPsList-devices-5068541-ps_name/state' with payload: b'{"value":"SH6.0RT"}'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, 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 270, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 746, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 808, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 752, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 595, in state
    raise ValueError(
ValueError: Sensor sensor.gosungrow_getpsdetail_5068541_has_ammeter has device class 'None', state class 'measurement' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'true' (<class 'str'>)