Running Home Assistant 0.84.6 in Docker, on a NUC with Ubuntu 18.04.
Upgraded to new version two days ago and have a problem with my weather alert, it is now missing the reason for the alert as in the following.
“The National Weather Service has issued a for your area. It expires at 9:00 PM on 12-24-2018.” Notice there is a blank space between a and for in the text.
- alias: Maricopa County NWS Notification Weather Alert
trigger:
platform: state
entity_id: sensor.maricopa_nws_alert_count
condition:
condition: template
value_template: '{{states.sensor.maricopa_nws_alert_count.state | int > 0}}'
action:
- service: notify.Home_Assistant
data_template:
title: Maricopa County Weather Alert
message: "The National Weather Service has issued a {{ states.sensor.maricopa_nws_alert__event.state }} for your area. It expires at {{ as_timestamp(state_attr('sensor.maricopa_nws_alert_event', 'features')[0].properties.expires)| timestamp_custom('%-I:%M %p on %-m-%-d-%Y') }}."
- alias: East Valley NWS Notification Weather Alert
trigger:
platform: state
entity_id: sensor.east_valley_nws_alert_count
condition:
condition: template
value_template: '{{states.sensor.east_valley_nws_alert_count.state | int > 0}}'
action:
- service: notify.Home_Assistant
data_template:
title: Maricopa County Weather Alert
message: "The National Weather Service has issued a {{ states.sensor.east_valley_nws_alert_alert_event.state }} for your area. It expires at {{ as_timestamp(state_attr('sensor.east_valley_nws_alert_event', 'features')[0].properties.expires)| timestamp_custom('%-I:%M %p on %-m-%-d-%Y') }}."
Weather card looks like this notice the Object in bottom right corner.
Here is the code for the weather card
- type: entities
title: Weather Alerts
show_header_toggle: false
entities:
- entity: sensor.maricopa_nws_alert_count
name: Maricopa County Weather Alert Count
icon: mdi:weather-lightning-rainy
- entity: sensor.maricopa_nws_alert_event
name: Maricopa County Weather Alert
icon: mdi:cloud-alert
- entity: sensor.east_valley_nws_alert_count
name: East Valley Weather Alert Count
icon: mdi:weather-lightning-rainy
- entity: sensor.east_valley_nws_alert_event
name: East Valley Weather Alert
icon: mdi:cloud-alert
It looks like you have an extra underscore in your template between “alert” & “event”.
the “[object Object]” is probably due to the fact that the attribute is longer than 255 characters. that confused me at first but everything seemed to work tho.
All of this is assuming you are using my set up for weather alerts. If you aren’t (but it looks really similar) then I’d have to get more specifics on what you are trying to do. but…
What do you mean “to work”?
The announcement doesn’t use the event sensor attribute. It uses the event sensor state. The attribute is only used in the pop up. You could also read it out in the announcement but from the above automations you aren’t using the attribute anywhere.
However, I don’t know if there is a way to shorten the attribute since it parses it directly from the NWS website.
Maybe it would be helpful to post your nws alert sensor code.
All right. I have reviewed your code and am slowly working through the echo integration. Small baby steps.
Now what I have noticed as seen in my two attachments, I believe that the object error is coming from the number of alerts. Notice one has 8 alerts and 8 objects, the other 4 alerts and 4 objects.
Many of the alerts have expired so why are the still showing in my code through lovelace?
I am new to lovelace and trying to understand it from the old system.
I am also sending my lovelace code.
What are the sensors that you are using to get the alerts and the counts? Post the code for those, please.
And as @firstof9 stated there is an updated way to get the alerts using a custom_component that you can find the code for at the link above and to see how I ultimately implemented it into my weather alert code look towards the end of my thread where you found my original code. It does simplify a few things but if you used my original code that should work too. The custom_component just eases some of the code required since triggers and messaging report from a single sensor instead of two.
And as far as lovelace is concerned I don’t use it right now so I can’t help much there.
And for one last edit:
I’m not sure what you’re saying is a “error”.
is it that it lists the [objectObject] instead of the actual alert text?