Areas in Home Assistant is a logical grouping of devices and entities that are meant to match the areas (or rooms) in the physical world: your home.
Spook provides actions that allows you to manage and automate the areas in Home Assistant programatically. Great for creating “dynamic” areas, or for creating areas on the fly.
Actions¶
Spook adds the following new actions to your Home Assistant instance:
Create an area¶
Adds a new area to your Home Assistant instance.
Action properties | |
---|---|
Action | Create an area 👻 |
Action name | homeassistant.create_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
name | string | Yes | Living room |
icon | string | No | mdi:sofa |
aliases | string | list of strings | No | ["Lounge", "Sitting area"] |
The use of aliases
is helpful if you want to create an area with multiple names. For example, if you want to create an area called “Living room”, but also want to be able to refer to it as “Sitting area” or “Lounge”, you can add those names as aliases. This is used by Home Assistant Assist and Google Assistant.
1 2 3 4 5 6 7
action: homeassistant.create_area data: name: "Living room" icon: "mdi:sofa" aliases: - "Lounge" - "Sitting area"
Delete an area¶
Adds a new area to your Home Assistant instance.
Action properties | |
---|---|
Action | Delete an area 👻 |
Action name | homeassistant.delete_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
area_id | string | Yes | living_room |
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3
action: homeassistant.delete_area data: area_id: "living_room"
Same example, but using the area’s name instead of the area ID:
1 2 3
action: homeassistant.delete_area data: area_id: "{{ area_id('Living room') }}"
Add an alias to an area¶
Adds one or more aliases to an existing area. This action does not remove existing aliases, but adds the new ones to the existing ones.
As area aliases are used by voice assistants, you could add (and also remove) aliases to an area using automations, which allows you to make them available/unavailable programatically.
Action properties | |
---|---|
Action | Add an alias to an area 👻 |
Action name | homeassistant.add_alias_to_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
area_id | string | Yes | living_room |
aliases | string | list of strings | Yes | ["Lounge", "Sitting area"] |
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3 4 5 6
action: homeassistant.add_alias_to_area data: area_id: "living_room" aliases: - "Lounge" - "Sitting area"
Same example, but using the area’s name instead of the area ID:
1 2 3 4 5 6
action: homeassistant.add_alias_to_area data: area_id: "{{ area_id('Living room') }}" aliases: - "Lounge" - "Sitting area"
Remove an alias from an area¶
Removes one or more aliases from an existing area. This action will leave the other aliases intact.
As area aliases are used by voice assistants, you could remove (and also add) aliases to an area using automations, which allows you to make them available/unavailable programatically.
Action properties | |
---|---|
Action | Add an alias to an area 👻 |
Action name | homeassistant.remove_alias_from_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
area_id | string | Yes | living_room |
aliases | string | list of strings | Yes | ["Lounge", "Sitting area"] |
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3 4 5 6
action: homeassistant.remove_alias_from_area data: area_id: "living_room" aliases: - "Lounge" - "Sitting area"
Same example, but using the area’s name instead of the area ID:
1 2 3 4 5 6
action: homeassistant.remove_alias_from_area data: area_id: "{{ area_id('Living room') }}" aliases: - "Lounge" - "Sitting area"
Set aliases for an area¶
Sets the aliases for an area. This action will overwrite/remove all existing aliases.
As area aliases are used by voice assistants, you could remove (and also add) aliases to an area using automations, which allows you to make them available/unavailable programatically.
Action properties | |
---|---|
Action | Sets aliases for an area 👻 |
Action name | homeassistant.set_area_aliases |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
area_id | string | Yes | living_room |
aliases | string | list of strings | Yes | ["Lounge", "Sitting area"] |
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3 4 5 6
action: homeassistant.set_area_aliases data: area_id: "living_room" aliases: - "Lounge" - "Sitting area"
Same example, but using the area’s name instead of the area ID:
1 2 3 4 5 6
action: homeassistant.set_area_aliases data: area_id: "{{ area_id('Living room') }}" aliases: - "Lounge" - "Sitting area"
Add a device to an area¶
Adds one or more device(s) to an area. This action will leave the other devices in the area untouched.
Action properties | |
---|---|
Action | Add a device to an area 👻 |
Action name | homeassistant.add_device_to_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
area_id | string | Yes | living_room |
device_id | string | list of strings | Yes | dc23e666e6100f184e642a0ac345d3eb |
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
Finding a device ID
Not sure what the device_id
of an your device is? There are a few ways to find it:
Use this action in the developer tools, in the UI select the device you want to add and select the Go to YAML mode button. This will show you the device ID in the YAML code.
Alternatively, you can visit the device page in the UI and look at the URL. The device ID is the last part of the URL, and will look something like this: dc23e666e6100f184e642a0ac345d3eb
.
1 2 3 4
action: homeassistant.add_device_to_area data: area_id: "living_room" device_id: "dc23e666e6100f184e642a0ac345d3eb"
Same example, but using the area’s name instead of the area ID:
1 2 3 4
action: homeassistant.set_area_aliases data: area_id: "{{ area_id('Living room') }}" device_id: "dc23e666e6100f184e642a0ac345d3eb"
To add multiple device at once, use a list of device IDs:
1 2 3 4 5 6
action: homeassistant.add_device_to_area data: area_id: "living_room" device_id: - "dc23e666e6100f184e642a0ac345d3eb" - "df98a97c9341a0f184e642a0ac345d3b"
Remove a device from an area¶
Removes one or more device(s) from an area. This action will leave the other devices in the area untouched.
Action properties | |
---|---|
Action | Remove a device from an area 👻 |
Action name | homeassistant.remove_device_from_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
device_id | string | list of strings | Yes | dc23e666e6100f184e642a0ac345d3eb |
This action does not need an area ID
While this action is area related, it does not need to know the area ID. A device can only be in a single area at a time, so it will remove the device from the area it is in. Hence, it only needs to know the device you want to remove from an area.
Finding a device ID
Not sure what the device_id
of an your device is? There are a few ways to find it:
Use this action in the developer tools, in the UI select the device you want to add and select the Go to YAML mode button. This will show you the device ID in the YAML code.
Alternatively, you can visit the device page in the UI and look at the URL. The device ID is the last part of the URL, and will look something like this: dc23e666e6100f184e642a0ac345d3eb
.
1 2 3
action: homeassistant.remove_device_from_area data: device_id: "dc23e666e6100f184e642a0ac345d3eb"
To remove multiple devices at once, use a list of device IDs:
1 2 3 4 5
action: homeassistant.remove_device_from_area data: device_id: - "dc23e666e6100f184e642a0ac345d3eb" - "df98a97c9341a0f184e642a0ac345d3b"
Add an entity to an area¶
Adds one or more entities to an area. This action will leave the other entities in the area untouched.
Action properties | |
---|---|
Action | Add an entity to an area 👻 |
Action name | homeassistant.add_entity_to_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
area_id | string | Yes | living_room |
entity_id | string | list of strings | Yes | light.spotlight |
Getting an area ID from an area name
Not sure what the area_id
of an area is? The area_id
field also accepts templates. You can use this template to use the area’s name instead:
area_id: "{{ area_id('Living room') }}"
That template will find the area ID of the area with the name “Living room”.
1 2 3 4
action: homeassistant.add_entity_to_area data: area_id: "living_room" entity_id: light.spotlight
Same example, but using the area’s name instead of the area ID:
1 2 3 4
action: homeassistant.add_entity_to_area data: area_id: "{{ area_id('Living room') }}" entity_id: light.spotlight
To add multiple entities at once, use a list of device IDs:
1 2 3 4 5 6
action: homeassistant.add_entity_to_area data: area_id: "living_room" entity_id: - light.spotlight - light.ceiling
Remove an entity from an area¶
Removes one or more device(s) from an area. This action will leave the other devices in the area untouched.
Action properties | |
---|---|
Action | Remove an entity from an area 👻 |
Action name | homeassistant.remove_entity_from_area |
Action targets | No |
Action response | No response |
Spook's influence | Newly added action |
Developer tools | Try this action |
Action data parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
entity_id | string | list of strings | Yes | light.spotlight |
This action does not need an area ID
While this action is area related, it does not need to know the area ID. An entity can only be in a single area at a time, so it will remove the entity from the area it is in. Hence, it only needs to know the entity you want to remove from an area.
1 2 3
action: homeassistant.remove_entity_from_area data: entity_id: light.spotlight
To remove multiple entities at once, use a list of entity IDs:
1 2 3 4 5
action: homeassistant.remove_entity_from_area data: entity_id: - light.spotlight - light.ceiling
Blueprints & tutorials¶
There are currently no known blueprints or tutorials for the enhancements Spook provides for this integration. If you created one or stumbled upon one, please let us know in our discussion forums.
Features requests, ideas, and support¶
If you have an idea on how to further enhance this integration, for example, by adding a new action, entity, or repairs detection; feel free to let us know in our discussion forums.
Are you stuck using these new features? Or maybe you’ve run into a bug? Please check the page on where to go for help.