hass-cozytouch icon indicating copy to clipboard operation
hass-cozytouch copied to clipboard

KeyError with Thermor heaters and version 1.5.7

Open browetd opened this issue 4 years ago • 7 comments

I investigated a little bit further the problem I have with version 1.5 (last working version: 1.4.4) and my Thermor heaters "Equateur" (it is even crashing the heater at some point (no possibility to change the temperature anymore for example, directly on the heater or via the cozytouch app, a reset to factory default is necessary and a new definition in the app):

  • if my heaters are on when HA starts, they are recognized and the entities are defined correctly
  • if my heaters are off or in frostprotection, I have an error message (see below or in the previous I closed yesterday thinking everything was back ... ) when HA starts and the climate entities are not created (the others IO entities type work fine) : return COZY_TO_PRESET_MODE[preset] KeyError: 'off' or return COZY_TO_PRESET_MODE[preset] KeyError: 'frostprotection'

The current temperature of the room between the cozytouch app and the entity in HA are not the same neither.

If the entities are up and I want to change the state using the three buttons on the entity (see uploaded image), here is the error message I am getting: first message with the left button, second with the "flame" button and third with the "on/off" button :

2020-06-19 17:03:01 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'internal' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-06-19 17:03:32 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'basic' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-06-19 17:01:01 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'standby' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program']

Sans titre

Let me know if I have to do additional tests...

browetd avatar Jun 19 '20 15:06 browetd

Here is a view of the characteristics of the entity:

climate.salle_de_bain_bas_heater off hvac_modes: heat, auto, off min_temp: 7 max_temp: 35 target_temp_step: 0.5 preset_modes: Comfort, Comfort 1, Comfort 2, Eco, Secured, Frostprotection current_temperature: 20 target_temp_high: 19 target_temp_low: 15.5 preset_mode: Comfort preset: comfort presets: boost, comfort, comfort-1, comfort-2, eco, frostprotection, off, secured mode: standby modes: antifreeze, auto, away, eco, frostprotection, manual, max, normal, off, on, prog, program friendly_name: Salle de Bain bas supported_features: 18

browetd avatar Jun 19 '20 16:06 browetd

Problems still exist with version 1.5.7... last working version for me is 1.4.4

browetd avatar Aug 22 '20 07:08 browetd

Continuing test with version 1.5.7... If I remove and reinstall the integration using HACS, the three entities discovered are named at startup: climate.radiateur, climate.radiateur_1 and climate.radiateur_2. There are in this case in the state "unavailable" but if I rename those entities within HA and name them with the convention: "climate." followed by their name in cozytouch with "_" between words and finally followed by "_heater"... They are working but still with a lot of Keyerror messages around "off", "internal", "basic", "standby" and "frostprotection"... Example of correct naming rules : the radiator called "chambre thomas" in cozytouch must be renamed in HA to: "climate.chambre_thomas_heater"... Another bizarre thing in the error message: the integration is using the "init.py" of the HA package (/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/climate/__init__.py) rather than I think "/home/homeassistant/.homeassistant/custom_components/cozytouch/__init__.py" but maybe this is correct I do not know. An example of the error message with keyerror "off":

2020-08-24 23:11: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 192, in _async_setup_platform await asyncio.gather(*pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities await asyncio.gather(*tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 474, in _async_add_entity entity.async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 281, in async_write_ha_state self._async_write_ha_state() File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 307, 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 avatar Aug 25 '20 06:08 browetd

@Cyr-ius I looked at the program and to fix my issues I modified three lines in the const.py file of cozytouch 1.5.7 (I am absolutely not an expert in python). I replaced "stop" by "off" in PRESET_STOP and replaced "frostection" by "frostprotection".
Here are the lines I modified below (highlighted), now it is working (except that I still have warning messages about the temperature format and the word "internal" does not exist in a list of mode) but at least it is working as expected for me (no error message at startup and entities are available even if they are "off"):

PRESET_MODE_TO_COZY = { PRESET_AUTO: "auto", PRESET_AWAY: "absence", PRESET_BOOST: "boost", PRESET_COMFORT: "comfort", PRESET_COMFORT1: "comfort-1", PRESET_COMFORT2: "comfort-1", PRESET_ECO: "eco", PRESET_EXTERNAL: "externalScheduling", PRESET_FROSTPROTECTION: "frostprotection", PRESET_INTERNAL: "internalScheduling", PRESET_MANU: "manu", PRESET_SECURED: "secured", PRESET_SECURED: "secured", PRESET_STOP: "off", }

COZY_TO_PRESET_MODE = { "absence": PRESET_AWAY, "auto": PRESET_AUTO, "boost": PRESET_BOOST, "comfort-1": PRESET_COMFORT1, "comfort-2": PRESET_COMFORT2, "comfort": PRESET_COMFORT, "eco": PRESET_ECO, "externalScheduling": PRESET_EXTERNAL, "frostprotection": PRESET_FROSTPROTECTION, "internalScheduling": PRESET_INTERNAL, "manu": PRESET_MANU, "secured": PRESET_SECURED, "off": PRESET_STOP, }

browetd avatar Aug 25 '20 20:08 browetd

Here are the remaining errors (Warnings) I have but this is not preventing the integration to work as expected for me:

2020-08-26 10:48:45 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 21.0 2020-08-26 10:48:45 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 2.0 2020-08-26 10:48:45 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 3.0 2020-08-26 10:48:56 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 21.0 2020-08-26 10:48:56 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 2.0 2020-08-26 10:48:56 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 2.0 2020-08-26 10:49:06 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'standby' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-08-26 10:49:06 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'standby' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-08-26 10:49:06 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'standby' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-08-26 10:49:42 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'internal' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-08-26 10:49:45 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 21.0 2020-08-26 10:49:45 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 2.0 2020-08-26 10:49:45 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 2.0 2020-08-26 10:49:46 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'internal' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program'] 2020-08-26 10:49:48 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 19.0 2020-08-26 10:49:48 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 3.0 2020-08-26 10:49:48 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported Integer 3.0 2020-08-26 10:49:49 WARNING (MainThread) [cozytouchpy.objects.device] Unsupported 'standby' value in ['antifreeze', 'auto', 'away', 'eco', 'frostprotection', 'manual', 'max', 'normal', 'off', 'on', 'prog', 'program']

browetd avatar Aug 26 '20 08:08 browetd

same problem and it's impossible for me too set correctly 'target_temp_low: ' in scene

uowis avatar Feb 08 '21 18:02 uowis

https://github.com/Cyr-ius/hass-cozytouch/issues/16#issuecomment-680266287

That solved it for me. Thanks @browetd !

PierrePetit avatar Sep 01 '21 16:09 PierrePetit