---
title: "Labs"
description: "Spook adds actions to Home Assistant Labs that switch a preview feature on or off from an automation, like winter mode when it snows."
canonical_url: "https://spook.boo/labs"
---
# Labs

> Spook adds actions to Home Assistant Labs that switch a preview feature on or off from an automation, like winter mode when it snows.

Home Assistant Labs is where Home Assistant keeps its preview features: what an integration offers to try before it is done. Winter mode is one, with snowflakes falling over your screen. You find them under **Settings** > **System** > **Labs**.

Labs switches them by hand only. Winter mode when it snows, and off again when it stops? Not without walking to the Labs page twice. Spook adds two actions that switch a preview feature from an automation or a script. An [assistant](https://spook.boo/assistants) with Spook's tools can list them and switch them too.

## Actions

Spook adds two actions to Labs. You find them wherever you add an action, marked with a 👻. Both are for administrators only, the same as the Labs page.

A preview feature goes by its full name: its integration, a dot, and the feature. Winter mode is `frontend.winter_mode`.

### Enable preview feature

Switches a preview feature on, like its switch on the Labs page.

One that is on already is left alone: nothing is written, and nothing is told it changed. That matters, because Labs tells every integration when one of its preview features is switched, and some act on it. The Teslemetry integration reloads, for example, to add or remove the entities of its preview feature. So an automation can call this as often as it likes.

Ask for a backup, and Home Assistant makes one first, with your automatic backup settings, the same as the Labs page offers when you switch one on. Like every automatic backup, it follows those settings: afterwards, they may delete the oldest automatic backups beyond the number you keep. The action waits until the backup is done. A backup that fails stops the action, and the preview feature stays off. When it is on already, there is nothing to back up for, and no backup is made.

Only a preview feature the Labs page shows can be switched on. That is the one of an integration that is set up. Switched on before that, nobody could see it is on, nor switch it off there.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **preview feature**, and select **Home Assistant Labs: Enable preview feature 👻**.
3. Under **Preview feature**, enter its full name, like `frontend.winter_mode`.
4. Turn on **Create backup** if you want a backup first.
5. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=labs.enable_preview_feature) opens it in your Home Assistant, ready to run once.

**Technical details**

| Action properties |
| --- |
| Action | Home Assistant Labs: Enable preview feature 👻 |
| Action name | `labs.enable_preview_feature` |
| Action targets | No targets |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=labs.enable_preview_feature) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=labs.enable_preview_feature) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `preview_feature` | string | Yes | `frontend.winter_mode` |
| `create_backup` | boolean | No | `false` |

A preview feature Labs does not know is refused, with an error that names it.

**Example actions in YAML**

Winter mode when the weather says it snows, and off again when it stops. One automation for both: it looks at the weather every time it changes, and when Home Assistant starts. A weather entity that is not loaded yet, or does not know, says nothing about snow, so then the automation leaves winter mode as it is. The actions leave winter mode alone when it already is as it should be:

```yaml
alias: Winter mode when it snows
triggers:
  - trigger: state
    entity_id: weather.home
    # Only when the weather itself changes, not its temperature or wind.
    not_to:
      - unavailable
      - unknown
  - trigger: homeassistant
    event: start
conditions:
  - condition: not
    conditions:
      - condition: state
        entity_id: weather.home
        state:
          - unavailable
          - unknown
actions:
  - if:
      - condition: state
        entity_id: weather.home
        state:
          - snowy
          - snowy-rainy
    then:
      - action: labs.enable_preview_feature
        data:
          preview_feature: frontend.winter_mode
    else:
      - action: labs.disable_preview_feature
        data:
          preview_feature: frontend.winter_mode
```

Trying a preview feature, with a backup made first:

```yaml
action: labs.enable_preview_feature
data:
  preview_feature: camera.two_way_audio
  create_backup: true
```

**Known limitations**

- A backup needs your automatic backup settings: where it goes, and what it holds. Without them, the backup fails, and so does the action. Set them up once under **Settings** > **System** > **Backups**.
- A preview feature is not done. An update of Home Assistant can change it, or take it away. One that is gone is refused by name.
- A preview feature is switched for the whole of Home Assistant, not per person. Winter mode snows on every screen.
- Switching preview features is for admins, the same as on the Labs page. An automation or a script can still use it.

### Disable preview feature

Switches a preview feature off, like its switch on the Labs page.

One that is off already is left alone, the same as the enable action: nothing is written, and nothing is told it changed.

Any preview feature Labs knows can be switched off, also one of an integration that is not set up. Off is what that integration finds once it sets up, so nothing hides.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **preview feature**, and select **Home Assistant Labs: Disable preview feature 👻**.
3. Under **Preview feature**, enter its full name, like `frontend.winter_mode`.
4. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=labs.disable_preview_feature) opens it in your Home Assistant, ready to run once.

**Technical details**

| Action properties |
| --- |
| Action | Home Assistant Labs: Disable preview feature 👻 |
| Action name | `labs.disable_preview_feature` |
| Action targets | No targets |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=labs.disable_preview_feature) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=labs.disable_preview_feature) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `preview_feature` | string | Yes | `frontend.winter_mode` |

A preview feature Labs does not know is refused, with an error that names it.

**Example actions in YAML**

Winter mode off again:

```yaml
action: labs.disable_preview_feature
data:
  preview_feature: frontend.winter_mode
```

## When a preview feature is switched

Spook adds no trigger for this, as Home Assistant has one already. Labs fires the `labs_updated` event every time a preview feature is switched, on the Labs page or by these actions, with the `domain`, the `preview_feature`, and whether it is now `enabled`. A plain event trigger listens for it:

```yaml
triggers:
  - trigger: event
    event_type: labs_updated
    event_data:
      domain: frontend
      preview_feature: winter_mode
      enabled: true
```

## Use cases

What people use this for:

- Winter mode when the weather says it snows, and off again when it stops.
- Winter mode for the holidays only: on in December, off again in January.
- Try a preview feature with a backup made first, so going back is one restore away.


## Sitemap

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