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
74.05k stars 31.08k forks source link

Homematic HM-CC-TC not recognized #25455

Closed DSchumacher2104 closed 5 years ago

DSchumacher2104 commented 5 years ago

Home Assistant release with the issue: 0.96.4

Last working Home Assistant release (if known): 0.95.x

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Component/platform: Homematic

Description of problem: Since Update to HA 0.96 my old Homematic Thermostat HM-CC-TC is not found as a climate-entity anymore. The device is only recognized as a temperature and humidity sensor. With HA 0.95 is worked perfect!

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

homematic:
  interfaces:
    rf:
      host: 192.168.10.41
      resolvenames: json

Traceback (if applicable):

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 256, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 213, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_controll_mode]
  File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 181, in _hm_controll_mode
    return self._data['CONTROL_MODE']
KeyError: 'CONTROL_MODE'

Additional information:

ghost commented 5 years ago

Hey there @pvizeli, @danielperna84, mind taking a look at this issue as its been labeled with a integration (homematic) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

baschno commented 5 years ago

+1 I'm also encountering that issue. Related to HM-CC-TC devices.

JakobTewes commented 5 years ago

+1 Same problem here. Generation 2 (HM-CC-RT-DN) gets recognised correctly.

terveer commented 5 years ago

+1 At least this happened during a heat wave ;-)

xerxes87 commented 5 years ago

+1 same here

jps64 commented 5 years ago

+1 I believe it is related to pyhomematic/device_types/thermostats.py... All thermostats except the HM-CC-TC got a CONTROL_MODE or SET_POINT_MODE key with the update of the new climate component. It seems HM-CC-TC's operating modes "Manu", Auto, Cent and Prog are all internal and cannot be accessed.

JakobTewes commented 5 years ago

Was using FHEM long time ago. With FHEM I‘ve set the modes, that you are talking about. FHEM wiki states, that „manu“, „auto“ and „cent“ can be set. I personally am in no need for those modes, as I use HA to control the heating...

jps64 commented 5 years ago

fhem - I remember, long time ago... But I found where it is. Many HM devices have a VALUES and a MASTER param set. Channel :2 of a HM-CC-TC also has a MASTER param set. getParamset("GEQ0004703:2", "MASTER", 0) returns { "DECALCIFICATION_DAY": 0, "DECALCIFICATION_HOUR": 11, "DECALCIFICATION_MINUTE": 0, "DISPLAY_TEMPERATUR_HUMIDITY_CHANGE": 1, "DISPLAY_TEMPERATUR_INFORMATION": 0, "DISPLAY_TEMPERATUR_UNIT": 0, "MODE_TEMPERATUR_REGULATOR": 0, "MODE_TEMPERATUR_VALVE": 0, "PARTY_END_TIME": 0, "TEMPERATUR_COMFORT_VALUE": 21, "TEMPERATUR_FRIDAY_1": 17, "TEMPERATUR_FRIDAY_10": 20, "TEMPERATUR_FRIDAY_11": 20, "TEMPERATUR_FRIDAY_12": 20, "TEMPERATUR_FRIDAY_13": 20, "TEMPERATUR_FRIDAY_14": 20, "TEMPERATUR_FRIDAY_15": 20, "TEMPERATUR_FRIDAY_16": 20, "TEMPERATUR_FRIDAY_17": 20, "TEMPERATUR_FRIDAY_18": 20, "TEMPERATUR_FRIDAY_19": 20, "TEMPERATUR_FRIDAY_2": 21, "TEMPERATUR_FRIDAY_20": 20, "TEMPERATUR_FRIDAY_21": 20, "TEMPERATUR_FRIDAY_22": 20, "TEMPERATUR_FRIDAY_23": 20, "TEMPERATUR_FRIDAY_24": 20, "TEMPERATUR_FRIDAY_3": 21, "TEMPERATUR_FRIDAY_4": 17, "TEMPERATUR_FRIDAY_5": 20, "TEMPERATUR_FRIDAY_6": 20, "TEMPERATUR_FRIDAY_7": 20, "TEMPERATUR_FRIDAY_8": 20, "TEMPERATUR_FRIDAY_9": 20, "TEMPERATUR_LOWERING_VALUE": 17, "TEMPERATUR_MONDAY_1": 17, "TEMPERATUR_MONDAY_10": 20, "TEMPERATUR_MONDAY_11": 20, "TEMPERATUR_MONDAY_12": 20, "TEMPERATUR_MONDAY_13": 20, "TEMPERATUR_MONDAY_14": 20, "TEMPERATUR_MONDAY_15": 20, "TEMPERATUR_MONDAY_16": 20, "TEMPERATUR_MONDAY_17": 20, "TEMPERATUR_MONDAY_18": 20, "TEMPERATUR_MONDAY_19": 20, "TEMPERATUR_MONDAY_2": 21, "TEMPERATUR_MONDAY_20": 20, "TEMPERATUR_MONDAY_21": 20, "TEMPERATUR_MONDAY_22": 20, "TEMPERATUR_MONDAY_23": 20, "TEMPERATUR_MONDAY_24": 20, "TEMPERATUR_MONDAY_3": 21, "TEMPERATUR_MONDAY_4": 17, "TEMPERATUR_MONDAY_5": 20, "TEMPERATUR_MONDAY_6": 20, "TEMPERATUR_MONDAY_7": 20, "TEMPERATUR_MONDAY_8": 20, "TEMPERATUR_MONDAY_9": 20, "TEMPERATUR_PARTY_VALUE": 20, "TEMPERATUR_SATURDAY_1": 17, "TEMPERATUR_SATURDAY_10": 20, "TEMPERATUR_SATURDAY_11": 20, "TEMPERATUR_SATURDAY_12": 20, "TEMPERATUR_SATURDAY_13": 20, "TEMPERATUR_SATURDAY_14": 20, "TEMPERATUR_SATURDAY_15": 20, "TEMPERATUR_SATURDAY_16": 20, "TEMPERATUR_SATURDAY_17": 20, "TEMPERATUR_SATURDAY_18": 20, "TEMPERATUR_SATURDAY_19": 20, "TEMPERATUR_SATURDAY_2": 21, "TEMPERATUR_SATURDAY_20": 20, "TEMPERATUR_SATURDAY_21": 20, "TEMPERATUR_SATURDAY_22": 20, "TEMPERATUR_SATURDAY_23": 20, "TEMPERATUR_SATURDAY_24": 20, "TEMPERATUR_SATURDAY_3": 21, "TEMPERATUR_SATURDAY_4": 17, "TEMPERATUR_SATURDAY_5": 20, "TEMPERATUR_SATURDAY_6": 20, "TEMPERATUR_SATURDAY_7": 20, "TEMPERATUR_SATURDAY_8": 20, "TEMPERATUR_SATURDAY_9": 20, "TEMPERATUR_SUNDAY_1": 17, "TEMPERATUR_SUNDAY_10": 20, "TEMPERATUR_SUNDAY_11": 20, "TEMPERATUR_SUNDAY_12": 20, "TEMPERATUR_SUNDAY_13": 20, "TEMPERATUR_SUNDAY_14": 20, "TEMPERATUR_SUNDAY_15": 20, "TEMPERATUR_SUNDAY_16": 20, "TEMPERATUR_SUNDAY_17": 20, "TEMPERATUR_SUNDAY_18": 20, "TEMPERATUR_SUNDAY_19": 20, "TEMPERATUR_SUNDAY_2": 21, "TEMPERATUR_SUNDAY_20": 20, "TEMPERATUR_SUNDAY_21": 20, "TEMPERATUR_SUNDAY_22": 20, "TEMPERATUR_SUNDAY_23": 20, "TEMPERATUR_SUNDAY_24": 20, "TEMPERATUR_SUNDAY_3": 21, "TEMPERATUR_SUNDAY_4": 17, "TEMPERATUR_SUNDAY_5": 20, "TEMPERATUR_SUNDAY_6": 20, "TEMPERATUR_SUNDAY_7": 20, "TEMPERATUR_SUNDAY_8": 20, "TEMPERATUR_SUNDAY_9": 20, "TEMPERATUR_THURSDAY_1": 17, "TEMPERATUR_THURSDAY_10": 20, "TEMPERATUR_THURSDAY_11": 20, "TEMPERATUR_THURSDAY_12": 20, "TEMPERATUR_THURSDAY_13": 20, "TEMPERATUR_THURSDAY_14": 20, "TEMPERATUR_THURSDAY_15": 20, "TEMPERATUR_THURSDAY_16": 20, "TEMPERATUR_THURSDAY_17": 20, "TEMPERATUR_THURSDAY_18": 20, "TEMPERATUR_THURSDAY_19": 20, "TEMPERATUR_THURSDAY_2": 21, "TEMPERATUR_THURSDAY_20": 20, "TEMPERATUR_THURSDAY_21": 20, "TEMPERATUR_THURSDAY_22": 20, "TEMPERATUR_THURSDAY_23": 20, "TEMPERATUR_THURSDAY_24": 20, "TEMPERATUR_THURSDAY_3": 21, "TEMPERATUR_THURSDAY_4": 17, "TEMPERATUR_THURSDAY_5": 20, "TEMPERATUR_THURSDAY_6": 20, "TEMPERATUR_THURSDAY_7": 20, "TEMPERATUR_THURSDAY_8": 20, "TEMPERATUR_THURSDAY_9": 20, "TEMPERATUR_TUESDAY_1": 17, "TEMPERATUR_TUESDAY_10": 20, "TEMPERATUR_TUESDAY_11": 20, "TEMPERATUR_TUESDAY_12": 20, "TEMPERATUR_TUESDAY_13": 20, "TEMPERATUR_TUESDAY_14": 20, "TEMPERATUR_TUESDAY_15": 20, "TEMPERATUR_TUESDAY_16": 20, "TEMPERATUR_TUESDAY_17": 20, "TEMPERATUR_TUESDAY_18": 20, "TEMPERATUR_TUESDAY_19": 20, "TEMPERATUR_TUESDAY_2": 21, "TEMPERATUR_TUESDAY_20": 20, "TEMPERATUR_TUESDAY_21": 20, "TEMPERATUR_TUESDAY_22": 20, "TEMPERATUR_TUESDAY_23": 20, "TEMPERATUR_TUESDAY_24": 20, "TEMPERATUR_TUESDAY_3": 21, "TEMPERATUR_TUESDAY_4": 17, "TEMPERATUR_TUESDAY_5": 20, "TEMPERATUR_TUESDAY_6": 20, "TEMPERATUR_TUESDAY_7": 20, "TEMPERATUR_TUESDAY_8": 20, "TEMPERATUR_TUESDAY_9": 20, "TEMPERATUR_WEDNESDAY_1": 17, "TEMPERATUR_WEDNESDAY_10": 20, "TEMPERATUR_WEDNESDAY_11": 20, "TEMPERATUR_WEDNESDAY_12": 20, "TEMPERATUR_WEDNESDAY_13": 20, "TEMPERATUR_WEDNESDAY_14": 20, "TEMPERATUR_WEDNESDAY_15": 20, "TEMPERATUR_WEDNESDAY_16": 20, "TEMPERATUR_WEDNESDAY_17": 20, "TEMPERATUR_WEDNESDAY_18": 20, "TEMPERATUR_WEDNESDAY_19": 20, "TEMPERATUR_WEDNESDAY_2": 21, "TEMPERATUR_WEDNESDAY_20": 20, "TEMPERATUR_WEDNESDAY_21": 20, "TEMPERATUR_WEDNESDAY_22": 20, "TEMPERATUR_WEDNESDAY_23": 20, "TEMPERATUR_WEDNESDAY_24": 20, "TEMPERATUR_WEDNESDAY_3": 21, "TEMPERATUR_WEDNESDAY_4": 17, "TEMPERATUR_WEDNESDAY_5": 20, "TEMPERATUR_WEDNESDAY_6": 20, "TEMPERATUR_WEDNESDAY_7": 20, "TEMPERATUR_WEDNESDAY_8": 20, "TEMPERATUR_WEDNESDAY_9": 20, "TIMEOUT_FRIDAY_1": 360, "TIMEOUT_FRIDAY_10": 1440, "TIMEOUT_FRIDAY_11": 1440, "TIMEOUT_FRIDAY_12": 1440, "TIMEOUT_FRIDAY_13": 1440, "TIMEOUT_FRIDAY_14": 1440, "TIMEOUT_FRIDAY_15": 1440, "TIMEOUT_FRIDAY_16": 1440, "TIMEOUT_FRIDAY_17": 1440, "TIMEOUT_FRIDAY_18": 1440, "TIMEOUT_FRIDAY_19": 1440, "TIMEOUT_FRIDAY_2": 720, "TIMEOUT_FRIDAY_20": 1440, "TIMEOUT_FRIDAY_21": 1440, "TIMEOUT_FRIDAY_22": 1440, "TIMEOUT_FRIDAY_23": 1440, "TIMEOUT_FRIDAY_24": 1440, "TIMEOUT_FRIDAY_3": 1380, "TIMEOUT_FRIDAY_4": 1440, "TIMEOUT_FRIDAY_5": 1440, "TIMEOUT_FRIDAY_6": 1440, "TIMEOUT_FRIDAY_7": 1440, "TIMEOUT_FRIDAY_8": 1440, "TIMEOUT_FRIDAY_9": 1440, "TIMEOUT_MONDAY_1": 360, "TIMEOUT_MONDAY_10": 1440, "TIMEOUT_MONDAY_11": 1440, "TIMEOUT_MONDAY_12": 1440, "TIMEOUT_MONDAY_13": 1440, "TIMEOUT_MONDAY_14": 1440, "TIMEOUT_MONDAY_15": 1440, "TIMEOUT_MONDAY_16": 1440, "TIMEOUT_MONDAY_17": 1440, "TIMEOUT_MONDAY_18": 1440, "TIMEOUT_MONDAY_19": 1440, "TIMEOUT_MONDAY_2": 720, "TIMEOUT_MONDAY_20": 1440, "TIMEOUT_MONDAY_21": 1440, "TIMEOUT_MONDAY_22": 1440, "TIMEOUT_MONDAY_23": 1440, "TIMEOUT_MONDAY_24": 1440, "TIMEOUT_MONDAY_3": 1380, "TIMEOUT_MONDAY_4": 1440, "TIMEOUT_MONDAY_5": 1440, "TIMEOUT_MONDAY_6": 1440, "TIMEOUT_MONDAY_7": 1440, "TIMEOUT_MONDAY_8": 1440, "TIMEOUT_MONDAY_9": 1440, "TIMEOUT_SATURDAY_1": 360, "TIMEOUT_SATURDAY_10": 1440, "TIMEOUT_SATURDAY_11": 1440, "TIMEOUT_SATURDAY_12": 1440, "TIMEOUT_SATURDAY_13": 1440, "TIMEOUT_SATURDAY_14": 1440, "TIMEOUT_SATURDAY_15": 1440, "TIMEOUT_SATURDAY_16": 1440, "TIMEOUT_SATURDAY_17": 1440, "TIMEOUT_SATURDAY_18": 1440, "TIMEOUT_SATURDAY_19": 1440, "TIMEOUT_SATURDAY_2": 720, "TIMEOUT_SATURDAY_20": 1440, "TIMEOUT_SATURDAY_21": 1440, "TIMEOUT_SATURDAY_22": 1440, "TIMEOUT_SATURDAY_23": 1440, "TIMEOUT_SATURDAY_24": 1440, "TIMEOUT_SATURDAY_3": 1380, "TIMEOUT_SATURDAY_4": 1440, "TIMEOUT_SATURDAY_5": 1440, "TIMEOUT_SATURDAY_6": 1440, "TIMEOUT_SATURDAY_7": 1440, "TIMEOUT_SATURDAY_8": 1440, "TIMEOUT_SATURDAY_9": 1440, "TIMEOUT_SUNDAY_1": 360, "TIMEOUT_SUNDAY_10": 1440, "TIMEOUT_SUNDAY_11": 1440, "TIMEOUT_SUNDAY_12": 1440, "TIMEOUT_SUNDAY_13": 1440, "TIMEOUT_SUNDAY_14": 1440, "TIMEOUT_SUNDAY_15": 1440, "TIMEOUT_SUNDAY_16": 1440, "TIMEOUT_SUNDAY_17": 1440, "TIMEOUT_SUNDAY_18": 1440, "TIMEOUT_SUNDAY_19": 1440, "TIMEOUT_SUNDAY_2": 720, "TIMEOUT_SUNDAY_20": 1440, "TIMEOUT_SUNDAY_21": 1440, "TIMEOUT_SUNDAY_22": 1440, "TIMEOUT_SUNDAY_23": 1440, "TIMEOUT_SUNDAY_24": 1440, "TIMEOUT_SUNDAY_3": 1380, "TIMEOUT_SUNDAY_4": 1440, "TIMEOUT_SUNDAY_5": 1440, "TIMEOUT_SUNDAY_6": 1440, "TIMEOUT_SUNDAY_7": 1440, "TIMEOUT_SUNDAY_8": 1440, "TIMEOUT_SUNDAY_9": 1440, "TIMEOUT_THURSDAY_1": 360, "TIMEOUT_THURSDAY_10": 1440, "TIMEOUT_THURSDAY_11": 1440, "TIMEOUT_THURSDAY_12": 1440, "TIMEOUT_THURSDAY_13": 1440, "TIMEOUT_THURSDAY_14": 1440, "TIMEOUT_THURSDAY_15": 1440, "TIMEOUT_THURSDAY_16": 1440, "TIMEOUT_THURSDAY_17": 1440, "TIMEOUT_THURSDAY_18": 1440, "TIMEOUT_THURSDAY_19": 1440, "TIMEOUT_THURSDAY_2": 720, "TIMEOUT_THURSDAY_20": 1440, "TIMEOUT_THURSDAY_21": 1440, "TIMEOUT_THURSDAY_22": 1440, "TIMEOUT_THURSDAY_23": 1440, "TIMEOUT_THURSDAY_24": 1440, "TIMEOUT_THURSDAY_3": 1380, "TIMEOUT_THURSDAY_4": 1440, "TIMEOUT_THURSDAY_5": 1440, "TIMEOUT_THURSDAY_6": 1440, "TIMEOUT_THURSDAY_7": 1440, "TIMEOUT_THURSDAY_8": 1440, "TIMEOUT_THURSDAY_9": 1440, "TIMEOUT_TUESDAY_1": 360, "TIMEOUT_TUESDAY_10": 1440, "TIMEOUT_TUESDAY_11": 1440, "TIMEOUT_TUESDAY_12": 1440, "TIMEOUT_TUESDAY_13": 1440, "TIMEOUT_TUESDAY_14": 1440, "TIMEOUT_TUESDAY_15": 1440, "TIMEOUT_TUESDAY_16": 1440, "TIMEOUT_TUESDAY_17": 1440, "TIMEOUT_TUESDAY_18": 1440, "TIMEOUT_TUESDAY_19": 1440, "TIMEOUT_TUESDAY_2": 720, "TIMEOUT_TUESDAY_20": 1440, "TIMEOUT_TUESDAY_21": 1440, "TIMEOUT_TUESDAY_22": 1440, "TIMEOUT_TUESDAY_23": 1440, "TIMEOUT_TUESDAY_24": 1440, "TIMEOUT_TUESDAY_3": 1380, "TIMEOUT_TUESDAY_4": 1440, "TIMEOUT_TUESDAY_5": 1440, "TIMEOUT_TUESDAY_6": 1440, "TIMEOUT_TUESDAY_7": 1440, "TIMEOUT_TUESDAY_8": 1440, "TIMEOUT_TUESDAY_9": 1440, "TIMEOUT_WEDNESDAY_1": 360, "TIMEOUT_WEDNESDAY_10": 1440, "TIMEOUT_WEDNESDAY_11": 1440, "TIMEOUT_WEDNESDAY_12": 1440, "TIMEOUT_WEDNESDAY_13": 1440, "TIMEOUT_WEDNESDAY_14": 1440, "TIMEOUT_WEDNESDAY_15": 1440, "TIMEOUT_WEDNESDAY_16": 1440, "TIMEOUT_WEDNESDAY_17": 1440, "TIMEOUT_WEDNESDAY_18": 1440, "TIMEOUT_WEDNESDAY_19": 1440, "TIMEOUT_WEDNESDAY_2": 720, "TIMEOUT_WEDNESDAY_20": 1440, "TIMEOUT_WEDNESDAY_21": 1440, "TIMEOUT_WEDNESDAY_22": 1440, "TIMEOUT_WEDNESDAY_23": 1440, "TIMEOUT_WEDNESDAY_24": 1440, "TIMEOUT_WEDNESDAY_3": 1380, "TIMEOUT_WEDNESDAY_4": 1440, "TIMEOUT_WEDNESDAY_5": 1440, "TIMEOUT_WEDNESDAY_6": 1440, "TIMEOUT_WEDNESDAY_7": 1440, "TIMEOUT_WEDNESDAY_8": 1440, "TIMEOUT_WEDNESDAY_9": 1440 } And "MODE_TEMPERATUR_REGULATOR" is the key where 0=Manu, 1=Auto, 2=Cent Eventually these are equivalent to the CONTROL_MODE values here?

Nic0205 commented 5 years ago

Are there any news or workarounds for this problem?

danielperna84 commented 5 years ago

Since I don't have the device I can't test it. But a possible workaround could be to change return self._data['CONTROL_MODE'] to return self._data.get('CONTROL_MODE') in line 181 of homeassistant/components/homematic/climate.py. That would bypass the exception reported in the opening post. But I can't estimate which effect this will have. Feel free to give it a try and report what your results are. 👍

Nic0205 commented 5 years ago

Hi, thanks for replying.

I tried the above mentioned code. Now the log says:

  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 181
    return self._data.get('CONTROL_MODE')
                                        ^
TabError: inconsistent use of tabs and spaces in indentation

There is still no climate entity.

I could do any testings that may help - just tell me what to do ;-)

Would a complete log Help for further investigation?

Nic0205 commented 5 years ago

Addition: I tried changing the code again and now the log says:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 402, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 285, 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 246, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
KeyError: None
2019-08-13 19:48:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 402, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 285, 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 246, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
KeyError: None
2019-08-13 19:48:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 402, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 285, 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 246, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
KeyError: None
2019-08-13 19:48:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 402, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 285, 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 246, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
KeyError: None
danielperna84 commented 5 years ago
File "/srv/homeassistant/lib/python3.7/sitepackages/homeassistant/components/homematic/climate.py", line 181 return self._data.get('CONTROL_MODE') ^ TabError: inconsistent use of tabs and spaces in indentation

You messed up the whitespace. In Python a tab is different from 4 blanks. It has to be consistent within the file.

Apparently a correct mode needs to be returned. With the solution I have posted None is being returned. Change the code to this (at the same place I have talked about before): return self._data.get('CONTROL_MODE', HVAC_MODE_HEAT). That way it will always be in heating mode. I don't know what an appropriate solution would look like. But I assume what corresponds to the heating mode form Home Assistant is a device that's turned on. If you set a low target temperature that should't be an issue while it's still warm outside.

pvizeli commented 5 years ago

That is correct, this kind of device are HVAC_MODE_HEAT all time. That is the mode of climate device and not the current action. New generation of HmIP can also support cooling, but that is currently not implemented and work only with new floorheating system.

Nic0205 commented 5 years ago

Hey there,

i changed the code and now i get the following error:

raceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 402, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 254, in async_update_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 285, 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 246, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
KeyError: 'heat'
2019-08-14 04:02:23 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Nic0205 commented 5 years ago

first of all - I am not a programmer.

I tried to copy some codelines from an older version of climate.py but this also does not work.

I tried

# Get the name of the mode code = self._data['CONTROL_MODE'] mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][code] mode = mode.lower()

And the log says: File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode code = self._data['CONTROL_MODE'] KeyError: 'CONTROL_MODE'

does this help anyway?

Nic0205 commented 5 years ago

@danielperna84 and @pvizeli :

Is there a chance how i could get this damned thermostat working?

JT089 commented 5 years ago

Would really love, if this can be fixed, as I own five of this thermostats and definitely prefer continue using them. Think for the environment, the trees ;-)

danielperna84 commented 5 years ago

Unfortunately I don't see how I can be of further help. Without being able to test this my guidance here in the form of "try this, try that" would take ages to make usable progress. So we probably have to wait until someone with the same device and Python knowledge takes the time to research and fix the problem.

JT089 commented 5 years ago

As i got a few of them. If you got some spare time and are willing to fix this (no offense): I can send a pair HM-CC-TC and HM-CC-VD over to you...

terveer commented 5 years ago

Maybe we should propose the broken Homematic Integration as Homeassistant Alert? Soon the heating season will begin in europe and these thermostats are pretty common.

MajestyIV commented 5 years ago

I could set up a dev system and provide remote access to someone who has the knowledge to debug this. I have a few HM-CC-TC.

danielperna84 commented 5 years ago

Sorry for not being active in this issue, but I currently don't have the capacity in spare time to get deeper into this.

That being said, I do understand the desire to get the device working again. But realistically the device itself is not broken. You still can automate it via the CCU, or improve the internal programming to be at least somewhat more efficient compared to a fully manual thermostat. Or at the very least: walk straight to the device and turn the heat up. It's just the integration into HA that's broken. Which should be fixed, no doubt. But nobody will freeze to death. Which gives any of the victims of this bug the opportunity to get started with Python to fix this issue. I promise, this problem shouldn't be too difficult to solve. It just requires some time, basic Python knowledge and access to the hardware. 👍

MajestyIV commented 5 years ago

I did a quick test on my system and a try-except could fix the issue for now. I don't want to commit this fix as I'm not sure, if that has any side effects, but look at the patch which is attached. patch.txt

Nic0205 commented 5 years ago

Sound great. For me as a noob - how could i apply this change to my installation? Do I simply have to add the "+" lines - what about the lines without a "-" or a "+".

Sorry for this silly question - but i am really far away from being a programmer

MajestyIV commented 5 years ago

@danielperna84 Could you have a look at the patch? I know, that this should not be the final solution, but this would help a lot of people. I might dig deeper into the issue. I"m a developer, but I don't have much python knowledge yet. So this will take some time.

Nic0205 commented 5 years ago

@MajestyIV I found out - how to apply the patch.

The log says:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 408, in _async_add_entity
    await entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 266, in async_update_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 245, in state_attributes
    data[ATTR_PRESET_MODE] = self.preset_mode
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 98, in preset_mode
    mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/homematic/climate.py", line 181, in _hm_control_mode
    return self._data["CONTROL_MODE"]
KeyError: 'CONTROL_MODE'
2
MajestyIV commented 5 years ago

You probably did something wrong while applying the patch.

If you want to do it manually, you have to remove the lines with the leading - and apply the lines with the leading +. Keep everything else as it is.

Nic0205 commented 5 years ago

Hmmm. Same error again.

Could you Upload the patched climate.py?

MajestyIV commented 5 years ago

I did some more testing and my patch is not working 100%. There are 2 icons under the climate control which are causing a exception.

image

I think, they should be disabled but I don't have a clue how to do that.

JakobTewes commented 5 years ago

@pvizeli @danielperna84: I was wrong. Fix effective per version 0.99.3. Looking good!

Thanks,

Jakob