Pyhass / Hive-Custom-Component

A custom version of the home assistant hive component
MIT License
33 stars 17 forks source link

[BUG] hive.boost_heating_on when invoked on TRV produces errors #109

Closed ovid-io closed 2 years ago

ovid-io commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behaviour:

Call hive.boost_heating_on on a TRV entity

service: hive.boost_heating_on
data:
  entity_id: climate.office
  time_period: '00:15:00'
  temperature: 30

Expected behaviour Boost is invoked

Screenshots N/A

Desktop (please complete the following information):

Additional context

The errors below appear in the logs, however boost is actually invoked on Hive side, however sometimes with random temperature setting. Also Mode entity has a value Unknown instead of MANUAL or OFF, I guess it's supposed to be BOOST

2021-12-15 00:48:08 ERROR (MainThread) [homeassistant.util.logging] Exception in async_write_ha_state when dispatching 'hive': ()

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 486, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, 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/hive/climate.py", line 161, in hvac_mode
    return HIVE_TO_HASS_STATE[self.device["status"]["mode"]]
KeyError: None

2021-12-15 00:48:17.818 | ERROR    | apyhiveapi.helper.logger:error:16 - An unexpected error has occurred whilst executing getMode with exception <class 'KeyError'> 'mode'

2021-12-15 00:48:17 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 728, in _update_entity_states
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 473, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 492, 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/hive/climate.py", line 161, in hvac_mode
    return HIVE_TO_HASS_STATE[self.device["status"]["mode"]]
KeyError: None

2021-12-15 00:48:17.847 | ERROR    | apyhiveapi.helper.logger:error:16 - An unexpected error has occurred whilst executing getMode with exception <class 'KeyError'> 'mode'

2021-12-15 00:48:17.850 | ERROR    | apyhiveapi.helper.logger:error:16 - An unexpected error has occurred whilst executing getMode with exception <class 'KeyError'> 'mode'

2021-12-15 00:48:17.852 | ERROR    | apyhiveapi.helper.logger:error:16 - An unexpected error has occurred whilst executing getMode with exception <class 'KeyError'> 'mode'
KJonline commented 2 years ago

Can this be retested on the latest version and re-open if its still an issue