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.
Are you sure there arenāt any extra spaces, or tab characters, or something like that in the state? Did you try the following in the Template Editor:
@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.