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 support for Shelly BLU TRV #128439

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

Conversation

chemelli74
Copy link
Contributor

Breaking change

Proposed change

Add support for new device: Shelly BLU TRV

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 @balloob, @bieniu, @thecode, @bdraco, mind taking a look at this pull request as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of shelly 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 shelly 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.

@leptoquark1
Copy link

@chemelli74 Is this still in progress? Because PR is marked as Draft.

@chemelli74
Copy link
Contributor Author

@chemelli74 Is this still in progress? Because PR is marked as Draft.

Hi @leptoquark1 yes it's in progress. But we need some firmware changes from Shelly and we are waiting for them.

@leptoquark1
Copy link

Can you link this PR with the relevant Issue or PR?

@chemelli74
Copy link
Contributor Author

Can you link this PR with the relevant Issue or PR?

?

@leptoquark1
Copy link

Can you link this PR with the relevant Issue or PR?

?

Sorry I misread your answer, thinking you ment any hass core changes.

However, is there a thread or something of whats missing, further steps and/or issues of involved parties?

I think the currently missing api-docs of the new products would help here, where the available RPC methods are exposed in detail.


There is a workaround with RPC via MQTT or rest-command to extend, for example, the compatibility with other external temperature sensors, but the BLE Gen3 ones.

@bieniu
Copy link
Member

bieniu commented Nov 18, 2024

Can you link this PR with the relevant Issue or PR?

I think this is a good place to discuss support for BLU TRV, not this PR https://community.home-assistant.io/t/new-shelly-trv-blu-integration/777837

@leptoquark1
Copy link

Can you link this PR with the relevant Issue or PR?

I think this is a good place to discuss support for BLU TRV, not this PR https://community.home-assistant.io/t/new-shelly-trv-blu-integration/777837

I'm not sure if the community forum is the right spot for technical discussions. It is, unlike this PR, not linked to the code changes.

I asked about details of the firmware restrictions that block this PR. For any possible contributors its not accessible just by this PR and therefore not clear why the PR seems stale.

However. I assume that it was not possible to control the valve position using the public API. That looks patched in v1.1.1 and is now documented here:

https://shelly-api-docs.shelly.cloud/docs-ble/Devices/trv/

homeassistant/components/shelly/climate.py Show resolved Hide resolved
homeassistant/components/shelly/climate.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/climate.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/entity.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/climate.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/climate.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/climate.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/climate.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/climate.py Show resolved Hide resolved
homeassistant/components/shelly/climate.py Show resolved Hide resolved
Comment on lines +629 to +637
mode = hvac_mode in (HVACMode.COOL, HVACMode.HEAT)
await self.call_rpc(
"BluTRV.Call",
{
"id": self._id,
"method": "Trv.SetConfig",
"params": {"id": 0, "config": {"enable": mode}},
},
)
Copy link
Member

Choose a reason for hiding this comment

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

This is not consistent with the hvac_mode property.

ble_addr: str = self._config["addr"]
self._attr_unique_id = f"{ble_addr}-{self.key}"
name = self._config["name"] or f"shellyblutrv-{ble_addr.replace(":", "")}"
self._attr_name = name
Copy link
Member

@thecode thecode Dec 22, 2024

Choose a reason for hiding this comment

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

According to https://developers.home-assistant.io/docs/core/entity/#entity-naming we should set this to None

Suggested change
self._attr_name = name
self._attr_name = None

Note that we need to do this in the constructor otherwise it will be replaced by our base class naming logic.

)
_attr_hvac_modes = [HVACMode.OFF, HVACMode.HEAT]
_attr_target_temperature_step = RPC_THERMOSTAT_SETTINGS["step"]
_attr_temperature_unit = UnitOfTemperature.CELSIUS
Copy link
Member

Choose a reason for hiding this comment

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

Need to add here

    _attr_has_entity_name = True

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.

6 participants