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 %}
There is lightning in the area. Nearest strike is {{ ltgdist }} miles away.
{% 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!
{% endif %}
{% if state_attr('weather.iron_nerd_weather_station','visibility') | int < 3 %}
@ -65,7 +65,7 @@
] | random }}
"The nearest lightning strike is {{ ltgdist }} miles away. "
{% 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. ",
"If you look outside the window, you will notice, it wainin. ",

View File

@ -159,38 +159,38 @@ weather:
{{ states(result) | float }}
precipitation_unit: in
binary_sensor:
- platform: bayesian
unique_id: 3e9640d9-57a0-4495-8731-e64b34774065
name: Raining Bayesian
prior: 0.17
probability_threshold: 0.6
observations:
- entity_id: "sensor.myradar_precip"
prob_given_true: 0.99
prob_given_false: 0.45
platform: "state"
to_state: "rain"
- entity_id: "sensor.pirateweather_precip"
prob_given_true: 0.13
prob_given_false: 0.005
platform: "state"
to_state: "rain"
- entity_id: "sensor.openweathermap_precipitation_kind"
prob_given_true: 0.75
prob_given_false: 0.005
platform: "state"
to_state: "rain"
- entity_id: "sensor.tomorrow_io_stratton_ave_precipitation_type"
prob_given_true: 0.99
prob_given_false: 0.2
platform: "state"
to_state: "rain"
- entity_id: "sensor.stratton_ave_precipitation"
prob_given_true: 0.99
prob_given_false: 0.2
platform: "numeric_state"
above: 0
# binary_sensor:
# - platform: bayesian
# unique_id: 3e9640d9-57a0-4495-8731-e64b34774065
# name: Raining Bayesian
# prior: 0.17
# probability_threshold: 0.6
# observations:
# - entity_id: "sensor.myradar_precip"
# prob_given_true: 0.99
# prob_given_false: 0.45
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.pirateweather_precip"
# prob_given_true: 0.13
# prob_given_false: 0.005
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.openweathermap_precipitation_kind"
# prob_given_true: 0.75
# prob_given_false: 0.005
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.tomorrow_io_stratton_ave_precipitation_type"
# prob_given_true: 0.99
# prob_given_false: 0.2
# platform: "state"
# to_state: "rain"
# - entity_id: "sensor.stratton_ave_precipitation"
# prob_given_true: 0.99
# prob_given_false: 0.2
# platform: "numeric_state"
# above: 0
sensor:
- platform: weatheralerts
@ -353,7 +353,26 @@ template:
{% else %}
common
{% 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:
- 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
unique_id: c0faea33-2ac3-40f1-8558-584c3f5d6b16
icon: mdi:weather-sunny

View File

@ -1593,7 +1593,7 @@ automation:
alias: Rain Window Warning
trigger:
- platform: state
entity_id: binary_sensor.raining_bayesian
entity_id: binary_sensor.raining
from: 'off'
to: 'on'
condition:
@ -1626,13 +1626,13 @@ automation:
who: everywhere
type: weather
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"
continue_on_timeout: true
- choose:
- conditions:
- 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:
- service: script.text_notify
data:
@ -1647,7 +1647,7 @@ automation:
message: "Windows are now closed. Thank you, and enjoy your dry house."
- conditions:
- condition: template
value_template: "{{ is_state('binary_sensor.raining_bayesian','off') }}"
value_template: "{{ is_state('binary_sensor.raining','off') }}"
sequence:
- service: script.text_notify
data:

View File

@ -88,7 +88,7 @@
] | random }}
{% endif %}
<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.
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %}