I was using the dark sky precipitation sensor in some automations to change behavior based on the current precipitation. In the past I just used the dark sky precipitation sensor directly that that worked as I expected. It seems recently the sensor will now be set to rain/snow/sleet if there is any non-zero % probability of such precipitation occurring. Now even when it is a clear day outside the automations would think it was raining because dark sky might be reporting a 1-2% chance of rain which is not really what I want. My plan to fix this situation was to set up a template sensor that will output the precipitation type only if the probability exceeds some threshold, but I’m not sure what that threshold should be? Is there anyone else out there that has dealt with this problem and found a good value for the probability threshold? Is there some other more reliable sensor value I am missing?
I’m not sure how much use it will be but here is my sensor:
- platform: template
sensors:
predict_rain_today:
friendly_name: 'Predicted Rain Today'
entity_id:
- sensor.bom_hobart_chance_of_rain_0 # always a single int e.g. 50 for 50%
- sensor.bom_hobart_possible_rainfall_0 # two formats. Single int or "int_1 to int_2" e.g. "3 to 4"
unit_of_measurement: mm
value_template: >
{% set chance = states('sensor.bom_hobart_chance_of_rain_0')|int /100 %}
{% if 'to' in states('sensor.bom_hobart_possible_rainfall_0') %}
{% set amount = states('sensor.bom_hobart_possible_rainfall_0').split(' to ') %}
{% set amount1 = amount[0] | float %}
{% set amount2 = amount[1] | float %}
{% set amount_avg = (amount1 + amount2) / 2 %}
{% else %}
{% set amount_avg = states('sensor.bom_hobart_possible_rainfall_0') | int %}
{% endif %}
{{ (chance * amount_avg)|round(1) }}
It takes the predicted amount of rain (or the average of the predicted range of possible rainfall) and multiplies it by the percent chance of rain to give a single value. I compare this with an input number to fine tune my irrigation control:
- platform: template
sensors:
rain_today_limit:
friendly_name: 'Rain Today Limit (AM & PM)'
entity_id:
- sensor.bom_hobart_rain_today
- sensor.predict_rain_today
- input_number.rain_limit
value_template: "{{ ( states('sensor.bom_hobart_rain_today')|float >= states('input_number.rain_limit')|float ) or ( states('sensor.predict_rain_today')|float >= states('input_number.rain_limit')|float ) }}"
Isn’t BOM just Australian weather?
I used to do something similar though using Darksky but I was never that happy with the results.
Now I use Smartweather. If you (@jaminh) are lucky enough to have any Smartweather stations near you there is a Custom Component or you can use a REST sensor. Smartweather can provide actual rainfall data for today and yesterday.
Look here https://smartweather.weatherflow.com/map to find stations near you and
look here SmartWeather - Get local weather data combined with Dark Sky Forecast for the CC
Well yeah which Tom uses… just an example of how you can use probability and expected rainfall to calculate a number you could use to trigger an automation… the source isn’t as relevant as the principle.
I’m just using it as a condition to perform an action only if it is currently raining. I probably need to brush up on my statistics but my thought is I should be able to adjust the probability threshold based on my tolerance for false positives/false negatives. I would think increasing the threshold decreases the likelihood that the sensor will report it is raining when it is not but may increase the likelihood that the sensor reports its not raining even though it is. Is that a valid way to think about it? My plan currently is to just observe the data for awhile and try to set the threshold based on intuition. My hope was that either someone has already gone through this exercise and could lend me some insight, or perhaps someone would offer me a free stats lesson and I could take a more mathematical approach. If not I’ll report back with my observations after we get some rainy or snowy weather around here.
Is it only me, or precip_intensity and precip_propability sensors dont work anymore? im constantly getting 0 values.