---
title: "Weather"
description: "Spook adds an action to the weather integration of Home Assistant that sets the units weather entities are shown in, for many at once."
canonical_url: "https://spook.boo/weather"
---
# Weather

> Spook adds an action to the weather integration of Home Assistant that sets the units weather entities are shown in, for many at once.

The weather integration is the one behind every forecast in Home Assistant: the temperature outside, the wind, the pressure, the rain on its way. The weather service you install brings one or more weather entities along.

Home Assistant lets you pick the units a weather entity is shown in, in its settings, one entity at a time. Spook adds an action that sets them from an automation or a script, on as many weather entities as you like.

## Actions

Spook adds one action to the weather integration. You find it wherever you add an action, marked with a 👻.

### Set units

Sets the units one or more weather entities are shown in.

The same five units you find in the settings of a weather entity: temperature, pressure, wind speed, visibility and precipitation. Home Assistant converts every value, the forecast included. Wind in mph and pressure in inHg for the sailing club, kilometres per hour for everybody else.

Set only the units you want to change: the ones you leave out stay as they are.

**How to use it**

1. Open the automation or script that should do this, and select **Add action**.
2. Search for **units**, and select **Weather: Set units 👻**.
3. Under **Entity**, pick the weather entities.
4. Pick the units you want to change, like **Wind speed unit** `mph` and **Pressure unit** `inHg`.
5. Select **Save**.

To go back to the unit Home Assistant picks by itself, set that unit to `null` in YAML mode.

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

**Technical details**

| Action properties |
| --- |
| Action | Weather: Set units 👻 |
| Action name | `weather.set_units` |
| Action targets | No |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=weather.set_units) [![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=weather.set_units) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `entity_id` | string or list | Yes | `"weather.home"` |
| `temperature_unit` | string or `null` | No | `"°F"` |
| `pressure_unit` | string or `null` | No | `"inHg"` |
| `wind_speed_unit` | string or `null` | No | `"mph"` |
| `visibility_unit` | string or `null` | No | `"mi"` |
| `precipitation_unit` | string or `null` | No | `"in"` |

Give at least one unit. The units Home Assistant takes:

- `temperature_unit`: `°C` or `°F`.
- `pressure_unit`: `hPa`, `inHg`, `kPa`, `mbar` or `mmHg`.
- `wind_speed_unit`: `Beaufort`, `ft/s`, `km/h`, `kn`, `m/s` or `mph`.
- `visibility_unit`: `km` or `mi`.
- `precipitation_unit`: `in` or `mm`.

This is the same setting as in a weather entity's own settings, so it survives restarts and applies everywhere the weather entity is shown.

Every weather entity you name is looked up before any of them are changed. If one of them does not exist, the whole call fails and nothing is touched.

**Example actions in YAML**

Wind in miles per hour and pressure in inches of mercury:

```yaml
action: weather.set_units
data:
  entity_id: weather.home
  wind_speed_unit: mph
  pressure_unit: inHg
```

And back to the units Home Assistant picks:

```yaml
action: weather.set_units
data:
  entity_id: weather.home
  wind_speed_unit: null
  pressure_unit: null
```

**Known limitations**

- Only weather entities with a unique ID can be changed, the same ones that have settings in the UI.
- Changing a weather entity's settings is for admins, the same as in the UI. An automation or a script can still use it.

## Use cases

What people use this for:

- Show the weather in the units a guest or a hobby expects, like mph and inHg, and switch back afterwards.
- Set the same units on every weather entity in one action, instead of opening each one in the UI.


## Sitemap

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