core icon indicating copy to clipboard operation
core copied to clipboard

Add climate group

Open daenny opened this issue 2 years ago • 7 comments

Proposed change

Adds a climate group component. Based initially on https://github.com/daenny/climate_group, but updated to be similar to the existing light/fan implementations.

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New integration (thank you!)
  • [x] 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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/23990

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] The code has been formatted using Black (black --fast homeassistant tests)
  • [x] 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:

  • [x] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [x] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [x] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • [x] Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • [x] No score or internal
  • [ ] 🥈 Silver
  • [ ] 🥇 Gold
  • [ ] 🏆 Platinum

To help with the load of incoming pull requests:

daenny avatar Sep 02 '22 22:09 daenny

Hello @daenny,

When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).

The commits that are missing a linked GitHub account are the following:

Unfortunately, we are unable to accept this pull request until this situation is corrected.

Here are your options:

  1. If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.

  2. If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.

    • If you only made a single commit you should be able to run
      git commit --amend --author="Author Name <[email protected]>"
      
      (substituting Author Name and [email protected] for your actual information) to set the authorship information.
    • If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
      1. You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
      2. You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
    • Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.

We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.

Thanks, I look forward to checking this PR again soon! :heart:

homeassistant avatar Sep 02 '22 22:09 homeassistant

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (group) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Thanks for the review @boswelja , I adjusted the code accordingly!

daenny avatar Sep 05 '22 07:09 daenny

Bump @balloob or @frenck , I saw that you guys merged some previous PRs for the group integration. Could you please have a look at it?

daenny avatar Sep 08 '22 21:09 daenny

@daenny, thank you for contributing this, I am eagerly awaiting its merge. Maybe the pylint warning needs to be looked into as well?

ignisf avatar Sep 19 '22 19:09 ignisf

Yes, that's a new one after making my branch upstream. I will look at it tomorrow

daenny avatar Sep 19 '22 20:09 daenny

@daenny I wonder how the local calibration entities and also the valve_position entities can interact, or is it possible to query the values directly within the group via the attributes of the climate devices? since they are separate entities this is confusing. the climate entity still has the attributes local_temperature_calibration and valve_position, is it still possible to change them directly, or do you have to go through your own entities?

KartoffelToby avatar Sep 21 '22 12:09 KartoffelToby

Many climate Intigrations have different Services to set a Offset/calibration think its time to bundle them under a global Services like service climate set offset

KartoffelToby avatar Sep 25 '22 18:09 KartoffelToby

Many climate Intigrations have different Services to set a Offset/calibration think its time to bundle them under a global Services like service climate set offset

I agree that that would make sense, something like a SUPPORT_CALIBRATION flag, but I feel that is out of scope of this PR. It first has to be added to the generic climate and afterwards it shoudl also be added to this group integration

daenny avatar Sep 26 '22 07:09 daenny

@daenny i have a custom Integration that have a own climate group function (i need a little Special here, because i need to perform calibration for each climate) but i think it can Help you. Because i have issues too to restore all values at Startup. I ended up with a "wait for all climate" Routine. Think its not the most elegant solution, but it works.

Little side note, i wounder if all "custom" Attributes from the climates are pass throw and merged

KartoffelToby avatar Nov 14 '22 15:11 KartoffelToby

@KartoffelToby thanks if you are happy to help! if you have a code snippet or link please let me know! I just pushed changes that the most common mode is reported instead of the priority. That's also more in line with the other attributes. @Quentame thanks for testing and the review. I have not added things to config_flow before. Is there a good reference?

daenny avatar Nov 14 '22 16:11 daenny

@daenny for config flow: https://github.com/KartoffelToby/better_thermostat/blob/e296464145b6d6867d9178ed0ebc78cef3e13092/custom_components/better_thermostat/config_flow.py#L211

for the startup: https://github.com/KartoffelToby/better_thermostat/blob/e296464145b6d6867d9178ed0ebc78cef3e13092/custom_components/better_thermostat/climate.py#L359

but i dont know if its the right way to restore or get values on startup. feel free to ask me if you need help, i worked a lot with climates stuff as you can see in this custom interation better thermostat

KartoffelToby avatar Nov 14 '22 16:11 KartoffelToby

@Quentame thanks for testing and the review. I have not added things to config_flow before. Is there a good reference?

You actually don't need to create a config flow from the scratch here, there is already a config_flow.py in the group integration, take the exemple of the ~light~ cover platform in the file.

Also, you will need to update the strings.json file accordingly, and launch command to create the translation files.

And, to finish (I promiss), you should add tests from your config flow additions.


Links to current files:

config_flow.py https://github.com/home-assistant/core/blob/dev/homeassistant/components/group/config_flow.py

strings.json https://github.com/home-assistant/core/blob/dev/homeassistant/components/group/strings.json

test_config_flow.py https://github.com/home-assistant/core/blob/dev/tests/components/group/test_config_flow.py

Quentame avatar Nov 14 '22 16:11 Quentame

Seems to work better but still having the same issue sometimes (I think less)

image

Quentame avatar Nov 14 '22 19:11 Quentame

@Quentame could you perhaps log this in a separate issue? With some information about which devices + how many in the group. I assume this is due to the fact that we send multiple commands per device, and when you group multiple devices, it will send too many commands.

We are still looking into combining multiple commands in one execution, but this work hasn't been prioritized yet.

iMicknl avatar Nov 16 '22 16:11 iMicknl

@daenny : Can you fix tests + add test of your config flow + add translation ?

translation: on the strings.json file as described here https://github.com/home-assistant/core/pull/77737#issuecomment-1314073937 (I don't remember the command line to run after updating the string.json file, but otherwise, fill the en.json manually)

Quentame avatar Nov 29 '22 23:11 Quentame

I think it should be possible to choose different aggregations, right now only mean can be used, and if I understand correctly it calculates the mean of the climate entities in the group for the current temperature, but if ANY 1 of them is in heating mode the groups entity will show heating, which can be misleading, so having hte possibility to use the min value would be more accurate IMHO.

rjulius23 avatar Dec 27 '22 22:12 rjulius23

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. Thank you for your contributions.

github-actions[bot] avatar Mar 27 '23 23:03 github-actions[bot]

Please do not close this PR

Is there anything from @Quentame feedback left unaddressed?

ignisf avatar Mar 28 '23 05:03 ignisf

Seems like tests were still failing, though logs aren't available anymore

boswelja avatar Mar 28 '23 09:03 boswelja

Sorry, I was a bit distracted the last couple of months for personal reasons. I also lost a bit motivation, because I do not use the component myself anymore. But anyway, I made the PR upstream and addressed the changes from @Quentame for the best of my knowledge. I will try to get this one merged now, so let me know if I am missing something.

daenny avatar Mar 28 '23 19:03 daenny

Okay, it seems something has changed in the meantime with the climate demo group. I will try to fix those tomorrow.

daenny avatar Mar 28 '23 21:03 daenny

Hi everyone !

Yes there is still some leftovers comments in this PR as I remember (config_flow + strings for translation).

Forget about my issues I got from the overkiz integration.

Thanks 💪

Quentame avatar Mar 29 '23 13:03 Quentame

Hi everyone !

Yes there is still some leftovers comments in this PR as I remember (config_flow + strings for translation).

Forget about my issues I got from the overkiz integration.

Thanks 💪

I updated the config flow and strings.json in the latest commits and added the tests. For the tests l, I needed to change the state reporting in the ClimateEntity. Can you check if everything is as you expect? Thanks!

daenny avatar Mar 29 '23 16:03 daenny

Is there any update on this?

Devil-of-Chaos avatar Jul 07 '23 14:07 Devil-of-Chaos

Think its a bigger Problem that most users think, i have create a climate group function in my own Integration https://github.com/KartoffelToby/better_thermostat and i saw a lot of possible Problems, sync of device entities Like valve, calibration, etc. That shoudn't be synced between the group members.

KartoffelToby avatar Jul 11 '23 18:07 KartoffelToby

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. Thank you for your contributions.

github-actions[bot] avatar Oct 11 '23 11:10 github-actions[bot]

Just chiming in to mostly tell the stale bot off and that it would be awesome to have this for the heating season <3

ignisf avatar Oct 11 '23 14:10 ignisf

Just chiming in to mostly tell the stale bot off and that it would be awesome to have this for the heating season <3

Totally agree - started using this addon today and it made hours of node-red making take an hour of refactoring. Would be awesome to see an official implimentation as it is one of the few things that isnt UI Configurable as a group.

magicmellon avatar Oct 15 '23 20:10 magicmellon

Would love to see some progress on this as well. Can't help but would love to test if anything needs it.

vordenken avatar Oct 27 '23 18:10 vordenken