Skip to content

Add Matter Climate support#95434

Merged
MartinHjelmare merged 44 commits into
home-assistant:devfrom
hidaris:draft_climate_support
Jul 3, 2023
Merged

Add Matter Climate support#95434
MartinHjelmare merged 44 commits into
home-assistant:devfrom
hidaris:draft_climate_support

Conversation

@hidaris
Copy link
Copy Markdown
Contributor

@hidaris hidaris commented Jun 28, 2023

Breaking change

Proposed change

Add Matter Climate support

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 Black (black --fast 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.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

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

Code owner commands

Code owners of matter can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign matter Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@marcelveldt marcelveldt marked this pull request as draft June 28, 2023 08:46
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py Outdated
@hidaris hidaris force-pushed the draft_climate_support branch from ddcf422 to aa7b355 Compare June 29, 2023 14:52
@marcelveldt
Copy link
Copy Markdown
Member

@hidaris I've updated the code and tests. Only thing I wanted to ask is if its also possible to put the device in auto mode or is that only passive ? As I can see that the device can be in auto mode but its not a mode we can set it to as it seems.

Comment thread homeassistant/components/matter/climate.py Outdated
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good! We need some more test coverage.

Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py
Comment thread homeassistant/components/matter/climate.py
@hidaris
Copy link
Copy Markdown
Contributor Author

hidaris commented Jul 1, 2023

I think this PR is almost complete. I have some doubts about constructing test cases for properties like target temp and min temp when they are set to None. In such cases, it seems that I have to adjust the matter fixture to accommodate it, even though there is a default value for the set point in the matter spec. Is there a better way to handle this? I am currently not sure

@MartinHjelmare
Copy link
Copy Markdown
Member

If the case where max and min returns None can't happen, we can raise RuntimeError to indicate a developer mistake. We don't need to test that.

@marcelveldt marcelveldt marked this pull request as ready for review July 3, 2023 08:25
Comment thread homeassistant/components/matter/climate.py Outdated
Comment thread homeassistant/components/matter/climate.py
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare MartinHjelmare merged commit 3bd8955 into home-assistant:dev Jul 3, 2023
@hidaris
Copy link
Copy Markdown
Contributor Author

hidaris commented Jul 3, 2023

Thanks for your reviews and help!

@craigwitter
Copy link
Copy Markdown

Thank you for doing this change!!

@balloob balloob added this to the 2023.7.0 milestone Jul 3, 2023
balloob pushed a commit that referenced this pull request Jul 3, 2023
* Add Matter Climate support

* update set target temp and update callback

* remove print

* remove optional property

* Adjust the code to improve readability.

* add thermostat test

* Remove irrelevant cases in setting the target temperature.

* add temp range support

* update hvac action

* support adjust low high setpoint..

* support set hvac mode

* address some review feedback

* move some methods around

* dont discover climate in switch platform

* set some default values

* fix some of the tests

* fix some typos

* Update thermostat.json

* Update homeassistant/components/matter/climate.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/matter/climate.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* support heat_cool in hvac_modes

* address some review feedback

* handle hvac mode param in set temp service

* check hvac modes by featuremap

* add comment to thermostat feature class

* make ruff happy..

* use enum to enhance readability.

* use builtin feature bitmap

* fix target temp range and address some feedback

* use instance attribute instead of class attr

* make ruff happy...

* address feedback about single case

* add init docstring

* more test

* fix typo in tests

* make ruff happy

* fix hvac modes test

* test case for update callback

* remove optional check

* more tests

* more tests

* update all attributes in the update callback

* Update climate.py

* fix missing test

---------

Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 4, 2023
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.

5 participants