Hi! That would be really helpful! How do I install it? I read the info.md, but I’m not sure what HACS is
A screenshot would be helpful.
These are perfectly valid values, but i’ve blurred them because I’m sure someone could find my location if they tried.
Hi, I’m using the hourly forecast for the next 8 houres and created a template sensor
8_hour_rain_forecast_total:
friendly_name: "Regenvorhersage heute"
value_template: "{{( states('sensor.yr_precipitation') |float + states('sensor.yr_forecast_1_precipitation') |float + states('sensor.yr_forecast_2_precipitation') |float + states('sensor.yr_forecast_3_precipitation') |float + states('sensor.yr_forecast_4_precipitation') |float + states('sensor.yr_forecast_5_precipitation') |float + states('sensor.yr_forecast_6_precipitation') |float + states('sensor.yr_forecast_7_precipitation') |float + states('sensor.yr_forecast_8_precipitation') |float) |round(1)}}"
unit_of_measurement: "mm"
I use this differently: to tell me in the morning if it will rain, to set the irrigation boolean etc.
Ah, by the way an example of the YR sensors
- platform: weather_data
name: YR-Forecast-6
forecast: 6
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-7
forecast: 7
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
And that’s what it looks like in lovelace:
That’s also really helpful! Thanks!
I put it in the template developer tool tab
and I get
Result type: string
8_hour_rain_forecast_total:
friendly_name: "Regenvorhersage heute"
value_template: "0.0"
unit_of_measurement: "mm"
I don’t think that is correct.
Do I need to change something? (eg weather service, etc)
Also, could you explain how I would add this to the automation?
Do I paste it in the Template condition type?
LMGTFY: https://www.google.com/search?q=hacs
HACS - Home Assistant Community Store
https://hacs.xyz/
Hi,
in your configuration.yaml you have to add the YR sensors as I gave you in my two examples.
If you want the forecast for 8 hours, then you need 8 sensors at least with precipitation.
The template sensor simply calculates a total of all 8 precipitations in mm.
You can reduce that to less sensors according the accurateness you need
the forecast_sensor can be used in templates either as trigger or simply in order to post the value to alexa or as notification.
I understand.
The sensors are created in configuration.yaml
and the template goes in the automation.
Thanks.
I’m incredibly out of my depth with HA!
The template is a sensor as well and has to be configured in configuration.yaml:
- platform: template
sensors:
8_hour_rain_forecast_total:
friendly_name: "Regenvorhersage heute"
value_template: "{{( states('sensor.yr_precipitation') |float + states('sensor.yr_forecast_1_precipitation') |float + states('sensor.yr_forecast_2_precipitation') |float + states('sensor.yr_forecast_3_precipitation') |float + states('sensor.yr_forecast_4_precipitation') |float + states('sensor.yr_forecast_5_precipitation') |float + states('sensor.yr_forecast_6_precipitation') |float + states('sensor.yr_forecast_7_precipitation') |float + states('sensor.yr_forecast_8_precipitation') |float) |round(1)}}"
unit_of_measurement: "mm"
Getting errors with my configuration after adding this.
Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/configuration.yaml", line 2, column 1
expected <block end>, but found '-'
in "/config/configuration.yaml", line 14, column 1
Show us your config, so we can have a look.
Duh!
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
- platform: template
sensors:
8_hour_rain_forecast_total:
friendly_name: "Regenvorhersage heute"
value_template: "{{( states('sensor.yr_precipitation') |float + states('sensor.yr_forecast_1_precipitation') |float + states('sensor.yr_forecast_2_precipitation') |float + states('sensor.yr_forecast_3_precipitation') |float + states('sensor.yr_forecast_4_precipitation') |float + states('sensor.yr_forecast_5_precipitation') |float + states('sensor.yr_forecast_6_precipitation') |float + states('sensor.yr_forecast_7_precipitation') |float + states('sensor.yr_forecast_8_precipitation') |float) |round(1)}}"
unit_of_measurement: "mm"
- platform: weather_data
name: YR-Forecast-1
forecast: 1
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-2
forecast: 2
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-3
forecast: 3
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-4
forecast: 4
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-5
forecast: 5
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-6
forecast: 6
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-7
forecast: 7
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
- platform: weather_data
name: YR-Forecast-8
forecast: 8
monitored_conditions:
- symbol
- temperature
- precipitation
- windSpeed
You need to check indentation.
- platform: template
sensors:
8_hour_rain_forecast_total:
friendly_name: "Regenvorhersage heute"
value_template: "{{( states('sensor.yr_precipitation') |float + states('sensor.yr_forecast_1_precipitation') |float + states('sensor.yr_forecast_2_precipitation') |float + states('sensor.yr_forecast_3_precipitation') |float + states('sensor.yr_forecast_4_precipitation') |float + states('sensor.yr_forecast_5_precipitation') |float + states('sensor.yr_forecast_6_precipitation') |float + states('sensor.yr_forecast_7_precipitation') |float + states('sensor.yr_forecast_8_precipitation') |float) |round(1)}}"
unit_of_measurement: "mm"
As soon as I add your code snippet it causes similar errors.
If I try myself it errors too.
I’ve ran it through YAML Validators - it say it’s okay, but HA seems to disagree.
This 8_hour_… line in your config is indented with 3 spaces but should be 2 (so remove 1).
And another error: all blocks starting with - platform
should be indented completely with 2 spaces and all those blocks should be preceded with sensor:
like this:
sensor:
- platform: template
sensors:
8_hour...:
- platform: weather_data
name: etc...
forecast: ...
monitored_conditions:
- ...
- ...
- platform: weather_data
name: etc...
sensor:
- platform: template
sensors:
8_hour_rain_forecast_total:
friendly_name: "8 Hour Rain"
value_template: "{{( states('sensor.yr_precipitation') |float + states('sensor.yr_forecast_1_precipitation') |float + states('sensor.yr_forecast_2_precipitation') |float + states('sensor.yr_forecast_3_precipitation') |float + states('sensor.yr_forecast_4_precipitation') |float + states('sensor.yr_forecast_5_precipitation') |float + states('sensor.yr_forecast_6_precipitation') |float + states('sensor.yr_forecast_7_precipitation') |float + states('sensor.yr_forecast_8_precipitation') |float) |round(1)}}"
unit_of_measurement: "mm"
I’ve got this now.
I can’t validate it though, the wheel just keeps spinning
cc @metbril