Skip to content

Enhance generic_thermostat with min/max run time and cooldown time #136298

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

Draft
wants to merge 29 commits into
base: dev
Choose a base branch
from

Conversation

esand
Copy link
Contributor

@esand esand commented Jan 23, 2025

Proposed change

The generic_thermostat has a minimum cycle duration that only reacts to temp change events and doesn't prevent the thermostat from being toggled without delay. The description provided with said setting is also misleading and doesn't convey that it is only effective for temp changes.

This change repurposes and enhances the minimum cycle duration setting (renamed to minimum run time) and introduces two new settings to the generic_thermostat. In all, the three main changes are that there is now a minimum run time, maximum run time, and a cooldown time setting.

The minimum run time setting ensures that once the generic_thermostat is on, it must stay on until at least the specified time has passed. The maximum run time setting does something similar and ensures that the thermostat cannot stay on for more than the configured time. Finally, the cooldown time setting ensures that the specified amount of time is passed in an off state before being turned on again.

The purpose to these settings is to introduce duty cycle type features to the generic_thermostat, as all sorts of devices could be attached to it that may require such control (to ensure safety and lifespan of the devices).

Finally, these changes are backwards compatible - it will automatically migrate an existing minimum cycle duration setting to the new minimum run time and cooldown time (effectively providing the exact same functionality). As well, these settings only affect the generic_thermostat control itself for changing state between on and off; it does not prevent the attached switch device from being manually controlled if required.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

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.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @esand

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@esand esand marked this pull request as ready for review January 25, 2025 01:13
@alexfj0
Copy link

alexfj0 commented Feb 15, 2025

Thank you for the great work, would really like to see this merged!

@alexfj0
Copy link

alexfj0 commented Feb 15, 2025

Its really weird because the generic_hygrostat's minimum cycle duration works differently. with the exact same name and description

@MartinHjelmare MartinHjelmare changed the title Enhance generic_thermostat with min/max run time and cooldown time. Enhance generic_thermostat with min/max run time and cooldown time Feb 23, 2025
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

@github-actions github-actions bot added the stale label May 20, 2025
@esand
Copy link
Contributor Author

esand commented May 21, 2025

Will work on rebasing and also see about creating some tests (now that I know a bit about how to do that).

@github-actions github-actions bot removed the stale label May 21, 2025
@esand esand marked this pull request as draft June 11, 2025 12:49
@esand
Copy link
Contributor Author

esand commented Jun 11, 2025

Some tests are failing & new tests should possibly be created. Knowing now how to somewhat design and alter tests, I will work on resolving the failing tests and review the need for additional tests to test new features.

@emontnemery
Copy link
Contributor

Some tests are failing & new tests should possibly be created. Knowing now how to somewhat design and alter tests, I will work on resolving the failing tests and review the need for additional tests to test new features.

If you need some help with the test, feel free to message me on Discord, I'm @emontnemery there too.

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

Successfully merging this pull request may close these issues.

3 participants