Service Call to Enable/Disable an Integration

I’m creating this as the only related thread I’ve found[1] looks unlikely to get attention but I think the request is valid here.

As part of a wider effort to reduce standby power usage, I have a number of devices with configured integrations which are only powered up when needed. Normally this is achieved through HA controlled smart switches.

At present I have 2 options: I can either disable or remove the device using the UI, which means I can’t use it in HA; or I can put up with ERROR level messages filling my logs that the devices are unreachable. Depending on reconnection polling, these devices might be unreliably available when I want to use them with HA. I’ve also had at least one occasion where I’ve missed other errors because of the “expected” errors.

I’ve not been able to find a service call which can enable & disable devices against an integration in the way that the UI can. If there was such a service call then I could use automations to enable them when they power up, and disable them again when they power down. As I see it, there would be less log spam for expected failures and integration code would spend less time outside of its “normal” state - which could help minimise bugs (like [2] and [3]).

I’d be interested if this is something that would be use or interest more widely - as I’m sure I’m not the only person trying to keep devices powered off when not required.

[1] Programmatically Disable/Enable Integration? - #50 by madbrain
[2] Problem when restarting Home Assistant and Kodi is standby or Off · Issue #73097 · home-assistant/core · GitHub
[3] Kodi integration slows down HA restart/shutdown · Issue #47828 · home-assistant/core · GitHub.

I believe this would be a more valid request: detailed control of log messages. Switching off integrations to prevent a resulting action is imo not the right way froward.

I agree to an extent, and perhaps I could have been more clear in my original post.

Absolutely, if squashing error messages is the objective then an alternative feature request of changing the Logger component level (perhaps for individual components) would be more appropriate. I also have that option today through configuration (which is what I actually do now as a workaround). I was using the error message example as a visible indication of an issue. Perhaps it wasn’t the best example.

As far as I’m concerned here though, the error messages are a consequence of HA expecting a configured integration to be available whenever it is running, but in my circumstance some of these devices are intentionally only available some of the time. The only way to communicate this to HA within the current architecture seems to be to enable/disable the device integration to track its expected state.

I’ve had instabilities caused by integrations (such as Kodi - mentioned in the bugs above) sitting in a “connecting” state and blocking things like Home Assistant shutdown/restart. They’re valid bugs, but dev time is limited and arguably is better targeted to more holistic fixes.

Ideally integrations would consider the “device offline, but might come online later” case more gracefully, but that’s relies on implementing the logic to handle that in each case. It would seem architecturally cleaner to be able to do this once and communicate to Core that “this device is configured but expected offline”. From what I can see, this is basically what “enable” and “disable” of an integration does - keep configuration but effectively make the code handling it dormant when disabled.

I have a similar issue now with my solar inverter, it switches itself off when there is nothing to invert, the integration should then handle this and not throw messages (in my case this is fine) and set values correct (in my case the integration hangs on the last value measured)… So, for me the main goal would be to address the integration. I have other examples where my tuya devices go down expectedly and I am flooded too with messages which could be handled better imo…this would still be the integration to deal with that.

However… there is no way that the devs can cover all use-cases and there should be more power-to-the-user…so I added my vote

Similar situation here.
Finally I had to create a python script called from a shell integration: Loop over list in a script - #2 by aqwserf
I’d really love to have a integrated call to start/stop an integration.

I’d like this too. I use the MotionEye integration to control some indoor cameras, but I have the MotionEye add-on turned off when I’m home, so I get the “Cannot connect to host” error.
Another option to solve the issue would be to add a service to enable/disable polling.

Same here. I’m using Home assistant to turn my NAS on and off to prevent it from running unnecessarily 24/7. The downside here is that I have quite a few integrations and services that depend on the availability of the NAS. It would be awesome if I can disable these using the same automation to prevent unnecessary network traffic and log entries.

I am using the jellyfin integration however it is up only while watching movie or tvshows. Rest of the time it is down but I get tons of error message that the server is not reachable. It would be nice to get the option to disable the integration if the server is down.

Would really help if there was a service to enable/disable integrations. My use case is that our indoor cameras / baby monitor are on smart plugs and we don’t turn them on when not required or when we are home. My Printer and NAS are also not always on.

For me, this would also be a great addition.
I’m using the Octoprint integration to get some data of my 3D printer. But when the printer is off, I also switch the Pi with Octoprint off. Therefore the integration overview almost always shows me “Connection failed”.

Hello frenck

Tried spook on the latest version of home assistant but I cannot find the services in the developer tools

Did the latest update break it?

Thanks

All services start with homeassistant.

Same here, the integration doesn’t even show up in the list along with active integrations, and all the
newly added services don’t show up.

Once you install Spook from HACS, you need to do a restart of HA. Then, go to “Integrations” and add “Spook.” Then the services will show up.

1 Like

ok …you are right, can’t believe i just made this noob mistake :sweat_smile:

This would be great to have for the Adventurer3. The integration grabs the comms so I can’t send prints to it. Flashprint thinks there is another instance running. Disabling the integration while I send the file works great, then just I re-enable it again. Having a button that I could press to disable it for 2 mins would be perfect.

Any updates on this request? I also need an integration to be shutoff at night. The power of my AC units gets disconnected at night to save a lot on standby power, but the AC integration then starts flooding the log (and RAM!) with connection errors. Disabling this integration when the power of the AC is switched off will prevent this issue.

Looked everywhere, but can not find a solution to stop/start an integration.

You’ll find it under developer tools - services.

Install Spook (in HACS)

1 Like