core icon indicating copy to clipboard operation
core copied to clipboard

Add support for Tuya Wireless Switch entity

Open lanthaler opened this issue 1 year ago • 10 comments

Proposed change

This change adds support for for Tuya wireless switches such as the one depicted below with which this change has been tested.

tuya-device-page

This required a change in tuya-device-sharing-sdk. The relevant pull request has been merged and released in a new version. Here's the changelog for tuya-device-sharing-sdk on PyPI and here's a diff of all the code changes between the two versions

Type of change

  • [x] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] 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 #120460
    • fixes #120458
    • fixes #120020
  • This PR is related to issue:
  • Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/34174

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] I have followed the perfect PR recommendations
  • [X] 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:

  • [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.

To help with the load of incoming pull requests:

lanthaler avatar Aug 07 '24 10:08 lanthaler

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Aug 07 '24 10:08 home-assistant[bot]

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this pull request as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands

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

home-assistant[bot] avatar Aug 07 '24 10:08 home-assistant[bot]

The built-in Home Assistant Event component doesn't configure any device triggers itself as it doesn't understand the semantics of the events unfortunately in the current form.

That is not in scope for the integration, you are trying to work around a limitation in Home Assistant on the integration level.

Please remove them.

frenck avatar Aug 07 '24 12:08 frenck

OK, I removed the device triggers.

lanthaler avatar Aug 07 '24 12:08 lanthaler

Converted to draft yet again, as there are unresolved reviews.

frenck avatar Aug 07 '24 14:08 frenck

@frenck I just rebased the PR onto the current dev. The patch of the Tuya library has also been removed as the changes landed upstream. Let me know if anything else needs to be changed.

Would be great if this could land in the next HA release :-)

lanthaler avatar Aug 19 '24 07:08 lanthaler

Friendly ping.

Please let me know if anything else is needed @frenck

lanthaler avatar Aug 26 '24 08:08 lanthaler

Thanks for putting this together @lanthaler. I have successfully been using this with two 'ja5osu5g' buttons (solving https://github.com/home-assistant/core/issues/120460) with no issues.

Let me know if I can help if any additional testing is required.

danVnest avatar Sep 01 '24 11:09 danVnest

Cool, thanks for confirming that this work as expected for you @danVnest

@frenck anything else that's needed here or can it be merged now?

lanthaler avatar Sep 12 '24 08:09 lanthaler

@joostlek I see you approved #126180 which introduced a conflict with this PR.

I just rebased and resolved the merge conflict. Would you be able to review these changes? This PR has been sitting here for over a month now

lanthaler avatar Sep 20 '24 08:09 lanthaler

I addressed all issues. All checks apart codecov/patch pass now. There seems to be more work required to properly set up tests for this integration. That should be done in a separate PR IMO.

I also squashed and rebased the changes for easier merging.

lanthaler avatar Nov 12 '24 09:11 lanthaler

Thanks for the review @frenck. I addressed all feedback, squashed and rebased the branch onto dev.

lanthaler avatar Nov 27 '24 20:11 lanthaler

@frenck anything else that needs to change here or can this be merged now?

lanthaler avatar Jan 13 '25 08:01 lanthaler

Adapted to upstream changes and rebased once more @frenck

lanthaler avatar Mar 09 '25 19:03 lanthaler

@frenck sorry for the ping but it has been almost 8 months by now since I opened this PR.

Any chance this could be merged now so that it makes it into the next release?

Thanks

lanthaler avatar Mar 21 '25 12:03 lanthaler

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[bot] avatar May 20 '25 13:05 github-actions[bot]

We are past the 9 month mark on this now and I'm getting staleness pings.

@frenck I just rebased this once more and would really appreciate if we could merge this now

lanthaler avatar May 20 '25 20:05 lanthaler