hey guys,
Newby here,
I installed a component predicting the precipitation.
Buienalarm custom_component for Home-Assistant
sensor:
- platform: buienalarm
timeframe: 15
name: buienalarm
monitored_conditions:
- temperature
- precipitation
- precipitation_forecast_average
- precipitation_forecast_total
- next_rain_forecast
but the next_rain_forecast entity is only outputting:
-1 that is : No rain forecast withing timeframe
0 that is : It is currently raining
N that is : Rain is forecast within N minutes
and the default unit_of_measurement is minutes
so the outcome is one of the following:
next_rain_forecast -1 minutes
next_rain_forecast 0 minues
next_rain_forecast N minutes
in my opinion ugly as h.ll
I want a simple string as output aka state:
State -1: “It is dry”
State 0: “It is Raining”
State >0: “It will be raining within " & state & " minutes”
so fork it and rewrite the sensor.py file, or try to change the state value by
changing it in Home Assistant.
I chose the latter, but man what a pain is yaml, I thought I could write an entry in customize.yaml,
add a few if then statements and be done with it. Two days later still errors…
This is my attempt: (in customize.yaml)
sensor.buienalarm_next_rain_forecast:
unit_of_measurement: false #dont need units it will be plain strings
friendly_name: Vooruitzicht #Dutch for prospect
tried the following if then else approaches:
{% set count = states(sensor.buienalarm_next_rain_forecast) | int %}
{% if count == -1 %}
{% set state = 'It is dry' %}
{% endif %}"
Error:
missed comma between flow collection entries at line x, column 2:
{% set count = states(sensor.buie …
^
ok something about quotes according to google:
so retry
"{% set count = states(sensor.buienalarm_next_rain_forecast) | int %}"
"{% if count == -1 %}"
"{% set state = 'It is dry' %}"
"{% endif %}"
Nop still doesnt do it:
Error:
can not read an implicit mapping pair; a colon is missed at line x, column 69:
… larm_next_rain_forecast)|int %}"
^
new approach
condition:
- condition: template
value_template: "{% is_state('sensor.buienalarm_next_rain_forecast', -1) %}"
And just as you think you got something, bang ERROR extra keys not allowed @ data[‘customize’][‘condition’]
I tried most of the solutions found on google but I give up… anyone…???
Regards Frank