Example automation that I use at my place that has 3 apartments, all have HVAC, I can say Turn off AC and it will turnHVAC off in my apartment, if I say Turn off AC at dads flat, it will turn HVAC of in dads apartment. HVAC do not have alias set, and have different names. Templates take care of that.
alias: Voice - set HVAC to OFF in area
description: >-
Reads the area from the voice prompt (or the calling device), searches for the
first climate entity and sets HVAC mode to OFF.
triggers:
- command:
- >-
Turn off AC in {area}
trigger: conversation
- command:
- >-
Turn off AC
trigger: conversation
conditions: []
actions:
- variables:
area: |-
{%- if trigger.slots.area -%}
{{ trigger.slots.area }}
{%- else -%}
{{ area_id(trigger.device_id) }}
{%- endif -%}
- choose:
- conditions:
- condition: template
value_template: |-
{{ states.climate
| selectattr('entity_id','in', area_entities(area))
| list
| length > 0 }}
sequence:
- target:
entity_id: |-
{{ (states.climate
| selectattr('entity_id','in', area_entities(area))
| map(attribute='entity_id')
| list)[0] }}
data:
hvac_mode: "off"
action: climate.set_hvac_mode
- set_conversation_response: AC is off
default:
- set_conversation_response: No AC in area
mode: single