Weather
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
- Open the automation or script that should do this, and select Add action.
- Search for units, and select Weather: Set units 👻.
- Under Entity, pick the weather entities.
- Pick the units you want to change, like Wind speed unit
mphand Pressure unitinHg. - 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 opens it in your Home Assistant, ready to run once.
| 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 |
| 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:°Cor°F.pressure_unit:hPa,inHg,kPa,mbarormmHg.wind_speed_unit:Beaufort,ft/s,km/h,kn,m/sormph.visibility_unit:kmormi.precipitation_unit:inormm.
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.
Wind in miles per hour and pressure in inches of mercury:
action: weather.set_units
data:
entity_id: weather.home
wind_speed_unit: mph
pressure_unit: inHg
And back to the units Home Assistant picks:
action: weather.set_units
data:
entity_id: weather.home
wind_speed_unit: null
pressure_unit: null
- 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.
Missing something here?
An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.
System log
Spook adds an action that lists the errors and warnings of Home Assistant, the ones on the logs page, so an automation can count them, filter them by integration, or send them to your phone.
Lock
Spook adds an action to the lock integration of Home Assistant that sets the default code of locks, so a dashboard or automation does not ask for it.
