Improving local 433mhz weather sensor integration.

This commit is contained in:
Jeffrey Stone 2020-08-27 21:07:15 -04:00
parent a80770477d
commit 957ddc6e34
4 changed files with 112 additions and 92 deletions

View File

@ -559,9 +559,17 @@ script:
'We should celebrate.', 'We should celebrate.',
'I will leave the party planning up to <emphasis>you</emphasis>.', 'I will leave the party planning up to <emphasis>you</emphasis>.',
'I bet <emphasis>you</emphasis> are glad I told you.', 'I bet <emphasis>you</emphasis> are glad I told you.',
'Wait. <emphasis>Really.</emphasis> That cannot be a <emphasis>Real</emphasis> holiday.',
'Wait. <emphasis>That</emphasis> is a <emphasis>Real</emphasis> holiday.',
'You <emphasis>cannot</emphasis> make this stuff up.', 'You <emphasis>cannot</emphasis> make this stuff up.',
'But, <emphasis>that</emphasis> just sounds silly.', 'But, <emphasis>that</emphasis> just sounds silly.',
'I bet <emphasis>you</emphasis> did not know that. But, <emphasis>now </emphasis> you do. And the more you know.' 'You did not know did <emphasis>you</emphasis>? But, <emphasis>now </emphasis> you do.'
]|random }}
{{ [
'Anyway.',
'Moving On.',
'Back to the morning announcements.',
'Right.'
]|random }} ]|random }}
{%- endif -%} {%- endif -%}
{% endmacro %} {% endmacro %}
@ -580,11 +588,11 @@ script:
{% macro current_conditions_outside() %} {% macro current_conditions_outside() %}
{{ [ {{ [
'According to the National Weather Service,', 'According to the National Weather Service,',
'Checking my weather sensors,', 'Checking the weather,',
'Looking outside,' 'Looking outside,'
]|random }} ]|random }}
It is currently {{states.weather.home_2.state}} and {{states.nws_current_temperature.state|round}} degrees in Grayson. It is currently {{states.weather.home_2.state}} and {{states.nws_current_temperature.state|round}} degrees in Grayson.
The back porch is {{states.sensor.back_porch_temperature.state|round}} degrees. The back porch is {{states.sensor.back_porch.state|round}} degrees.
{% endmacro %} {% endmacro %}
{% macro current_conditions_inside() %} {% macro current_conditions_inside() %}
@ -592,7 +600,7 @@ script:
{% if is_state('climate.home', 'heat_cool') %} {% if is_state('climate.home', 'heat_cool') %}
{{ [ {{ [
'The Climate is set to auto which should keep the internal temperature between ', 'The Climate is set to auto which should keep the internal temperature between ',
'The internal climate should be keep between ', 'The internal climate should be between ',
'The house is configured to keep the temperature between ' 'The house is configured to keep the temperature between '
]|random }} ]|random }}
{{states.climate.home.attributes.target_temp_low}} and {{states.climate.home.attributes.target_temp_high}} degrees. {{states.climate.home.attributes.target_temp_low}} and {{states.climate.home.attributes.target_temp_high}} degrees.
@ -607,7 +615,7 @@ script:
{% endmacro %} {% endmacro %}
{% macro current_conditions_garage() %} {% macro current_conditions_garage() %}
The garage is {{states.sensor.garage_temperature.state|round}} degrees with a humidity of {{states.sensor.garage_humidity.state|round}} percent. The garage is {{states.sensor.garage.state|round}} degrees with a humidity of {{states.sensor.garage.attributes.humidity|round}} percent.
{% endmacro %} {% endmacro %}
{% macro daily_forecast() %} {% macro daily_forecast() %}
@ -640,7 +648,8 @@ script:
{{ [ 'The temperature is expected to be near or below freezing. <emphasis>Someone</emphasis> might want to bring the lemon tree in. ', {{ [ 'The temperature is expected to be near or below freezing. <emphasis>Someone</emphasis> might want to bring the lemon tree in. ',
'It appears that it will be cold tonight. Like, the turn water solid <emphasis>kind</emphasis> of cold. Think of the poor plants.', 'It appears that it will be cold tonight. Like, the turn water solid <emphasis>kind</emphasis> of cold. Think of the poor plants.',
'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on <emphasis>you</emphasis>.', 'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on <emphasis>you</emphasis>.',
'I would say winter is coming. But, based on the weather forecast <emphasis>it</emphasis> appears to be here. Grab the Dragon glass.' 'I would say winter is coming. But, based on the weather forecast <emphasis>it</emphasis> appears to be here.',
'It will be freezing cold tonight. I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.'
] | random }} ] | random }}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
@ -655,9 +664,7 @@ script:
{% if states.sensor.birthday_kat.state | int == 1 %} {% if states.sensor.birthday_kat.state | int == 1 %}
Tomorrow is Katherine's Birthday. Tomorrow is Katherine's Birthday.
{% endif %} {% endif %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
{% endmacro %} {% endmacro %}
{% macro upcoming_holidays() %} {% macro upcoming_holidays() %}
@ -665,7 +672,7 @@ script:
Tomorrow is Halloween. I hope you have picked out a costume. Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ', {{ [ 'I will be going as a dumb home. ',
'I have prepped the scary music. Just in case.', 'I have prepped the scary music. Just in case.',
'I will be going as HAL 9000. The Pod Bay Doors are being installed today.' 'I will be going as HAL 9000. The Pod Bay Doors are being installed today. I <emphasis>dare</emphasis> you to ask me to open them. '
] | random }} ] | random }}
{% elif states.sensor.halloween_countdown.state | int < 30 %} {% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.holiday_halloween.state}} days There are only {{states.sensor.holiday_halloween.state}} days
@ -679,7 +686,7 @@ script:
{% endif %} {% endif %}
{% if states.sensor.christmas_countdown.state | int == 1 %} {% if states.sensor.christmas_countdown.state | int == 1 %}
Tomorrow is Christmas. <break time="2s"/> It is practically here! <break time="2s"/> Santa is coming tonight! Do not forget the cookies! Tomorrow is Christmas. <break time="1s"/> It is practically here! <break time="1s"/> Santa is coming tonight! Do not forget the cookies!
{% elif states.sensor.christmas_countdown.state | int < 31 %} {% elif states.sensor.christmas_countdown.state | int < 31 %}
There are only {{states.sensor.christmas_countdown.state}} days until christmas. There are only {{states.sensor.christmas_countdown.state}} days until christmas.
{{ [ 'All I want for Christmas, is a hippopotamus.', {{ [ 'All I want for Christmas, is a hippopotamus.',
@ -748,7 +755,7 @@ script:
] | random }} ] | random }}
{% else %} {% else %}
{% set month=states("sensor.date").split('-')[1] | int %} {% set month=states("sensor.date").split('-')[1] | int %}
{%- if month == 5 or month == 6 or month == 7 or month == 8 -%} {%- if is_state('input_boolean.school_in_session', 'off') -%}
{{ [ 'Looks like tomorrow is another day of summer vacation. ', {{ [ 'Looks like tomorrow is another day of summer vacation. ',
'You are still on summer break tomorrow. ', 'You are still on summer break tomorrow. ',
'Summer vacation does not last forever, but it is not over yet. ' 'Summer vacation does not last forever, but it is not over yet. '
@ -796,7 +803,7 @@ script:
{% macro school_today() %} {% macro school_today() %}
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
Because you have Digital Learning today! Because you have school today!
{% if states.calendar.skylar_school.attributes.description == 'early-release' %} {% if states.calendar.skylar_school.attributes.description == 'early-release' %}
And guess what? It is early release! And guess what? It is early release!
{% endif %} {% endif %}
@ -834,13 +841,13 @@ script:
{% endif %} {% endif %}
{% set month=states("sensor.date").split('-')[1] | int %} {% set month=states("sensor.date").split('-')[1] | int %}
{% if is_state('sensor.school_tomorrow', 'off') and states.sensor.school_start_days2go.state | int > 1 and month == 5 or month == 6 or month == 7 or month == 8 %} {% if is_state('input_boolean.school_in_session', 'off') %}
{{ [ 'If you were not aware there are ', {{ [ 'If you were not aware there are ',
'You only have ', 'You only have ',
'You still have ' 'You still have '
] | random }} ] | random }}
{{ states.sensor.school_start_days2go.state }} days left of summer break. {{ states.sensor.school_start_days2go.state }} days left of summer break.
{% elif is_state('sensor.school_tomorrow', 'on') and month == 8 %} {% elif is_state('sensor.school_tomorrow', 'on') and is_state('input_boolean.school_in_session', 'off') and month == 8 %}
Tomorrow is the first day of school! Which means today is the last day of summer break. I hope you make it a good one. Tomorrow is the first day of school! Which means today is the last day of summer break. I hope you make it a good one.
{% endif %} {% endif %}
@ -862,11 +869,11 @@ script:
] | random }} ] | random }}
today. So I suggest wearing shorts. today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %} {% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be a It is going to be
{{ [ 'bit warm ', {{ [ 'bit warm ',
'rather warm outside ', ' rather warm outside ',
'almost too hot outside ', ' almost too hot outside ',
'a little warm ', ' a little warm ',
] | random }} ] | random }}
today. So I suggest wearing shorts. today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %} {% elif is_state('sensor.clothing_forecast', 'Hot') %}

View File

@ -51,6 +51,34 @@ sensor:
- platform: nws_alerts - platform: nws_alerts
zone_id: 'GAZ034,GAC135' zone_id: 'GAZ034,GAC135'
- platform: mqtt
name: "Back Porch"
state_topic: "house/acurite2mqtt/Acurite-6045M_3078"
unit_of_measurement: '°F'
value_template: "{{ value_json.temperature_F }}"
json_attributes_topic: "house/acurite2mqtt/Acurite-6045M_3078"
device_class: temperature
- platform: mqtt
name: "Garage"
state_topic: "house/acurite2mqtt/Acurite-609TXC_73"
unit_of_measurement: '°F'
value_template: "{{ value_json.temperature_F }}"
json_attributes_topic: "house/acurite2mqtt/Acurite-609TXC_73"
device_class: temperature
- platform: mqtt
name: "Crawlspace"
state_topic: "house/acurite2mqtt/Acurite-Tower_10968"
unit_of_measurement: '°F'
value_template: "{{ value_json.temperature_F }}"
json_attributes_topic: "house/acurite2mqtt/Acurite-Tower_10968"
device_class: temperature
- platform: mqtt
name: "Lightning total count"
state_topic: "house/lightning/total_count"
- platform: template - platform: template
sensors: sensors:
flood_watch: flood_watch:
@ -143,6 +171,7 @@ sensor:
{% else %} {% else %}
inactive inactive
{% endif %} {% endif %}
automation: automation:
- alias: 'NWS Weather Alert Pop Up Control' - alias: 'NWS Weather Alert Pop Up Control'
@ -316,15 +345,9 @@ automation:
- alias: Lightning Detected - alias: Lightning Detected
trigger: trigger:
- platform: state
entity_id: binary_sensor.lightning_detected
from: 'off'
to: 'on'
- platform: template - platform: template
value_template: '{{ states.sensor.lightning_strike_count.state | int > states.sensor.lightning_total_count.state | int }}' value_template: '{{ states.sensor.back_porch.attributes.strike_count | int > states.sensor.lightning_total_count.state | int }}'
condition: condition:
- condition: template
value_template: '{{ states.sensor.lightning_strike_count.state | int > states.sensor.lightning_total_count.state | int }}'
- condition: state - condition: state
entity_id: input_boolean.lightning_warning entity_id: input_boolean.lightning_warning
state: 'off' state: 'off'
@ -340,18 +363,13 @@ automation:
- alias: Lightning Warning Off - alias: Lightning Warning Off
mode: restart
trigger: trigger:
- platform: state
entity_id: binary_sensor.lightning_detected
from: 'on'
to: 'off'
- platform: template - platform: template
value_template: '{{ states.sensor.lightning_strike_count.state | int == states.sensor.lightning_total_count.state | int }}' value_template: '{{ states.sensor.back_porch.attributes.strike_count | int == states.sensor.lightning_total_count.state | int }}'
for: for:
minutes: 20 minutes: 20
condition: condition:
- condition: template
value_template: '{{ states.sensor.lightning_strike_count.state | int == states.sensor.lightning_total_count.state | int }}'
- condition: state - condition: state
entity_id: input_boolean.lightning_warning entity_id: input_boolean.lightning_warning
state: 'on' state: 'on'

View File

@ -65,11 +65,11 @@
days: 7 days: 7
- platform: statistics - platform: statistics
name: Outside Temp Stats name: Outside Temp Stats
entity_id: sensor.back_porch_temperature entity_id: sensor.back_porch
sampling_size: 500 sampling_size: 500
- platform: statistics - platform: statistics
name: Garage Temp Stats name: Garage Temp Stats
entity_id: sensor.garage_temperature entity_id: sensor.garage
sampling_size: 500 sampling_size: 500
- platform: min_max - platform: min_max
name: Inside Temp Stats name: Inside Temp Stats

View File

@ -35,67 +35,62 @@
# seconds: 0 # seconds: 0
# milliseconds: 0 # milliseconds: 0
## Accurite 158 - Crawlspace ## Accurite 158 - Crawlspace
- platform: mqtt # - platform: mqtt
name: "Crawlspace Temperature" # name: "Crawlspace Temperature"
state_topic: "house/acurite-158/temperature" # state_topic: "house/acurite-158/temperature"
device_class: temperature # device_class: temperature
- platform: mqtt # - platform: mqtt
name: "Crawlspace Humidity" # name: "Crawlspace Humidity"
state_topic: "house/acurite-158/humidity" # state_topic: "house/acurite-158/humidity"
device_class: humidity # device_class: humidity
- platform: mqtt # - platform: mqtt
name: "Crawlspace Model" # name: "Crawlspace Model"
state_topic: "house/acurite-158/model" # state_topic: "house/acurite-158/model"
- platform: mqtt # - platform: mqtt
name: "Crawlspace lupdate" # name: "Crawlspace lupdate"
state_topic: "house/acurite-158/last_update" # state_topic: "house/acurite-158/last_update"
device_class: timestamp # device_class: timestamp
## Accurite 10968 - Garage ## Accurite 10968 - Garage
- platform: mqtt # - platform: mqtt
name: "Garage Temperature" # name: "Garage Temperature"
state_topic: "house/acurite-10968/temperature" # state_topic: "house/acurite-10968/temperature"
device_class: temperature # device_class: temperature
- platform: mqtt # - platform: mqtt
name: "Garage Humidity" # name: "Garage Humidity"
state_topic: "house/acurite-10968/humidity" # state_topic: "house/acurite-10968/humidity"
device_class: humidity # device_class: humidity
- platform: mqtt # - platform: mqtt
name: "Garage Model" # name: "Garage Model"
state_topic: "house/acurite-10968/model" # state_topic: "house/acurite-10968/model"
- platform: mqtt # - platform: mqtt
name: "Garage lupdate" # name: "Garage lupdate"
state_topic: "house/acurite-10968/last_update" # state_topic: "house/acurite-10968/last_update"
device_class: timestamp # device_class: timestamp
## Accurite 6045M - Back Porch # ## Accurite 6045M - Back Porch
- platform: mqtt # - platform: mqtt
name: "Back Porch Temperature" # name: "Back Porch Temperature"
state_topic: "house/acurite-6045M/temperature" # state_topic: "house/acurite-6045M/temperature"
device_class: temperature # device_class: temperature
- platform: mqtt # - platform: mqtt
name: "Back Porch Humidity" # name: "Back Porch Humidity"
state_topic: "house/acurite-6045M/humidity" # state_topic: "house/acurite-6045M/humidity"
device_class: humidity # device_class: humidity
- platform: mqtt # - platform: mqtt
name: "Back Porch Model" # name: "Back Porch Model"
state_topic: "house/acurite-6045M/model" # state_topic: "house/acurite-6045M/model"
- platform: mqtt # - platform: mqtt
name: "Back Porch lupdate" # name: "Back Porch lupdate"
state_topic: "house/acurite-6045M/last_update" # state_topic: "house/acurite-6045M/last_update"
device_class: timestamp # device_class: timestamp
- platform: mqtt # - platform: mqtt
name: "Lightning Strike Count" # name: "Lightning Strike Count"
state_topic: "house/acurite-6045M/lightning_count" # state_topic: "house/acurite-6045M/lightning_count"
- platform: mqtt # - platform: mqtt
name: "Lightning Storm Distance" # name: "Lightning Storm Distance"
state_topic: "house/acurite-6045M/storm_dist" # state_topic: "house/acurite-6045M/storm_dist"
- platform: mqtt
name: "Lightning total count"
state_topic: "house/lightning/total_count"
- platform: statistics - platform: statistics