#finity69x2 NWS Alerts

1 messages · Page 1 of 1 (latest)

crude moss
#

I'm trying to use NWS alerts and getting an error below pointing to the code below

Error: UndefinedError: 'dict object' has no attribute 'to_state'

for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | list() | sort(attribute='ID') }}"

#

we are expecting severe weather this evening and was hoping to get the automation working 🤷‍♂️

molten bronze
#

What's the full automation?

crude moss
#

@molten bronze of course I changed the media devices to my devices.

molten bronze
#

If you're just testing the automation, know that you cannot "run" it to test as there will be no valid trigger.

crude moss
#

we got a trigger just before I asked the question for a thunderstorm watch

and just got one now for thunderstorm warning. Automation didn't trigger

😡

#

@molten bronze trace gives me the following
Executed: March 14, 2025 at 2:47:51 PM
Error: UndefinedError: 'dict object' has no attribute 'to_state'

dang it

molten bronze
#

Can you share the full trace?

crude moss
molten bronze
#

What does that have to do with the to_state attribute?

crude moss
#

@molten bronze this is what I get when I click on trace

molten bronze
#

Is that from you manually doing "Run Actions"?
What does "Trace Timeline" tab say?

crude moss
#

@molten bronze yes manually run

#

@molten bronze running the script portion works. Just need to figure out what the heck is going on with this 'dict object' has no attribute 'to_state'.

grrrrrr

molten bronze
#

I said earlier: You can't run it manually.

#

If you're just testing the automation, know that you cannot "run" it to test as there will be no valid trigger.

#

Anytime you use trigger.to_state it must have been triggered by a state trigger

#

When you manually run it, trigger variable is empty.

crude moss
#

@molten bronze I understand. We'll probably have some additional alerts later this evening. Maybe it will work. Thanks for you help.

molten bronze
#

If you want to test, try going to developer-tools/states, find the alert sensor, and manually change the value of the state

#

that should trigger it

#

or just wait and see