Skip to content

Automation Examples

David edited this page Sep 30, 2022 · 1 revision

Triggering an action when the score changes

alias: Automation - Team Score
trigger:
  - platform: state
    entity_id: sensor.team_tracker
    attribute: team_score
condition:
  - condition: template
    value_template: >-
      {{ trigger.to_state.attributes.team_score | int >
      (trigger.from_state.attributes.team_score | int ) }}
action:
  - your-action-here

Updating an LED light strip to display the win_probability

alias: Automation - Team Probability
description: ""
trigger:
  - platform: time_pattern
    minutes: /2
condition:
  - condition: state
    entity_id: sensor.team_tracker
    state: IN
  - condition: template
    value_template: >-
      {{ state_attr('sensor.team_tracker', 'team_win_probability') != None
      }}
action:
  - service: localtuya.set_dp
    data:
      device_id: INSERT_DEVICE_ID_HERE
      dp: 53
      value: >-
        {{ (state_attr('sensor.team_tracker', 'team_win_probability') * 50
        ) }}
mode: single