samsinnamon / airtouch4pyapi

An api allowing control of AC state (temperature, on/off, mode) of an Airtouch 4 controller locally over TCP
MIT License
27 stars 14 forks source link

Lots of random exceptions when using Airtouch4 Home Assistant component #22

Open werdnum opened 1 year ago

werdnum commented 1 year ago

In the Airtouch4 Home Assistant component, there seem to be lots of random exceptions.

Here's one I've seen personally:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/airtouch4/__init__.py", line 26, in async_setup_entry
    await airtouch.UpdateInfo()
  File "/usr/local/lib/python3.10/site-packages/airtouch4pyapi/airtouch.py", line 85, in UpdateInfo
    if(ac.StartGroupNumber == 0 and ac.GroupCount == 0):
AttributeError: 'AirTouchAc' object has no attribute 'StartGroupNumber'

I see this is a longstanding issue, I've also seen these two other issues but they aren't currently in my logs:

https://community.home-assistant.io/t/airtouch-4-integration-aus/233295/238

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/airtouch4/climate.py", line 191, in async_turn_off
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 535, in _async_write_ha_state
    attr = self.capability_attributes
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 226, in capability_attributes
    ATTR_HVAC_MODES: self.hvac_modes,
  File "/usr/src/homeassistant/homeassistant/components/airtouch4/climate.py", line 147, in hvac_modes
    airtouch_modes = self._airtouch.GetSupportedCoolingModesForAc(self._ac_number)
  File "/usr/local/lib/python3.9/site-packages/airtouch4pyapi/airtouch.py", line 163, in GetSupportedCoolingModesForAc
    return self.acs[acNumber].ModeSupported;
AttributeError: 'AirTouchAc' object has no attribute 'ModeSupported'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/airtouch4/climate.py", line 335, in async_turn_off
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 141, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 78, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 165, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/components/airtouch4/climate.py", line 97, in _handle_coordinator_update
    return super()._handle_coordinator_update()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 210, in state
    return self.hvac_mode
  File "/usr/src/homeassistant/homeassistant/components/airtouch4/climate.py", line 138, in hvac_mode
    is_off = self._unit.PowerState == "Off"
AttributeError: 'AirTouchAc' object has no attribute 'PowerState'