So I implemented a custom weather sensor. Part of the weather component is a sensor.warning.
Currently we have a Special weather Statement in our area. I figures this was a great time to implement a conditional card with a weblink to the weather statement if the sensor returned a Special Weather Statement, Watch, or Warning.
I have the card setup, I know the sensor state right now is - SPECIAL WEATHER STATEMENT
So with this the card doesn’t show up. But if I set the state to be SPECIAL WEATHER STATEMENT using the Set State option on the dev-state page the card appears until the sensor is updated.
The kicker is I’m getting SPECIAL WEATHER STATEMENT from the state column next to the sensor.ec_warning entry.
I’m not sure why the card appears when I manually set it.
Oh, I’ve also tried the state: with double quotes with no difference in the outcome.
@pnbruckner Thanks for the tip! It looks like there was a lead and trailing space.
Weird as now the sensor is saying 'Wind Warning , Special Weather Statement ’ (without the ’ ')
Not sure why the Wind Warning has only a trailing space and the Special Weather Statement has Leading and trailing.
Anyways the card is now appearing, do you know if I can use wild cards for the condition?
yah, I just tried a few and nothing worked, looks like it’s a yaml thing, seems short sighted on yaml’s end so I’ll have to figure something out, there are 23 possible warnings that could be issued, I haven’t looks at watches yet, too many variables to handle with wild cards
I’m not trying to dissuade you from getting your sensor alerts working but if you want a (at least for now) working drop in set up for US national weather service alerts there is always this:
that link is to the post that links to the latest working code on gist.
I don’t know if would be useful to read the whole thing but you might get something out of it.
Temporarily I am using the state_not function. When there are no alerts the sensor state is ‘unknown’ I can use that and make the card appear for all alerts, not ideal but it’s something right now.