Switch methods of rain detection...again... #89

This commit is contained in:
2023-09-28 16:33:55 -04:00
parent 71b97e5e0e
commit 204599b4f4
4 changed files with 58 additions and 39 deletions

View File

@ -26,7 +26,7 @@
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %} {% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
There is lightning in the area. Nearest strike is {{ ltgdist }} miles away. There is lightning in the area. Nearest strike is {{ ltgdist }} miles away.
{% endif %} {% endif %}
{% if is_state('binary_sensor.raining_bayesian','on') %} {% if is_state('binary_sensor.raining','on') %}
It is currently raining. Make sure all doors and windows are closed! It is currently raining. Make sure all doors and windows are closed!
{% endif %} {% endif %}
{% if state_attr('weather.iron_nerd_weather_station','visibility') | int < 3 %} {% if state_attr('weather.iron_nerd_weather_station','visibility') | int < 3 %}
@ -65,7 +65,7 @@
] | random }} ] | random }}
"The nearest lightning strike is {{ ltgdist }} miles away. " "The nearest lightning strike is {{ ltgdist }} miles away. "
{% endif %} {% endif %}
{% if is_state('binary_sensor.raining_bayesian','on') %} {% if is_state('binary_sensor.raining','on') %}
{{ [ {{ [
"I have looked outside and determined that it is raining. ", "I have looked outside and determined that it is raining. ",
"If you look outside the window, you will notice, it wainin. ", "If you look outside the window, you will notice, it wainin. ",

View File

@ -159,38 +159,38 @@ weather:
{{ states(result) | float }} {{ states(result) | float }}
precipitation_unit: in precipitation_unit: in
binary_sensor: # binary_sensor:
- platform: bayesian # - platform: bayesian
unique_id: 3e9640d9-57a0-4495-8731-e64b34774065 # unique_id: 3e9640d9-57a0-4495-8731-e64b34774065
name: Raining Bayesian # name: Raining Bayesian
prior: 0.17 # prior: 0.17
probability_threshold: 0.6 # probability_threshold: 0.6
observations: # observations:
- entity_id: "sensor.myradar_precip" # - entity_id: "sensor.myradar_precip"
prob_given_true: 0.99 # prob_given_true: 0.99
prob_given_false: 0.45 # prob_given_false: 0.45
platform: "state" # platform: "state"
to_state: "rain" # to_state: "rain"
- entity_id: "sensor.pirateweather_precip" # - entity_id: "sensor.pirateweather_precip"
prob_given_true: 0.13 # prob_given_true: 0.13
prob_given_false: 0.005 # prob_given_false: 0.005
platform: "state" # platform: "state"
to_state: "rain" # to_state: "rain"
- entity_id: "sensor.openweathermap_precipitation_kind" # - entity_id: "sensor.openweathermap_precipitation_kind"
prob_given_true: 0.75 # prob_given_true: 0.75
prob_given_false: 0.005 # prob_given_false: 0.005
platform: "state" # platform: "state"
to_state: "rain" # to_state: "rain"
- entity_id: "sensor.tomorrow_io_stratton_ave_precipitation_type" # - entity_id: "sensor.tomorrow_io_stratton_ave_precipitation_type"
prob_given_true: 0.99 # prob_given_true: 0.99
prob_given_false: 0.2 # prob_given_false: 0.2
platform: "state" # platform: "state"
to_state: "rain" # to_state: "rain"
- entity_id: "sensor.stratton_ave_precipitation" # - entity_id: "sensor.stratton_ave_precipitation"
prob_given_true: 0.99 # prob_given_true: 0.99
prob_given_false: 0.2 # prob_given_false: 0.2
platform: "numeric_state" # platform: "numeric_state"
above: 0 # above: 0
sensor: sensor:
- platform: weatheralerts - platform: weatheralerts
@ -353,7 +353,26 @@ template:
{% else %} {% else %}
common common
{% endif %} {% endif %}
- name: Raining
unique_id: 232b43a4-4598-4315-ab76-42348c11e6ff
state: >
{{ states('sensor.total_rain_sensors') | int > 1 }}
icon: "{{ 'mdi:weather-rainy' if states('sensor.total_rain_sensors') | int > 1 else 'mdi:weather-cloudy' }}"
- sensor: - sensor:
- name: Total Rain Sensors
unique_id: b7c2e709-8f5c-4263-aa1d-fa8280afcddb
state: >
{% set sensors = [
states.sensor.pirateweather_precip,
states.sensor.openweathermap_precipitation_kind,
states.sensor.tomorrow_io_stratton_ave_precipitation_type
] %}
{% set numeric_sensors = [
states.sensor.stratton_ave_precipitation
] %}
{% set c1 = sensors | selectattr('state','eq','rain') | list | count %}
{% set c2 = numeric_sensors | map(attribute='state') | map('float') | select('gt',0) | list | count %}
{{ (c1 + c2) | int }}
- name: Current Forecast - name: Current Forecast
unique_id: c0faea33-2ac3-40f1-8558-584c3f5d6b16 unique_id: c0faea33-2ac3-40f1-8558-584c3f5d6b16
icon: mdi:weather-sunny icon: mdi:weather-sunny

View File

@ -1593,7 +1593,7 @@ automation:
alias: Rain Window Warning alias: Rain Window Warning
trigger: trigger:
- platform: state - platform: state
entity_id: binary_sensor.raining_bayesian entity_id: binary_sensor.raining
from: 'off' from: 'off'
to: 'on' to: 'on'
condition: condition:
@ -1626,13 +1626,13 @@ automation:
who: everywhere who: everywhere
type: weather type: weather
message: "It is raining and there are windows open in the house. Please close them!" message: "It is raining and there are windows open in the house. Please close them!"
- wait_template: "{{ is_state('binary_sensor.windows','off') or is_state('binary_sensor.raining_bayesian','off') }}" - wait_template: "{{ is_state('binary_sensor.windows','off') or is_state('binary_sensor.raining','off') }}"
timeout: "00:15:00" timeout: "00:15:00"
continue_on_timeout: true continue_on_timeout: true
- choose: - choose:
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_state('binary_sensor.windows','off') and is_state('binary_sensor.raining_bayesian','on') }}" value_template: "{{ is_state('binary_sensor.windows','off') and is_state('binary_sensor.raining','on') }}"
sequence: sequence:
- service: script.text_notify - service: script.text_notify
data: data:
@ -1647,7 +1647,7 @@ automation:
message: "Windows are now closed. Thank you, and enjoy your dry house." message: "Windows are now closed. Thank you, and enjoy your dry house."
- conditions: - conditions:
- condition: template - condition: template
value_template: "{{ is_state('binary_sensor.raining_bayesian','off') }}" value_template: "{{ is_state('binary_sensor.raining','off') }}"
sequence: sequence:
- service: script.text_notify - service: script.text_notify
data: data:

View File

@ -88,7 +88,7 @@
] | random }} ] | random }}
{% endif %} {% endif %}
<s>School today starts at {{ input_datetime_read('input_datetime.kallen_school_day_start') }}</s> <s>School today starts at {{ input_datetime_read('input_datetime.kallen_school_day_start') }}</s>
{% if is_state('binary_sensor.raining_bayesian','on') %} {% if is_state('binary_sensor.raining','on') %}
It appears to be raining right now, so you might get wet on your way to school. It appears to be raining right now, so you might get wet on your way to school.
{% endif %} {% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %} {% if is_state('input_boolean.kallen_alternate_pickup','on') %}