#When title from RSS Feed contains automation

1 messages · Page 1 of 1 (latest)

calm storm
#

Sadly my automation isn't working. What am I doing wrong?

I want to trigger my lights when the title of the RSS feed from the NWS with the Current alerts and warnings contains a certain word like: "Tornado Warning".

I'm doing this because I want the warnings from the whole US, not a certain area. Therefore I'm not using the NWS integration.

alias: Gale Warning Test
description: Gale Warning Test
triggers:

  • trigger: template
    value_template: >-
    {{ 'gale warning' in
    states('event.current_watches_warnings_and_advisories') }}
    conditions: []
    actions:
  • action: light.toggle
    metadata: {}
    data:
    rgb_color:
    - 0
    - 110
    - 255
    brightness_pct: 100
    target:
    device_id: 1006672267b936cdde5ad6fb305eb23f
    mode: single

Thanks for helping!

ashen musk
#

What is the state of the event entity in Dev Tools > States? What do you see in the automation trace?

calm storm
ashen musk
#

Ok. So if it is a timestamp, it will never contain gale_warning that you are looking for in your trigger's value_template. Where is gale_warning stored?

calm storm
#

The warnings are showing up in the title if that's what you mean. For example in the title you can see that there is a Small Craft Advisory

ashen musk
#

That's an attribute, it's not in the state. Use {{ 'gale_warning' in state_attr('event.current_watches_warnings_and_advisories','title') }}

calm storm
calm storm
#

I've tried but it sadly doesn't seem to work. Is the contains string capital sensitive and do you require to put in _ for spaces between words in the string?

ashen musk
#

Yes it has to be exactly what appears in title. If it is "Gale Warning" or something like that, you'd have to put in 'Gale Warning' in...

#

You can test the code in Dev Tools > Template first to make sure it is written correctly.