-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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 enable and disable config entry services #77457
Add enable and disable config entry services #77457
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
b41fd0e
to
16437d8
Compare
I don't think that we should add this service. Instead, any automation interacting with this device should add a condition to not do so. |
@balloob I'm trying to understand your point, please correct me if I'm having mis-understanding: In my opinion, enabling and disabling integrations are basic functionalities like |
required: false | ||
example: 8955375327824e14ba89e4b29cc3ec9a | ||
selector: | ||
text: |
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.
You can use a config entry selector instead
target: | ||
entity: {} | ||
device: {} |
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.
This should not be targeting devices or entities.
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.
I'm not sure if I'm against this PR or not (as in general terms of having this service). I'm not entirely sure about the use case, to be honest.
Nevertheless, I do think it should not be targeting devices or services and additionally, this PR could directly use the config_entry
selector to ask the user for a config entry to enable/disable.
../Frenck
We don't allow enabling/disabling entities or devices either. We shouldn't expose any services that can alter the system configuration. |
@frenck thanks for the review, if this PR can go further, I will address you comments by removing targeting device/entity and using @balloob About "expose any services that can alter the system configuration", I didn't know that but I fully respect that. FWIW, one of the use cases of these 2 services (also the motivation of having this PR) is that: More details if you'd like to know
I'm sure there are other angles to solve my problem, I'm sure I will figured something out if this PR goes south. |
Bluetooth performance is a known issue and there are multiple efforts in play to reduce this (bleak, python-dbus-next, OS 9). We should not add this service. |
In the mean time, if you update to haos 9.x and patch python-dbus-next with this PR you should see the cpu drop quite a bit altdesktop/python-dbus-next#126 |
I know it's a bit late here, but disabling the scanner will make switchbot eventually fail since there is nothing to keep the device registered on the bus. As soon as bluez can't see if for it a bit it will remove it from the bus and you'd have to start the scanner back up to get it connectable again. |
@balloob @emontnemery thanks for pointing to the right direction. @bdraco thanks for all work on Bluetooth, I will check out your PR and try it out. |
Also if you aren't using HAOS, dump the default dbus broker and replace it with https://github.com/bus1/dbus-broker as you'll save quite a bit of cpu time there and all your bluetooth devices will be more responsive. HAOS 9.x will do this. |
Proposed change
Adding 2 services to enable and disable integrations/config-entries.
I ran into a situation where I need to use automation to enable and disable (NOT reload) an integration.
I didn't find such services and found some discussions confirming that it's a missing feature:
https://community.home-assistant.io/t/programmatically-disable-enable-integration/322971
https://community.home-assistant.io/t/disabling-enabling-an-integration-automatically/437038
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: