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
70.48k stars 29.42k forks source link

opentherm_gw issue: NotImplementedError #25239

Closed Wummeke closed 5 years ago

Wummeke commented 5 years ago

Home Assistant release with the issue: 0.96

Last working Home Assistant release (if known): 0.95 with old configuration

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

Component/platform: opentherm_gw

Description of problem: Sonsors are added, but no climate component. In Log an error is shown

2019-07-18 10:56:40 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 256, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 169, in state_attributes
    ATTR_HVAC_MODES: self.hvac_modes,
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 254, in hvac_modes
    raise NotImplementedError()
NotImplementedError

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

  thermostat:
    device: socket://OTGW_ADDRESS:6638
    name: "Thermostat"
    climate:
      precision: 0.5
      floor_temperature: true

Additional information: relevant log entries:

2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Remote Central Heating Setpoint Write Support Thermostat
2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Boiler Control Type Thermostat
2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Thermostat Central Heating Enabled Thermostat
2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Remote Override Manual Change Priority Thermostat
2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Boiler Cooling Support Thermostat
2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Thermostat Hot Water Enabled Thermostat
2019-07-18 10:56:40 DEBUG (MainThread) [homeassistant.components.opentherm_gw.binary_sensor] Added OpenTherm Gateway binary sensor Boiler Hot Water Configuration Thermostat
2019-07-18 10:56:40 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 256, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 169, in state_attributes
    ATTR_HVAC_MODES: self.hvac_modes,
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 254, in hvac_modes
    raise NotImplementedError()
NotImplementedError
2019-07-18 10:56:42 DEBUG (MainThread) [homeassistant.components.opentherm_gw] Connected to OpenTherm Gateway at socket://OTGW_ADDRESS:6638
2019-07-18 10:56:42 DEBUG (MainThread) [homeassistant.components.opentherm_gw] Received report: {'master_ch_enabled': 0, 'master_dhw_enabled': 1, 'master_cooling_enabled': 0, 'master_otc_enabled': 0, 'master_ch2_enabled': 0, 'slave_fault_indication': 0, 'slave_ch_active': 0, 'slave_dhw_active': 0, 'slave_flame_on': 0, 'slave_cooling_active': 0, 'slave_ch2_active': 0, 'slave_diagnostic_indication': 0, 'max_ch_setpoint': 90.0, 'control_setpoint': 10.0, 'otgw_about': 'OpenTherm Gateway 4.2.5', 'otgw_build': '17:59 20-10-2015', 'otgw_clockmhz': '4 MHz', 'otgw_mode': 'G', 'otgw_smart_pwr': 'Low power', 'otgw_thermostat_detect': 'D', 'otgw_dhw_ovrd': 'A', 'otgw_setpoint_ovrd_mode': 'N', 'otgw_gpio_a': 0, 'otgw_gpio_b': 0, 'otgw_led_a': 'F', 'otgw_led_b': 'X', 'otgw_led_c': 'O', 'otgw_led_d': 'T', 'otgw_led_e': 'P', 'otgw_led_f': 'C', 'otgw_ignore_transitions': 1, 'otgw_ovrd_high_byte': 1, 'otgw_setback_temp': 16.0, 'otgw_vref': 3, 'remote_transfer_dhw': 0, 'remote_transfer_max_ch': 0, 'remote_rw_dhw': 0, 'remote_rw_max_ch': 0, 'slave_max_relative_modulation': 0.0, 'slave_max_capacity': 0, 'slave_min_mod_level': 0, 'room_setpoint': 16.0, 'relative_mod_level': 0.0, 'ch_water_pressure': 0.0, 'room_temp': 24.97, 'ch_water_temp': 0.0, 'dhw_temp': 0.0, 'outside_temp': 0.0, 'return_water_temp': 0.0, 'slave_dhw_max_setp': 0, 'slave_dhw_min_setp': 0, 'slave_ch_max_setp': 0, 'slave_ch_min_setp': 0, 'dhw_setpoint': 0.0, 'burner_starts': 0, 'ch_pump_starts': 0, 'dhw_pump_starts': 0, 'dhw_burner_starts': 0, 'burner_hours': 0, 'ch_pump_hours': 0, 'dhw_pump_hours': 0, 'dhw_burner_hours': 0}
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Central Heating Water Pressure Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Thermostat OpenTherm Version Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Hot Water Minimum Setpoint Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Gateway LED D Mode Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Hot Water Flow Rate Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Boiler OpenTherm Version Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Boiler Maximum Central Heating Setpoint Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Gateway LED E Mode Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Room Setpoint 2 Thermostat
2019-07-18 10:56:45 DEBUG (MainThread) [homeassistant.components.opentherm_gw.sensor] Added OpenTherm Gateway sensor Thermostat Product Type Thermostat
ghost commented 5 years ago

Hey there @mvn23, mind taking a look at this issue as its been labeled with a integration (opentherm_gw) 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.

mvn23 commented 5 years ago

This is likely related to the update of the climate component. I will take a look soon (probably tonight or later this week).

Wummeke commented 5 years ago

@mvn23 maybe I can save you some time:

I compared your code with another climate component and I noticed yours was missing a property. I tried to fixed it like this:

I added this on line 44

self._operation_list = [HVAC_MODE_OFF, HVAC_MODE_HEAT]

and then added this property on line 137:

    def hvac_modes(self):
        """Return the list of available hvac operation modes."""
        return self._operation_list

And the climate component is now loading. But it seems to be only part of the solution. At least I don't have errors anymore in my log about this component when starting HA and the component loads. But it doesn't seem to function yet.

balloob commented 5 years ago

Opened a PR to add HVAC modes. https://github.com/home-assistant/home-assistant/pull/25268

There does not seem to be a way to change the HVAC mode, so I am returning an empty list.

Looking at the code, I think that should probably always return AUTO as hvac_mode. The hvac_action should return what is currently hvac_mode since it checks if it is actively heating.

mvn23 commented 5 years ago

Thanks for the PR. I haven't read up a lot on the new climate component, so I may mix up some terminology here.

The OpenTherm Gateway does not support setting an operation mode (preset or hvac_mode?). It does have an 'away mode' feature but this can not be set from the serial interface. The device can only report whether or not it is active. This is implemented as preset_mode at the moment. The standard mode of operation of the Gateway has only a single target temperature. From what I understand, AUTO is like an auto-learning/AI mode, while HEAT_COOL has a specific target temperature range. In my opinion it is neither of those, but I also understand that this terminology is under discussion at the moment. The actual state of the system is currently implemented as hvac_mode, but as I understand it this should be reported under hvac_action with the CURRENT_HVAC_* variables as @balloob suggested.

Please let me know if my understanding of the new climate component is correct in this regard. #25268 should get the climate platform back to a working state, but we may need to make some more changes before it's fully up to date with the new climate component architecture.

balloob commented 5 years ago

In that case it should just report HVAC_MODE_HEAT (or COOL if it's cooling).