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

Add turn_on method to ecobee climate platform #27103

Merged
merged 7 commits into from
Oct 5, 2019
Merged

Add turn_on method to ecobee climate platform #27103

merged 7 commits into from
Oct 5, 2019

Conversation

marthoc
Copy link
Contributor

@marthoc marthoc commented Oct 1, 2019

Breaking Change:

Previously, calling climate.turn_on would cause the ecobee thermostat to turn on in heat mode, regardless of the mode when the thermostat was turned off. Now, the thermostat will turn on to the last "active" HVAC mode (i.e. "heat", "cool", or "auto") (or, if the thermostat was "off" when Home Assistant started, to "auto").

Description:

With no turn_on method in the ecobee climate platform, climate.turn_on was causing the ecobee thermostat to always turn on in "heat" mode (as a result of using the "fake" turn on in async_turn_on from the climate entity class). This PR adds a variable (self._last_active_hvac_mode) to track the last "active" (i.e. non-off) HVAC mode, and updates it in async_update with the latest non-off state retrieved from the ecobee API. And, the turn_on method sets the HVAC mode to the value contained in self._last_active_hvac_mode, which should be more intuitive for users.

Related issue (if applicable): fixes #27091

Pull request with documentation for home-assistant.io (if applicable): N/A

Example entry for configuration.yaml (if applicable):

N/A

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 1 tiny comment.

homeassistant/components/ecobee/climate.py Outdated Show resolved Hide resolved
@marthoc
Copy link
Contributor Author

marthoc commented Oct 4, 2019

Ready to go!

@balloob
Copy link
Member

balloob commented Oct 5, 2019

🎉 🎉 🎉 🎉

@balloob balloob merged commit 2e49303 into home-assistant:dev Oct 5, 2019
@balloob
Copy link
Member

balloob commented Oct 5, 2019

Actually thinking now (I know, maybe a little too late), shouldn't we make this part of the default turn_on command handling, for all climate entities ?

@marthoc
Copy link
Contributor Author

marthoc commented Oct 5, 2019

@balloob you’re probably right... I’ll take a look!

@MarshallCS
Copy link

Thank you very much for working on this!

@lock lock bot locked and limited conversation to collaborators Oct 6, 2019
@marthoc marthoc deleted the ecobee-add-turn-on branch October 8, 2019 00:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ecobee defaults to Heat when turning on
5 participants