Home-AssistantConfig/config/packages/garadget.yaml

307 lines
10 KiB
YAML
Raw Normal View History

#-------------------------------------------
# # @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
## Garadget_Stuff - [Garadget](https://amzn.to/2jQLpVQ) - Garage Door opener/sensor
# Video and Write Up - https://www.vcloudinfo.com/2019/03/how-to-add-garadget-to-home-assistant.html
2020-05-03 22:12:24 +00:00
# Switch to Access_Tokens - https://www.vcloudinfo.com/2020/05/fixing-garadget-in-home-assistant.html
#-------------------------------------------
2020-07-05 17:12:31 +00:00
# cover:
# - platform: garadget
# covers:
# large_garage:
# device: !secret large_garage_id
# #username: !secret garadget_username
# #password: !secret garadget_password
# access_token: !secret garadget_access_token
# name: large_garage
# small_garage:
# device: !secret small_garage_id
# #username: !secret garadget_username
# #password: !secret garadget_password
# access_token: !secret garadget_access_token
# name: small_garage
cover:
2020-07-05 17:12:31 +00:00
- platform: mqtt
name: "Small Garage Door"
command_topic: "garadget/Garadget Small/command"
state_topic: "garadget/Garadget Small/status"
value_template: >-
{% if value_json.status == 'closed' %}
closed
{% else %}
open
{% endif %}
device_class: 'garage'
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
- platform: mqtt
name: "Large Garage Door"
command_topic: "garadget/Garadget Large/command"
state_topic: "garadget/Garadget Large/status"
value_template: >-
{% if value_json.status == 'closed' %}
closed
{% else %}
open
{% endif %}
device_class: 'garage'
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
# sensor:
# - platform: template
# sensors:
# small_garage_status:
# friendly_name: 'State of the door'
# entity_id: []
# value_template: '{{ states.cover.small_garage.state }}'
# small_garage_time_in_state:
# friendly_name: 'Time Since Change'
# entity_id: []
# value_template: '{{ states.cover.small_garage.attributes["time_in_state"] }}'
# small_garage_wifi_signal_strength:
# entity_id: []
# friendly_name: 'WiFi strength'
# value_template: '{{ states.cover.small_garage.attributes["wifi_signal_strength"] }}'
# unit_of_measurement: 'dB'
# small_garage_reflection_rate:
# entity_id: []
# friendly_name: 'Reflection Rate'
# value_template: '{{ states.cover.small_garage.attributes["sensor_reflection_rate"] }}'
- platform: mqtt
name: 'Small Garage Brightness'
state_topic: 'garadget/Garadget Small/status'
value_template: '{{ value_json.bright }}'
2020-06-08 15:52:47 +00:00
- platform: mqtt
name: 'Large Garage Brightness'
state_topic: 'garadget/Garadget Large/status'
value_template: '{{ value_json.bright }}'
2020-07-05 17:12:31 +00:00
# - platform: template
# sensors:
# large_garage_status:
# friendly_name: 'State of the door'
# entity_id: []
# value_template: '{{ states.cover.large_garage.state }}'
# large_garage_time_in_state:
# friendly_name: 'Time Since Change'
# entity_id: []
# value_template: '{{ states.cover.large_garage.attributes["time_in_state"] }}'
# large_garage_wifi_signal_strength:
# entity_id: []
# friendly_name: 'WiFi strength'
# value_template: '{{ states.cover.large_garage.attributes["wifi_signal_strength"] }}'
# unit_of_measurement: 'dB'
# large_garage_reflection_rate:
# entity_id: []
# friendly_name: 'Reflection Rate'
# value_template: '{{ states.cover.large_garage.attributes["sensor_reflection_rate"] }}'
group:
garage_doors: # This group is used to check if doors are open or Closed.
name: Garage Doors
entities:
- cover.large_garage
- cover.small_garage
######################################################################
## Garage Status Announcements - Only during normal hours.
######################################################################
automation:
- alias: 'Update Garage Brightness'
trigger:
- platform: time_pattern
2020-07-05 17:12:31 +00:00
minutes: '/1'
action:
- service: mqtt.publish
data:
topic: "garadget/Garadget Small/command"
payload: "get-status"
- service: mqtt.publish
data:
topic: "garadget/Garadget Large/command"
payload: "get-status"
2020-07-05 17:12:31 +00:00
- alias: 'Garage Door State Change'
trigger:
- platform: state
entity_id:
- cover.large_garage
- cover.small_garage
from: 'open'
to: 'closed'
for: '00:02:00'
- platform: state
entity_id:
- cover.large_garage
- cover.small_garage
from: 'closed'
to: 'open'
for: '00:02:30'
action:
# - service_template: >
# {% set hour=states("sensor.time").split(':')[0] | int %}
# {% if hour >= 7 and hour <= 9 and states.input_boolean.school_mode.state == 'on'%}
# input_boolean.turn_off
# {% else %}
# input_boolean.turn_on
# {% endif %}
# entity_id: input_boolean.alert_mode
- service: script.speech_engine
data_template:
DoorClosed: "The {{ trigger.entity_id.split('.')[1]|replace('_', ' ') }} is now {{ (trigger.to_state.state)|replace('_', ' ') }}."
call_garage_check: 1
###################################
## Garadget Wind Door Checks - [Garadget](https://amzn.to/2jQLpVQ)
###################################
- alias: 'Wind Speed Garage Door Check'
trigger:
- platform: numeric_state
entity_id: sensor.dark_sky_wind_speed
above: 20
condition:
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage') == 'opened' }}"
- condition: template
value_template: "{{ states('cover.small_garage') == 'opened'}}"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.alert_mode
- service: script.notify_engine
data_template:
title: 'Check/Close Garage Doors - High Speed Wind Alert:'
value1: "Small: {{ states('cover.small_garage')}}"
value2: "Large: {{ states('cover.large_garage')}}"
apns_id: 'information'
who: 'parents'
- service: script.speech_engine
data_template:
value1: >
"The winds are picking up outside. The wind speed is {{ states('sensor.dark_sky_wind_speed')|round}} miles per hour. For safety, please close the garage doors.
{% if is_state('cover.large_garage', 'open') -%}
The Large Garage Door is open
{% endif -%}
{% if is_state('cover.small_garage', 'open') -%}
{% if is_state('cover.large_garage', 'open') -%}and
{%- endif %} The small Garage Door is open.
{% endif %}"
- service: script.tweet_engine_image
data_template:
tweet: >
{{ [
"Wind speed is {{ states('sensor.dark_sky_wind_speed')|round}} miles per hour. For safety, I'm going to close the @garadget doors.",
"Getting pretty windy! {{ states('sensor.dark_sky_wind_speed')|round}}MPH. Time to ask @Garadget to close the garage doors."
] | random + "(https://amzn.to/2jQLpVQ)"}}
image: >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/windy.png"
] | random }}
- alias: Garadget Reflection Rates
trigger:
- platform: numeric_state
entity_id: sensor.large_garage_reflection_rate
below: 85
# for: '00:05:00'
- platform: numeric_state
entity_id: sensor.small_garage_reflection_rate
below: 85
# for: '00:05:00'
condition:
- condition: template
value_template: "{{ states('cover.large_garage') == 'closed' }}"
- condition: template
value_template: "{{ states('cover.small_garage') == 'closed' }}"
action:
- service: script.notify_engine
data_template:
title: 'Garage door Status Change:'
value1: "Small: {{ states('sensor.small_garage_reflection_rate')}}"
value2: "Large: {{ states('sensor.large_garage_reflection_rate')}}"
who: "parents"
content_type: 'jpeg'
url: !secret camera2_snapshot
apns_id: 'information'
##############################################################################
- alias: Is the Garage door Open at night - Checks every 30 minutes or 5 minutes after we drive away.
trigger:
- platform: time_pattern
minutes: '/45'
- platform: state
entity_id: group.family
to: not_home
for: 00:05:00
- platform: state
entity_id: input_boolean.tv_time
to: 'on'
from: 'off'
condition:
condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: group.family
state: not_home
for: 00:05:00
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage') == 'opened' }}"
- condition: template
value_template: "{{ states('cover.small_garage') == 'opened' }}"
- condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage') == 'opened' }}"
- condition: template
value_template: "{{ states('cover.small_garage') == 'opened'}}"
action:
- service: script.notify_engine
data_template:
title: 'Check Garage Doors:'
value1: "Small: {{ states('cover.small_garage')}}"
value2: "Large: {{ states('cover.large_garage')}}"
who: "family"
camera_entity: "camera.camera2"
apns_id: 'information'
- service: script.speech_engine
data_template:
value1: "Please check the garage doors. The Small garage is {{ states('cover.small_garage')}} and the large garage is {{ states('cover.large_garage')}}"