home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.81k stars 30.51k forks source link

Constant errors in logs related to iaqualink #75277

Closed johntdyer closed 2 years ago

johntdyer commented 2 years ago

The problem

I am constantly getting these errors, I think it has something to do w/ the temps they return when switching between pool mode and spa mode, since it only returns one temp at a time.

2022-07-15 12:52:25 DEBUG (MainThread) [iaqualink] -> GET https://p-api.iaqualink.net/v1/mobile/session.json?actionID=command&command=get_home&serial=xxxxx&sessionID=xxxxxxx {}
2022-07-15 12:52:26 DEBUG (MainThread) [iaqualink] <- 200 OK - https://p-api.iaqualink.net/v1/mobile/session.json?actionID=command&command=get_home&serial=xxxxx&sessionID=xxxxx
2022-07-15 12:52:26 DEBUG (MainThread) [iaqualink] -> GET https://p-api.iaqualink.net/v1/mobile/session.json?actionID=command&command=get_devices&serial=xxxxx&sessionID=xxxxx {}
2022-07-15 12:52:27 DEBUG (MainThread) [iaqualink] <- 200 OK - https://p-api.iaqualink.net/v1/mobile/session.json?actionID=command&command=get_devices&serial=xxxxxxx&sessionID=xxxxx
2022-07-15 12:52:27 DEBUG (MainThread) [iaqualink] Home response: {'message': '', 'home_screen': [{'status': 'Online'}, {'response': "AQU='70','0A 00 01 02 03 05 06 07 0E 0F 1A 01 00 00 00 00 4C 00 68 00 59 00 00 00'"}, {'system_type': '0'}, {'temp_scale': 'F'}, {'spa_temp': ''}, {'pool_temp': ''}, {'air_temp': '89'}, {'spa_set_point': '104'}, {'pool_set_point': '76'}, {'cover_pool': ''}, {'freeze_protection': '0'}, {'spa_pump': '0'}, {'pool_pump': '1'}, {'spa_heater': '0'}, {'pool_heater': '0'}, {'solar_heater': ''}, {'spa_salinity': ''}, {'pool_salinity': ''}, {'orp': ''}, {'ph': ''}, {'is_icl_present': 'absent'}, {'icl_custom_color_info': []}, {'heatpump_info': {}}, {'pool_chill_set_point': ''}]}
2022-07-15 12:52:27 DEBUG (MainThread) [iaqualink] Devices response: {'message': '', 'devices_screen': [{'status': 'Online'}, {'response': "AQU='72','4|1|2|3|32|1|1|0|0|Sheer Dscnt|0|1|0|0|Bubbler|1|7|2|5|Lights|0|1|0|0|Extra Aux'"}, {'group': '1'}, {'aux_1': [{'state': '1'}, {'label': 'Sheer Dscnt'}, {'icon': 'aux_1_1.png'}, {'type': '0'}, {'subtype': '0'}]}, {'aux_2': [{'state': '0'}, {'label': 'Bubbler'}, {'icon': 'aux_1_0.png'}, {'type': '0'}, {'subtype': '0'}]}, {'aux_3': [{'state': '1'}, {'label': 'Lights'}, {'icon': 'aux_7_1.png'}, {'type': '2'}, {'subtype': '5'}]}, {'aux_EA': [{'state': '0'}, {'label': 'Extra Aux'}, {'icon': 'aux_1_0.png'}, {'type': '0'}, {'subtype': '0'}]}], 'icl_info_list': []}
2022-07-15 12:52:27 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 281, in state_attributes
    self.target_temperature,
  File "/usr/src/homeassistant/homeassistant/components/iaqualink/climate.py", line 105, in target_temperature
    return float(self.dev.state)
ValueError: could not convert string to float: ''

What version of Home Assistant Core has the issue?

Home Assistant 2022.7.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

iaqualink

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

n/a

Anything in the logs that might be useful for us?

I think this may have something to do w/ the Spa temp, which is not reported when the system is in Pool mode.

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

iaqualink documentation iaqualink source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @flz, mind taking a look at this issue as it has been labeled with an integration (iaqualink) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

matthewhadley commented 2 years ago

These errors are filling up my homeassistant log as well.

2022-08-16 16:45:42.264 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 281, in state_attributes
self.target_temperature,
File "/usr/src/homeassistant/homeassistant/components/iaqualink/climate.py", line 105, in target_temperature
return float(self.dev.state)
ValueError: could not convert string to float: ''
2022-08-16 16:45:42.293 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 52, in native_value
return int(self.dev.state)
ValueError: invalid literal for int() with base 10: 'absent'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 54, in native_value
return float(self.dev.state)
ValueError: could not convert string to float: 'absent'
2022-08-16 16:45:42.303 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 52, in native_value
return int(self.dev.state)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
2022-08-16 16:45:42.309 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 52, in native_value
return int(self.dev.state)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'dict'

In my case there seem to be 4 instances of trying to cast a value that fail:

matthewhadley commented 2 years ago

I noticed something interesting when looking at the iAqualink entities - there were 4 entities that Home Assistant had "restored":

Screen Shot 2022-08-16 at 21 59 05

Those entities don't actually exist in my pool equipment. The number (4) of entities matches the number of distinct errors I was seeing in the logs. I disabled them in Home Assistant and the errors in the logs seem to have stopped.

This "fix" is probably just masking the underlying issue though.

johntdyer commented 2 years ago

Since updating to 2022.09.0b0 I am now getting the following error

2022-09-01 13:06:08.326 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 52, in native_value
    return int(self.dev.state)
ValueError: invalid literal for int() with base 10: 'absent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
    value = self.native_value
  File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 54, in native_value
    return float(self.dev.state)

    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
    value = self.native_value
  File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 52, in native_value
    return int(self.dev.state)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'

2022-09-01 13:06:08.330 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'iaqualink': ()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
    value = self.native_value
  File "/usr/src/homeassistant/homeassistant/components/iaqualink/sensor.py", line 52, in native_value
    return int(self.dev.state)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'dict'