---
title: "Disable or enable an integration from an automation"
description: "Home Assistant has no action to disable an integration. Spook adds one, and one to enable it again. With examples, and what to use instead when you only want it quiet."
canonical_url: "https://spook.boo/disable-integration-from-automation"
---
# Disable or enable an integration from an automation

> Home Assistant has no action to disable an integration. Spook adds one, and one to enable it again. With examples, and what to use instead when you only want it quiet.

Home Assistant lets you disable an integration by hand, in **Settings** > **Devices & services**, but it has no action to do it from an automation or a script. Spook adds two: `homeassistant.disable_config_entry` and `homeassistant.enable_config_entry`. They flip the same setting as the menu in Home Assistant, so the integration, its devices and its entities go off and come back exactly the same way.

Only want an integration to stop asking for updates, or to restart one that hangs? Home Assistant can do that itself. Both are below.

## Disable an integration in Home Assistant

The way by hand, without Spook:

1. Go to **Settings** > **Devices & services**, and select the integration.
2. Open the menu with the three dots on the entry you want to turn off.
3. Select **Disable**, and confirm.

![The menu of an integration entry on its integration page, with Disable ringed.](https://spook.boo/images/screenshots/en/light/integration-entry-disable.webp)

The menu of an integration entry. **Disable** turns off this entry, its devices and its entities.

Home Assistant says what happens: "Its devices and entities will be disabled." Its entities stop having a state, and its devices are marked as disabled. Nothing is lost: names, areas and settings all stay.

To turn it back on, open the integration again. The entry says it is disabled, and has an **Enable** button. An integration with every entry disabled is hidden on the integrations page: the filter shows it again.

## Disable an integration from an automation

1. Open the automation or script, and select **Add action**.
2. Search for **disable an integration**, and select **Home Assistant Core Integration: Disable an integration 👻**.
3. Under **Integration entry**, pick the integration.
4. Select **Save**.

In YAML:

```yaml
action: homeassistant.disable_config_entry
data:
  config_entry_id: "dc23e666e6100f184e642a0ac345d3eb"
```

Need the ID? Select **Copy entry ID** in the menu of the entry, the same menu that has **Disable**.

![The Actions tool with Disable an integration 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-homeassistant-disable-config-entry.webp)

**Disable an integration** in the Actions tool.

The full reference is [Disable an integration](https://spook.boo/integrations#disable-an-integration).

## Enable an integration again

The same, the other way around: [Enable an integration](https://spook.boo/integrations#enable-an-integration), `homeassistant.enable_config_entry`. Home Assistant sets the integration up again, and its devices and entities come back.

A typical pair: the thermostat of the holiday home, only while you are there.

```yaml
alias: Holiday home thermostat only while we are there
mode: queued
triggers:
  - trigger: state
    entity_id: input_boolean.at_the_holiday_home
    to: "on"
    id: arrived
  - trigger: state
    entity_id: input_boolean.at_the_holiday_home
    to: "off"
    id: left
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: arrived
        sequence:
          - action: homeassistant.enable_config_entry
            data:
              domain: tado
      - conditions:
          - condition: trigger
            id: left
        sequence:
          - action: homeassistant.disable_config_entry
            data:
              domain: tado
```

Each trigger names the state it waits for. A helper that turns unavailable for a moment is neither, so it changes nothing. `mode: queued` keeps a quick flip back from getting lost while the integration is still setting up.

The automation acts on a change, not on how things are when you save it. Is the helper off already, and the integration still on? Turn the helper on and off again, or disable the integration by hand that one time. After that, a restart changes nothing: a disabled integration stays disabled.

## Every entry of an integration at once

An integration you set up more than once, like two Hue bridges, has an entry for each. Give `domain` instead of `config_entry_id`, and the action takes all of them, including entries you add later:

```yaml
action: homeassistant.disable_config_entry
data:
  domain: hue
```

The domain is the short name of the integration, the one in its address in Home Assistant: `/config/integrations/integration/hue`. A domain without any entries is refused, so a typo gives you an error instead of doing nothing.

## Stop polling instead

Often you do not need the whole integration off. You want it to stop asking its device or a paid cloud service for updates every few minutes.

Home Assistant has that built in: open the menu of the entry, select **System options**, and turn off **Enable polling for changes**. The integration keeps working, and you ask for fresh data when you want it with Home Assistant's own `homeassistant.update_entity` action.

From an automation, Spook adds [Disable polling for updates](https://spook.boo/integrations#disable-polling-for-updates) and [Enable polling for updates](https://spook.boo/integrations#enable-polling-for-updates): `homeassistant.disable_polling` and `homeassistant.enable_polling`. Some integrations only look at that setting when they load, so follow it with a reload.

## Restart an integration that failed

An integration that could not set up does not need to be disabled and enabled. Home Assistant tries it again with its own action: `homeassistant.reload_config_entry`.

Spook's [Integration failed to set up](https://spook.boo/other-features#integration-failed-to-set-up) trigger, `spook.integration_failed`, fires when an integration fails to set up for as long as you say. Together:

```yaml
alias: Give a failed integration another go
mode: queued
triggers:
  - trigger: spook.integration_failed
    options:
      for: "00:15:00"
actions:
  - condition: template
    value_template: >-
      {{ config_entry_attr(trigger.entry_id, 'state')
         in ['setup_error', 'setup_retry'] }}
  - action: homeassistant.reload_config_entry
    data:
      entry_id: "{{ trigger.entry_id }}"
```

`mode: queued` lets two integrations that fail at the same time both get their turn. The condition keeps it to the failures a reload can fix. It sits in the actions, so it looks at the integration when the run starts: one that recovered while it waited in the queue is left alone. An integration that failed to migrate, or failed to unload, needs something else: an update of the integration, or a restart of Home Assistant.

## What to keep in mind

- **Automations that use its entities.** While an integration is disabled, its entities have no state. An action on one does nothing. What a condition on one does depends on the condition: a state condition does not pass, but a template that checks it is *not* on does. Disable the automations that depend on it too, or check for it first with Spook's [Entity is available](https://spook.boo/other-features#entity-is-available) condition.
- **Some integrations need a restart.** An integration that cannot unload stays running until Home Assistant restarts. When you disable one by hand, Home Assistant asks for that restart. The action does not: restart yourself, or with `homeassistant.restart`.
- **Run by hand, the actions need an administrator.** Automations can always run them. A script started by a user who is not an administrator cannot.
- **Spook itself is an integration.** Disable Spook from an automation, and the action to turn it back on goes with it.


## Sitemap

See the full [sitemap](https://spook.boo/sitemap.md) for all pages.
