Update labels for areas in automation

It would be great if it was possible to add/remove labels via automations like:

alias: Opdater 'need_attention' label for område
description: >-
  Tilføj eller fjern 'need_attention' label for et område baseret på sensorens
  status
trigger:
  - platform: state
    entity_id: binary_sensor.air_quality_kontor
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.air_quality_kontor
            state: bad
        sequence:
          - data:
              area_id: kontor
              labels:
                - need_attention
            action: area_update_service
      - conditions:
          - condition: state
            entity_id: binary_sensor.air_quality_kontor
            state: ok
        sequence:
          - data:
              area_id: kontor
              labels: []
            action: area_update_service

Spook integration has actions for this
image

2 Likes