MickMake / GoSungrow

GoLang implementation to access the iSolarCloud API updated by SunGrow inverters.
https://mickmake.com/
GNU General Public License v2.0
184 stars 48 forks source link

Seeing a load of exceptions in the logs such as "could not convert string to float" #97

Open oleg-d opened 1 year ago

oleg-d commented 1 year ago

The add-on seems to be working great otherwise, just that I am seeing a bunch of exceptions in the logs.

ps_type_name ValueError: could not convert string to float: 'Residential PV' ps_location ValueError: could not convert string to float: 'Finland' ps_holder ValueError: invalid literal for int() with base 10: 'B2290923829' ps_short_name ValueError: invalid literal for int() with base 10: 'B2290923829' ps_name ValueError: could not convert string to float: 'Finland' timezone ValueError: invalid literal for int() with base 10: 'GMT+2'

For example here's the full stack trace for the timezone from the log:

2023-11-08 08:08:15.968 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.gosungrow_getpsdetail_5182053_timezone, topic: 'homeassistant/sensor/GoSungrow/GoSungrow-getPsDetail-5182053-timezone/state' with payload: b'{"value":"GMT+2"}'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 616, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'GMT+2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 619, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'GMT+2'

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 743, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 749, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 623, in state
    raise ValueError(
ValueError: Sensor sensor.gosungrow_getpsdetail_5182053_timezone 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: 'GMT+2' (<class 'str'>)
GitPat2 commented 6 months ago

same here, did you find a solution?