Hi All,
I am trying to figure out how to search a sensor’s [nws_alerts] attribute [title] for ‘Tornado Warning.’ If “Tornado Warning” is found anywhere inside, it turns on switch “Tornado Warn HA.” Below is what I came up with, but I am hoping someone can check it out. For two reasons:
1.) I read somewhere else on the forum that at least at one point, “state” platforms couldn’t use “templates.”
2.) I don’t understand what “in [trigger.to_state.state]” means… i.e. if that should say something else.
Appreciate it!
Dallas
- id: '1907862912346'
alias: Handle Tornado Alert Count to Hubitat
description: ''
trigger:
- platform: state
entity_id:
- sensor.nws_alerts
condition: []
action:
- if:
- condition: state
entity_id: sensor.nws_alerts
attribute: title
value_template: "{{'Tornado Warning' in [trigger.to_state.state]}}"
then:
- type: turn_on
device_id: 78ea3f531f6af74090d2c284f899822c
entity_id: tornado_warn_ha
domain: switch
else:
- type: turn_off
device_id: 78ea3f531f6af74090d2c284f899822c
entity_id: tornado_warn_ha
domain: switch
mode: single