service: notify.notify
data:
title: Previsão do tempo para amanhã
message: >-
{% if is_state('state_attr("weather.casa", "forecast")
[0].condition','sunny') %}
Ensolarado
{% else %}
*Erro*
{% endif %}
com minimas de {{
state_attr("weather.casa", "forecast") [0].templow }}ºC e máximas de {{
state_attr("weather.casa", "forecast") [0].temperature }}ºC
Why this doesn’t work?
And there’s another method that i can translate “sunny” to “ensolarado” as an example?
I’m trying to translate all conditions to display in a notification.
The condition that i need to translate is from the weathers info from next day.
Please post your code as text and format it with 3 `. I see a bunch of errors but I’m not going to rewrite the template. I don’t think others are willing to either.
I hope there will be some folks here on the forum with knowledge that can help.
Till then, have you tried to run all or part (sometimes good idea to start with small subsets) in the template tester on the developer page of your Home Assistant system?
service: notify.notify
data:
title: Previsão do tempo para amanhã
message: >-
{% if state_attr("weather.casa", "forecast")[0].condition == 'sunny' %}
Ensolarado
{% else %}
*Erro*
{% endif %}
com minimas de {{
state_attr("weather.casa", "forecast") [0].templow }}ºC e máximas de {{
state_attr("weather.casa", "forecast") [0].temperature }}ºC
You can also make it easier to manage in the future if entity_id’s change by making a variable
service: notify.notify
data:
title: Previsão do tempo para amanhã
message: >-
{% set forecast = state_attr("weather.casa", "forecast")[0] %}
{% if forecast.condition == 'sunny' %}
Ensolarado
{% else %}
*Erro*
{% endif %}
com minimas de {{ forecast.templow }}ºC e máximas de {{ forecast.temperature }}ºC
With “forecast” i filter by the forecast, and with [0].condition i filter by the first line after forecast.
I tried to make this work, but codding isn’t my skills by now…