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.',
'I will leave the party planning up to <emphasis>you</emphasis>.',
'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.',
'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 }}
{%- endif -%}
{% endmacro %}
@ -580,11 +588,11 @@ script:
{% macro current_conditions_outside() %}
{{ [
'According to the National Weather Service,',
'Checking my weather sensors,',
'Checking the weather,',
'Looking outside,'
]|random }}
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 %}
{% macro current_conditions_inside() %}
@ -592,7 +600,7 @@ script:
{% if is_state('climate.home', 'heat_cool') %}
{{ [
'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 '
]|random }}
{{states.climate.home.attributes.target_temp_low}} and {{states.climate.home.attributes.target_temp_high}} degrees.
@ -607,7 +615,7 @@ script:
{% endmacro %}
{% 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 %}
{% 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. ',
'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 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 }}
{% endif %}
{% endmacro %}
@ -655,9 +664,7 @@ script:
{% if states.sensor.birthday_kat.state | int == 1 %}
Tomorrow is Katherine's Birthday.
{% endif %}
{% if states.sensor.anniversary_our_wedding.state | int == 1 %}
Tomorrow is Jeff and Katherine's Wedding Anniversary.
{% endif %}
{% endmacro %}
{% macro upcoming_holidays() %}
@ -665,7 +672,7 @@ script:
Tomorrow is Halloween. I hope you have picked out a costume.
{{ [ 'I will be going as a dumb home. ',
'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 }}
{% elif states.sensor.halloween_countdown.state | int < 30 %}
There are only {{states.sensor.holiday_halloween.state}} days
@ -679,7 +686,7 @@ script:
{% endif %}
{% 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 %}
There are only {{states.sensor.christmas_countdown.state}} days until christmas.
{{ [ 'All I want for Christmas, is a hippopotamus.',
@ -748,7 +755,7 @@ script:
] | random }}
{% else %}
{% 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. ',
'You are still on summer break tomorrow. ',
'Summer vacation does not last forever, but it is not over yet. '
@ -796,7 +803,7 @@ script:
{% macro school_today() %}
{% 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' %}
And guess what? It is early release!
{% endif %}
@ -834,13 +841,13 @@ script:
{% endif %}
{% 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 ',
'You only have ',
'You still have '
] | random }}
{{ 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.
{% endif %}
@ -862,11 +869,11 @@ script:
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be a
It is going to be
{{ [ 'bit warm ',
'rather warm outside ',
'almost too hot outside ',
'a little warm ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}

View File

@ -51,6 +51,34 @@ sensor:
- platform: nws_alerts
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
sensors:
flood_watch:
@ -143,6 +171,7 @@ sensor:
{% else %}
inactive
{% endif %}
automation:
- alias: 'NWS Weather Alert Pop Up Control'
@ -316,15 +345,9 @@ automation:
- alias: Lightning Detected
trigger:
- platform: state
entity_id: binary_sensor.lightning_detected
from: 'off'
to: 'on'
- 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: template
value_template: '{{ states.sensor.lightning_strike_count.state | int > states.sensor.lightning_total_count.state | int }}'
- condition: state
entity_id: input_boolean.lightning_warning
state: 'off'
@ -340,18 +363,13 @@ automation:
- alias: Lightning Warning Off
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.lightning_detected
from: 'on'
to: 'off'
- 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:
minutes: 20
condition:
- condition: template
value_template: '{{ states.sensor.lightning_strike_count.state | int == states.sensor.lightning_total_count.state | int }}'
- condition: state
entity_id: input_boolean.lightning_warning
state: 'on'

View File

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

View File

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