-
Notifications
You must be signed in to change notification settings - Fork 627
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
Change Tuya switch TS000x device type #2996
base: dev
Are you sure you want to change the base?
Conversation
Change device type of Switch_4G_GPP to be an actual switch, as the device consists of potential-free relais. Also the type switch is substitutable with other types using HA helpers, but not (or not easily) vice versa. It would probably make sense to change this for other similar switches as well, but as I don't own any others, I don't want to change stuff blindy, potentially introducing unnecessary errors/misbehaviour.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2996 +/- ##
=======================================
Coverage 87.85% 87.85%
=======================================
Files 301 301
Lines 9212 9212
=======================================
Hits 8093 8093
Misses 1119 1119 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with this is that it'll break existing installations. Everyone who currently set it up will have the old entity become stale and get a new one.
We've avoided changing the device type for new quirks because of this.
Please see this section on how to change the device type locally:
https://www.home-assistant.io/integrations/zha/#modifying-the-device-type
I see. So this PR becomes obsolete? While it is possible to work around this, I still see it at least somewhat inconvenient for new users setting up this (and potentialy any other wrongly specified device). Wouldn't it be possible to ensure somehow the original device type continues working by automatically generating a proper helper, just as "change device type" in the UI does? The latter only seems to work when the "base" entity was a generic switch, but not when it is something specific like e.g. a lamp in this case. |
@TheJulianJES sorry for the ping, I'd just close the PR if it really became irrelevant. |
I know it's not ideal, but we can't really do this from quirks.
That's a limitation on HA Core side, as the integration responsible for that is called "Switch as X" and only allows you to "convert" switches.
For now, probably yes. I'm aware the current situation isn't ideal (especially because you can't go from light to switch using HA UI and have to modify (ZHA) YAML configuration to fix this, but there's no "good" solution right now.) |
Bummer :( Hope this gets sorted at some point.
I might have a look at that at some point. Trying to lift this restriction could mitigate this inconvenience at least a bit. |
Proposed change
Change device type of Switch_4G_GPP to be an actual switch, as the device consists of potential-free relais. Also the type switch is substitutable with other types using HA helpers, but not (or not easily) vice versa.
It would probably make sense to change this for other similar switches as well, but as I don't own any others, I don't want to change stuff blindy, potentially introducing unnecessary errors/misbehaviour.
I found no related tests to this device, so I didn't do anything in this regard as well, as I've got not enough time to read through your testframework (yet) :/
Checklist
pre-commit
checks pass / the code has been formatted using Black