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

Matter TemperatureNumber feature from TemperatureControl cluster #128838

Open
wants to merge 55 commits into
base: dev
Choose a base branch
from

Conversation

lboue
Copy link
Contributor

@lboue lboue commented Oct 20, 2024

Proposed change

It would be useful to add support for Matter Temperature Control Cluster (0x0056) used in the following device types:

This would allow manufacturers to test their products.

This cluster provides an interface to the setpoint temperature on devices such as washers, refrigerators, and water heaters. The setpoint temperature is the temperature to which a device using this cluster would attempt to control to. This cluster does not provide access to the actual or physical temperature associated with any device using this cluster. Access to the physical temperature associated with a device using this cluster would be provided by other clusters as part of that devices
device type definition.

There is 3 features for this cluster:

  • TemperatureNumber feature:
    For devices that use an actual temperature value for the temperature setpoint, such as some water heaters
    • TemperatureStep feature:
      For devices that support discrete temperature setpoints that are larger than the temperature resolution imposed via the temperature data type
  • TemperatureLevel feature:
    For devices that use vendor-specific temperature levels for the temperature setpoint, such as some washers (Dishwasher, LaundryDryer, LaundryWasher)

There is one command to change the target Temperature:

  • TemperatureNumber feature:
chip-tool temperaturecontrol set-temperature 1 1 --TargetTemperature 40
  • TemperatureLevel feature:
chip-tool temperaturecontrol set-temperature 1 1 --TargetTemperatureLevel 1

SupportedTemperatureLevels (86/5) is a list[Str]
image

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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:

@home-assistant
Copy link

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.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@lboue
Copy link
Contributor Author

lboue commented Oct 20, 2024

Is there a HomeAssistant entity to map this cluster with?

@bouwew
Copy link
Contributor

bouwew commented Oct 20, 2024

You should add/integrate this code into the climate.py file.

@marcelveldt marcelveldt marked this pull request as draft January 28, 2025 18:48
@marcelveldt
Copy link
Member

@lboue can you address the final feedback, rebase the PR and fix any merge conflicts ?
When you're ready, press the "ready for review" button for the (final) review. Thanks!

@lboue lboue marked this pull request as ready for review January 31, 2025 18:23
if self._feature_map == feature_map:
return
self._feature_map = feature_map
self._attr_hvac_modes: list[HVACMode] = [HVACMode.HEAT_COOL]
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment above this line that you can not set the mode for a TemperatureControl cluster, you can only set the target temperature.

Also I'm wondering if heat_cool is the right mode here. Can we somewhere determine if this device is either a cooling or heating device ? I think we can derive that from the device type maybe ?
So if we know from the devicetype that its a fridge, we should hardcode this mode to cooling

Copy link
Contributor Author

@lboue lboue Feb 5, 2025

Choose a reason for hiding this comment

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

I set it to HVACMode.HEAT_COOL because TemperatureControlledCabinet device type can have cooling/heating functionality:
https://github.com/project-chip/connectedhomeip/blob/master/data_model/1.4/device_types/TemperatureControlledCabinet.xml

Copy link
Contributor Author

@lboue lboue Feb 5, 2025

Choose a reason for hiding this comment

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

The difficulty here is that it concerns a different EP. In the case of a refrigerator (fridge + freezer) there is 3 EP:

  1. Endpoint 1: Device Type(s): Refrigerator
  2. Endpoint 2: Device Type(s): Temperature Controlled Cabinet
  3. Endpoint 3: Device Type(s): Temperature Controlled Cabinet

image

image

Copy link
Member

Choose a reason for hiding this comment

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

yes you should look at root endpoint if its a refrigerator

Copy link
Contributor Author

@lboue lboue Feb 6, 2025

Choose a reason for hiding this comment

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

EP0 device type is 'Root Node' so we can't use that trick:

  "attributes": {
    "0/29/0": [
      {
        "0": 22,
        "1": 1
      }
    ],

Copy link
Contributor Author

@lboue lboue Feb 6, 2025

Choose a reason for hiding this comment

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

From the specs :
24-27351-005_Matter-1.4-Device-Library-Specification.pdf (page 121)

image

So maybe with TagList attribute of the Descriptor cluster.

lboue and others added 6 commits February 5, 2025 13:39
Attributes of Descriptor Cluster
TagList / AttributeId: 4 (0x004) - Value type: Optional[List[Descriptor.Structs.SemanticTagStruct]]
  kNamespaceRefrigerator = 0x41
    kTagRefrigerator
      [{"0":null,"1":65,"2":0}]


    TagFreezer
      [{"0":null,"1":65,"2":1}]
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