Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecobee Integration Borked with Updated Climate #25222

Closed
geekofweek opened this issue Jul 18, 2019 · 9 comments · Fixed by #25256
Closed

Ecobee Integration Borked with Updated Climate #25222

geekofweek opened this issue Jul 18, 2019 · 9 comments · Fixed by #25256

Comments

@geekofweek
Copy link
Contributor

geekofweek commented Jul 18, 2019

Home Assistant release with the issue:
0.96.0

Last working Home Assistant release (if known):
0.95.4

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

Component/platform:
Ecobee

Description of problem:
Ecobee integration is borked and has some fairly significant breaking changes to previous functionally.

The major issue is that basically setting a preset hold does nothing.

The first issue is some typos with the function definition of preset_mode:

    def set_preset(self, preset):
        """Activate a preset."""
        if preset == self.preset_mode:
            return

        self.update_without_throttle = True

        # If we are currently in vacation mode, cancel it.
        if self.preset_mode == PRESET_VACATION:
            self.data.ecobee.delete_vacation(
                self.thermostat_index, self.vacation)

        if preset == PRESET_AWAY:
            self.data.ecobee.set_climate_hold(self.thermostat_index, 'away',
                                              'indefinite')

        elif preset == PRESET_TEMPERATURE:
            self.set_temp_hold(self.current_temperature)

        elif preset in (PRESET_HOLD_NEXT_TRANSITION, PRESET_HOLD_INDEFINITE):
            self.data.ecobee.set_climate_hold(
                self.thermostat_index, PRESET_TO_ECOBEE_HOLD[preset],
                self.hold_preference())

        elif preset is None:
            self.data.ecobee.resume_program(self.thermostat_index)

        else:
            _LOGGER.warning("Received invalid preset: %s", preset)

preset is being used instead of preset_mode

sometimes it was correct sometimes it wasn't

¯(ツ)/¯

It should be more like this:

    def set_preset_mode(self, preset_mode):
        """Activate a preset."""
        if preset_mode == self.preset_mode:
            return

        self.update_without_throttle = True

        # If we are currently in vacation mode, cancel it.
        if self.preset_mode == PRESET_VACATION:
            self.data.ecobee.delete_vacation(
                self.thermostat_index, self.vacation)

        if preset_mode == PRESET_AWAY:
            self.data.ecobee.set_climate_hold(self.thermostat_index, 'away',
                                              'indefinite')

        elif preset_mode == PRESET_TEMPERATURE:
            self.set_temp_hold(self.current_temperature)

        elif preset_mode in (PRESET_HOLD_NEXT_TRANSITION, PRESET_HOLD_INDEFINITE):
            self.data.ecobee.set_climate_hold(
                self.thermostat_index, PRESET_TO_ECOBEE_HOLD[preset_mode],
                self.hold_preference())

        elif preset is None:
            self.data.ecobee.resume_program(self.thermostat_index)

        else:
            _LOGGER.warning("Received invalid preset: %s", preset)

That resolves it actually setting a preset, but then we get into the next issue. You can't use user defined presets, nor does it load the default presets Home or Sleep that are present on every Ecobee

So by default we should at least setup for the default Home and Sleep

PRESET_HOME = 'home'
PRESET_SLEEP = 'sleep'

Ecobee lets you set custom presets, called comfort profiles, these were able to be set previously, but now it does a check for one of the pre-canned presets and throws an error.

Removing the check and adding back in the else that does a catch all to the user input fixes it:

        elif preset_mode is None:
            self.data.ecobee.resume_program(self.thermostat_index)

        else:
            self.data.ecobee.set_climate_hold(
                self.thermostat_index, hold_mode, self.hold_preference())
            self.update_without_throttle = True

This list of Presets that are actually available to an Ecobee unit are called up via Climate List:

    def climate_list(self):
        """Return the list of climates currently available."""
        climates = self.thermostat['program']['climates']
        return list(map((lambda x: x['name']), climates))

In my scenario it returns, which shows up as an attribute for the Ecobee device.

climate_list: Upstairs,Fireplace,Home,Sleep,Guest,Away

It would probably be more useful if the climate_list is what was used to populate the presets, as those are the actual presets. The current list of presets make very little sense.

Now that leads me to my next item, which is why is next_transition, indefinite, and temp defined as presets? Those really don't make much sense to have in there or show up in the UI as an option. Those are fairly useless as presets and essentially do nothing.

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

ecobee:
  api_key: !secret ecobee_api_key

Traceback (if applicable):

2019-07-17 22:30:41 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140568187639184] 
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/app/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/usr/src/app/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/usr/src/app/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/usr/src/app/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/app/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 399, in async_set_preset_mode
    self.set_preset_mode, preset_mode)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 394, in set_preset_mode
    raise NotImplementedError()
NotImplementedError

Additional information:
If I can find some time I'll try and get a pull request out tomorrow that at least fixes the core functionality. I've yet to try and tackle how to properly send back the list of presets that are available.

@cgtobi
Copy link
Contributor

cgtobi commented Jul 18, 2019

To add presets to the list you have to add them here.

like:

PRESET_HOME = 'home'
PRESET_SLEEP = 'sleep'

PRESET_MODES = [
    PRESET_AWAY,
    PRESET_TEMPERATURE,
    PRESET_HOLD_NEXT_TRANSITION,
    PRESET_HOLD_INDEFINITE,
    PRESET_HOME,
    PRESET_SLEEP,
]

@geekofweek
Copy link
Contributor Author

I got that part, already tested it on mine. I was suggesting that at a minimum the default set should include Home and Sleep, and do away with Temperature Hold, Next Transition, and Indefinite.

@madrose

This comment has been minimized.

@madrose

This comment has been minimized.

@cgtobi

This comment has been minimized.

@madrose

This comment has been minimized.

@geekofweek geekofweek mentioned this issue Jul 18, 2019
9 tasks
@geekofweek
Copy link
Contributor Author

Pull request submitted.

@balloob
Copy link
Member

balloob commented Jul 18, 2019

Will go out in a couple of hours. Thanks @geekofweek

@heymoe
Copy link

heymoe commented Jul 25, 2019

Running 0.96.4 and it looks like the climate attribute hvac_action goes undefined if the Ecobee is not heating or cooling (as in hvac_action would normally say off) but the fan is on.

I have a template sensor setup for the Ecobee's operating state which was originally defined as:

value_template: "{{ states.climate.home_bee.attributes.operation }}"

before 0.96.x but updated it to:

value_template: "{{ states.climate.home_bee.attributes.hvac_action }}"

due to the changes in 0.96.x and found that that sensor would show no data every now and then but eventually tracked it down to when it wasn't heating and cooling but the fan was running. I changed my template to this:

value_template: >-
  {% if states.climate.home_bee.attributes.hvac_action is defined %}
    {{ states.climate.home_bee.attributes.hvac_action }}
  {% else %}
    off
  {% endif %}

to make sure the sensor reported off when only the fan was running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants