cyr-ius / hass-cozytouch

Cozytouch support for Home Assistant
GNU General Public License v2.0
23 stars 14 forks source link

Unexpected error on climate #14

Open jugla opened 4 years ago

jugla commented 4 years ago

Hello Cyr-ius, When I use the latest version 1.5.1, on my 6 "climate (heater)", I've lost one. In logs , I see : 2020-06-13 00:37:46 ERROR (MainThread) [homeassistant.components.climate] Error while setting up cozytouch platform for climate Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform await asyncio.gather(*pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities await asyncio.gather(*tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity entity.async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 297, in async_write_ha_state self._async_write_ha_state() # type: ignore File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state state = self.state File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/__init__.py", line 173, in state return self.hvac_mode File "/home/homeassistant/.homeassistant/custom_components/cozytouch/climate.py", line 177, in hvac_mode return HEATER_TO_HVAC_MODE[self.climate.operating_mode] KeyError: 'auto'

jugla commented 4 years ago

Thanks in advance Philippe

jugla commented 4 years ago

For information, the sensor (in particular temperature) are well detected.

jugla commented 4 years ago

I think, the mode called "auto", it's not well handled. I have 1 heater in "auto" mode.

cyr-ius commented 4 years ago

Please update to 1.5.2

jugla commented 4 years ago

Hello, Thanks for the reactivity.

Sorry, I still get 2020-06-13 18:38:12 ERROR (MainThread) [homeassistant.components.climate] Error while setting up cozytouch platform for climate Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform await asyncio.gather(*pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities await asyncio.gather(*tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity entity.async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 297, in async_write_ha_state self._async_write_ha_state() # type: ignore File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state state = self.state File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/__init__.py", line 173, in state return self.hvac_mode File "/home/homeassistant/.homeassistant/custom_components/cozytouch/climate.py", line 177, in hvac_mode return HEATER_TO_HVAC_MODE[self.climate.operating_mode] KeyError: 'auto'

browetd commented 4 years ago

@jugla Seems to be the same type of error I am having too... I had the problem "Keyerror: 'standby'" and now I upgraded to 1.5.2 I have an error "Keyerror: 'off'"... I opened a couple of days ago an issue as well to report those errors...

cyr-ius commented 4 years ago

@jugla Seems to be the same type of error I am having too... I had the problem "Keyerror: 'standby'" and now I upgraded to 1.5.2 I have an error "Keyerror: 'off'"... I opened a couple of days ago an issue as well to report those errors...

Please up to 1.5.3

browetd commented 4 years ago

@Cyr-ius Now I am getting this error 1.5.5

2020-06-14 17:57:59 ERROR (MainThread) [homeassistant.components.climate] Error while setting up cozytouch platform for climate Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform await asyncio.gather(pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities await asyncio.gather(tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity entity.async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 297, in async_write_ha_state self._async_write_ha_state() # type: ignore File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/init.py", line 262, in state_attributes data[ATTR_PRESET_MODE] = self.preset_mode File "/home/homeassistant/.homeassistant/custom_components/cozytouch/climate.py", line 199, in preset_mode return COZY_TO_PRESET_MODE[preset] KeyError: 'off'

jugla commented 4 years ago

Hello, With the last release 1.5.5, it's ok. NB: All my climate have got the same basename "radiateur_#" where # goes up to 6. I've seen all. In my case no more exception. thanks

Hoping, there will be a solution for browetd

cyr-ius commented 4 years ago

@browetd Can you confirm that this happens when you switch the operation to OFF and not the preselection ?

ptimatth commented 4 years ago

Hi, Same issue of @browetd here,

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities
    await asyncio.gather(*tasks)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
    entity.async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 297, in async_write_ha_state
    self._async_write_ha_state()  # type: ignore
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/__init__.py", line 262, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/home/homeassistant/custom_components/cozytouch/climate.py", line 199, in preset_mode
    return COZY_TO_PRESET_MODE[preset]
KeyError: 'off'

issue appear when i start my home-assistant, All my climate is off.

i'm in 1.5.5

ptimatth commented 4 years ago

After turn on all my heater, same issue after reboot.

browetd commented 4 years ago

@Cyr-ius Same as @ptimatth ... All my heaters are off and the problem appears when HA is starting (so I am not trying to change heater status or switching on or off)... Cozytouch is not available after startup... all entities are unavailable after startup as well...

browetd commented 4 years ago

@Cyr-ius Same error with 1.5.6... See below

2020-06-15 10:57:24 ERROR (MainThread) [homeassistant.components.climate] Error while setting up cozytouch platform for climate Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform await asyncio.gather(pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities await asyncio.gather(tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity entity.async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 297, in async_write_ha_state self._async_write_ha_state() # type: ignore File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/init.py", line 262, in state_attributes data[ATTR_PRESET_MODE] = self.preset_mode File "/home/homeassistant/.homeassistant/custom_components/cozytouch/climate.py", line 199, in preset_mode return COZY_TO_PRESET_MODE[preset] KeyError: 'off'

browetd commented 4 years ago

@Cyr-ius Here is the complete log when HA starts:

2020-06-15 16:00:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experien$ 2020-06-15 16:00:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for cozytouch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you exp$ 2020-06-15 16:00:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experi$ 2020-06-15 16:00:48 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for rpi_power which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you exp$ 2020-06-15 16:00:53 ERROR (MainThread) [homeassistant.components.climate] Error while setting up cozytouch platform for climate Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform await asyncio.gather(pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities await asyncio.gather(tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity entity.async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 297, in async_write_ha_state self._async_write_ha_state() # type: ignore File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/init.py", line 262, in state_attributes data[ATTR_PRESET_MODE] = self.preset_mode File "/home/homeassistant/.homeassistant/custom_components/cozytouch/climate.py", line 199, in preset_mode return COZY_TO_PRESET_MODE[preset] KeyError: 'off' 2020-06-15 16:00:58 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform tplink is taking over 10 seconds. 2020-06-15 16:01:48 ERROR (MainThread) [homeassistant.components.switch] Setup of platform tplink is taking longer than 60 seconds. Startup will proceed without waiting any longer. 2020-06-15 16:01:53 ERROR (MainThread) [homeassistant.components.automation] mqtt_switch_salon: Error executing script. Service not found for call_service at pos 1: Unable to find service switch/turn_unavailable

browetd commented 4 years ago

@Cyr-ius #16 These two issues are linked and describe the same problem... see issue #16 and my recent comment/tests on the cozytouch behaviour...

browetd commented 4 years ago

@ptimatth I fixed my problems by modifying 3 lines in $config/custom_components/cozytouch/const.py (see issue #16)

ptimatth commented 4 years ago

@browetd, yes, it works also for me, thanks for the trick, i haven't search any solution for a while. Can you make a pull request to integrate this change on the next revision please ?

image

browetd commented 4 years ago

@ptimatth Will do... I also changed a little bit the const.py again to add a new preset mode PRESET_NONE so I am not touching the PRESET_STOP parameters (I am not sure if this is used somewhere or not so I preferred to add a new one) and the indication when off is becoming "Inactif-None" instead of "Inactif-Stop"... but I still have warning messages when I change state from "off" to "auto" for example or changing temperature of the heaters (see issue #16), but these are just warnings not impacting the behavior of the integration. It is working as expected for me. I will submit the pull_request with all the changes but including the PRESET_NONE addition instead of PRESET_STOP... Cheers !

browetd commented 4 years ago

@ptimatth Submitted... Not sure I did it the right way as this is my first pull request...

ptimatth commented 3 years ago

@browetd, i don't see your pull request anymore, so i have made a new one #23

browetd commented 3 years ago

@ptimatth Thanks...