mirror of
https://github.com/skalavala/mysmarthome.git
synced 2025-09-14 07:24:42 +00:00
Back Alive!
This commit is contained in:
172
packages/alarm_clock.yaml
Executable file
172
packages/alarm_clock.yaml
Executable file
@@ -0,0 +1,172 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 09/30/2017
|
||||
# @package : Alarm Clock
|
||||
# @description : Alarm Clock; Added AM/PM Selects
|
||||
# TBD: Restore and Save previous values in MQTT
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
automation.alarm_clock:
|
||||
icon: mdi:alarm-check
|
||||
|
||||
input_number:
|
||||
slider_hours:
|
||||
name: Hours
|
||||
initial: 6
|
||||
min: 0
|
||||
max: 11
|
||||
step: 1
|
||||
|
||||
slider_minutes:
|
||||
name: Minutes
|
||||
initial: 0
|
||||
min: 0
|
||||
max: 59
|
||||
step: 5
|
||||
|
||||
input_boolean:
|
||||
week_day_only:
|
||||
name: Weekdays Only
|
||||
initial: on
|
||||
icon: mdi:calendar-check
|
||||
|
||||
am:
|
||||
name: AM
|
||||
initial: on
|
||||
icon: mdi:weather-sunny
|
||||
|
||||
pm:
|
||||
name: PM
|
||||
initial: off
|
||||
icon: mdi:weather-night
|
||||
|
||||
input_label:
|
||||
alarm_current_time:
|
||||
name: Current Alarm Time
|
||||
icon: mdi:timer
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
- alias: Update Current Alarm Time
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
- platform: state
|
||||
entity_id:
|
||||
- input_boolean.am
|
||||
- input_boolean.pm
|
||||
- input_number.slider_hours
|
||||
- input_number.slider_minutes
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
entity_id: input_label.alarm_current_time
|
||||
data_template:
|
||||
value: >
|
||||
{%- if states.input_number.slider_hours.state | int < 10 -%}
|
||||
{%- if states.input_number.slider_hours.state|int == 0 %}
|
||||
12
|
||||
{%- else -%}
|
||||
{{- 0 ~ states.input_number.slider_hours.state|int -}}
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{{- states.input_number.slider_hours.state |int -}}
|
||||
{% endif -%}:
|
||||
{%- if states.input_number.slider_minutes.state | int < 10 -%}
|
||||
{{- 0 ~ states.input_number.slider_minutes.state |int -}}
|
||||
{%- else -%}
|
||||
{{- states.input_number.slider_minutes.state|int -}}
|
||||
{%- endif -%}{%- if states.input_boolean.am.state == "on" %} AM{%- else %} PM{%- endif -%}
|
||||
|
||||
- alias: AM Change OFF
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.am
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.pm
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.am
|
||||
|
||||
- alias: AM Change ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.am
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.pm
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.am
|
||||
|
||||
- alias: PM Change OFF
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.pm
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.am
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.pm
|
||||
|
||||
- alias: PM Change ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.pm
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.am
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.pm
|
||||
|
||||
- alias: Alarm Clock
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/1'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('binary_sensor.workday_sensor') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.alarm_clock') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if states('input_boolean.am') == 'on' %}
|
||||
{% set hour = (states('input_number.slider_hours') | int) %}
|
||||
{% else %}
|
||||
{% set hour = (states('input_number.slider_hours') | int) + 12 %}
|
||||
{% endif %}
|
||||
{{ 'true' if states('sensor.time').split(':')[0] |int == hour else 'false' }}
|
||||
- condition: template
|
||||
value_template: "{{ 'true' if (states('sensor.time').split(':')[1] |int == states('input_number.slider_minutes') |int) else 'false' }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Alarm Clock: Wake Up!!!"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
"Hello! This is an alarm clock reminder! Have a great day!"
|
78
packages/apcups.yaml
Executable file
78
packages/apcups.yaml
Executable file
@@ -0,0 +1,78 @@
|
||||
# ###############################################################################
|
||||
# # @author : Mahasri Kalavala
|
||||
# # @date : 11/27/2017
|
||||
# # @package : APC UPS Backup
|
||||
# # @description : UPS Backup
|
||||
# ###############################################################################
|
||||
apcupsd:
|
||||
host: 127.0.0.1
|
||||
port: 3551
|
||||
|
||||
sensor:
|
||||
- platform: apcupsd
|
||||
# name: Network Backup UPS
|
||||
resources:
|
||||
- bcharge
|
||||
- linev
|
||||
- loadpct
|
||||
- nominv
|
||||
- numxfers
|
||||
- status
|
||||
- timeleft
|
||||
- tonbatt
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
- alias: UPS State Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.ups_status
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "UPS Status changed from {{ trigger.from_state.state }}
|
||||
to {{ trigger.to_state.state }}
|
||||
at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p, %B %d,%Y', true) }}."
|
||||
|
||||
# # Power Failure Notification
|
||||
# ###############################################################################
|
||||
- alias: Power Failure
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.ups_status
|
||||
from: 'ONLINE'
|
||||
to: 'ONBATT'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message:
|
||||
Power failure at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %B-%d,%Y', true) }}.
|
||||
Battery can last for {{ states.sensor.ups_time_left.state }} minutes.
|
||||
|
||||
# # Power Restored Notification
|
||||
# ###############################################################################
|
||||
- alias: Power Restored
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.ups_status
|
||||
from: 'ONBATT'
|
||||
to: 'ONLINE'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message:
|
||||
Power restored at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %B-%d,%Y', true) }}.
|
||||
Ran on battery for {{ "%0.2f" % (states.sensor.ups_time_on_battery.state | int / 60 |float) }} minutes.
|
154
packages/aroma.yaml
Executable file
154
packages/aroma.yaml
Executable file
@@ -0,0 +1,154 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
timer.timer_bathroom_aroma:
|
||||
hidden: true
|
||||
timer.timer_downstairs_aroma:
|
||||
hidden: true
|
||||
timer.timer_upstairs_aroma:
|
||||
hidden: true
|
||||
|
||||
timer:
|
||||
timer_bathroom_aroma:
|
||||
duration: '00:30:00'
|
||||
timer_downstairs_aroma:
|
||||
duration: '01:00:00'
|
||||
timer_upstairs_aroma:
|
||||
duration: '01:00:00'
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
#
|
||||
# Automations to start timer when they are switched ON
|
||||
#
|
||||
- alias: Bathroom Aroma Timer Start
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.downstairs_fragrance
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_bathroom_aroma
|
||||
|
||||
- alias: Bathroom Aroma Timer Finish
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.downstairs_fragrance
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
action:
|
||||
- service: timer.finish
|
||||
entity_id: timer.timer_bathroom_aroma
|
||||
|
||||
- alias: Downstairs Aroma Timer Start
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.downstairs_fragrance
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_downstairs_aroma
|
||||
|
||||
- alias: Downstairs Aroma Timer Finish
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.downstairs_fragrance
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
action:
|
||||
- service: timer.finish
|
||||
entity_id: timer.timer_downstairs_aroma
|
||||
|
||||
- alias: Upstairs Aroma Timer Start
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.upstairs_fragrance
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_upstairs_aroma
|
||||
|
||||
- alias: Upstairs Aroma Timer Finish
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.upstairs_fragrance
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
action:
|
||||
- service: timer.finish
|
||||
entity_id: timer.timer_upstairs_aroma
|
||||
|
||||
#
|
||||
# Timer Elapsed Events
|
||||
#
|
||||
- alias: Bathroom Aroma Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.timer_bathroom_aroma
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.downstairs_fragrance
|
||||
|
||||
- alias: Downstairs Aroma Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.timer_downstairs_aroma
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.downstairs_fragrance
|
||||
|
||||
- alias: Upstairs Aroma Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.timer_upstairs_aroma
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.upstairs_fragrance
|
||||
|
||||
#
|
||||
# Turn ON fragrance outlets automatically at specific times of the day
|
||||
#
|
||||
- alias: Turn On Upstairs Aroma
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '08:00:00'
|
||||
- platform: time
|
||||
at: '20:00:00'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.upstairs_fragrance
|
||||
|
||||
- alias: Turn On Downstairs Aroma
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '17:00:00'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.downstairs_fragrance
|
67
packages/away.yaml
Executable file
67
packages/away.yaml
Executable file
@@ -0,0 +1,67 @@
|
||||
# The following script runs when no one is home. It excludes some lights
|
||||
# and switches like front porch and backyard lights...etc for safety reasons.
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
script.all_indoor_lights_off:
|
||||
friendly_name: All Indoor Lights & Switches OFF
|
||||
|
||||
script:
|
||||
|
||||
home_mode_away:
|
||||
sequence:
|
||||
- service: script.all_indoor_lights_off
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.notify_camera_motion
|
||||
- service: climate.set_away_mode
|
||||
data:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: 'true'
|
||||
- service: alarm_control_panel.alarm_arm_away
|
||||
data:
|
||||
entity_id: alarm_control_panel.simplisafe
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: >
|
||||
No one is at home. Cameras rolling, Indoor lights OFF, Thermostat is set to 'away' and your home is secured!
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.kitchen_camera"
|
||||
filename: "/home/homeassistant/.homeassistant/www/downloads/camera/kitchen/kitchen_away.jpg"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.frontroom_camera"
|
||||
filename: "/home/homeassistant/.homeassistant/www/downloads/camera/frontroom/frontroom_away.jpg"
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Indoor Pictures {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'No one seem to be home at the moment... Please see the images and make sure everything is okay.'
|
||||
data:
|
||||
images:
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/kitchen/kitchen_away.jpg"
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/frontroom/frontroom_away.jpg"
|
||||
|
||||
all_indoor_lights_off:
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
data_template:
|
||||
entity_id: >
|
||||
{%- for state in states.light if state.entity_id != 'light.gateway_light_34ce008ad65d' -%}
|
||||
{{- "," if not loop.first-}}{{ state.entity_id }}{{-endif-}}
|
||||
{%- endfor -%}
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: >
|
||||
{%- for state in states.switch if
|
||||
state.entity_id != 'switch.wemoswitch1' and
|
||||
state.entity_id != 'switch.wallmote_switch' and
|
||||
state.entity_id != 'switch.wemobackyardlightswitch' and
|
||||
state.entity_id != 'switch.frontyard_light' and
|
||||
state.entity_id != 'switch.dockermon' and
|
||||
state.entity_id != 'switch.grafana' and
|
||||
state.entity_id != 'switch.influxdb' and
|
||||
state.entity_id != 'switch.home_bridge' and
|
||||
state.entity_id != 'switch.rf_switch_five' and
|
||||
not '_siren_' in state.entity_id -%}
|
||||
{{- "," if not loop.first-}}{{ state.entity_id }}{{-endif-}}
|
||||
{%- endfor -%}
|
509
packages/batteries.yaml
Executable file
509
packages/batteries.yaml
Executable file
@@ -0,0 +1,509 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Batteries
|
||||
# @description : Status about various baterries (iphones, sensors...etc)
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
group.batteries:
|
||||
order: 2
|
||||
|
||||
sensor.suresh_iphone_battery_state:
|
||||
hidden: true
|
||||
sensor.mallika_iphone_battery_state:
|
||||
hidden: true
|
||||
sensor.srinika_iphone_battery_state:
|
||||
hidden: true
|
||||
sensor.hasika_iphone_battery_state:
|
||||
hidden: true
|
||||
|
||||
sensor.suresh_iphone_battery_ot:
|
||||
hidden: true
|
||||
sensor.mallika_iphone_battery_ot:
|
||||
hidden: true
|
||||
sensor.srinika_iphone_battery_ot:
|
||||
hidden: true
|
||||
sensor.hasika_iphone_battery_ot:
|
||||
hidden: true
|
||||
|
||||
sensor.hasika_iphone_wifi_state:
|
||||
friendly_name: Hasika Phone Wi-Fi Status
|
||||
sensor.mallika_iphone_wifi_state:
|
||||
friendly_name: Mallika Phone Wi-Fi Status
|
||||
sensor.srinika_iphone_wifi_state:
|
||||
friendly_name: Srinika Phone Wi-Fi Status
|
||||
sensor.suresh_iphone_wifi_state:
|
||||
friendly_name: Suresh Phone Wi-Fi Status
|
||||
|
||||
sensor:
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/mallika/mallika"
|
||||
name: "Mallika iPhone Battery (OT)"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json.batt }}"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/suresh/suresh"
|
||||
name: "Suresh iPhone Battery (OT)"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json.batt }}"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/srinika/srinika"
|
||||
name: "Srinika iPhone Battery (OT)"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json.batt }}"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/hasika/hasika"
|
||||
name: "Hasika iPhone Battery (OT)"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json.batt }}"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/mallika/mallika"
|
||||
name: "Mallika iPhone Battery State"
|
||||
value_template: >
|
||||
{% if value_json.charging == 1 %}
|
||||
Charging
|
||||
{% else %}
|
||||
Not Charging
|
||||
{% endif %}
|
||||
icon: "mdi:battery-charging"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/suresh/suresh"
|
||||
name: "Suresh iPhone Battery State"
|
||||
value_template: >
|
||||
{% if value_json.charging == 1 %}
|
||||
Charging
|
||||
{% else %}
|
||||
Not Charging
|
||||
{% endif %}
|
||||
icon: "mdi:battery-charging"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/srinika/srinika"
|
||||
name: "Srinika iPhone Battery State"
|
||||
value_template: >
|
||||
{% if value_json.charging == 1 %}
|
||||
Charging
|
||||
{% else %}
|
||||
Not Charging
|
||||
{% endif %}
|
||||
icon: "mdi:battery-charging"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/hasika/hasika"
|
||||
name: "Hasika iPhone Battery State"
|
||||
value_template: >
|
||||
{% if value_json.charging == 1 %}
|
||||
Charging
|
||||
{% else %}
|
||||
Not Charging
|
||||
{% endif %}
|
||||
icon: "mdi:battery-charging"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/mallika/mallika"
|
||||
name: "Mallika iPhone Wifi State"
|
||||
value_template: >
|
||||
{% if value_json.conn == "w" %}
|
||||
Connected
|
||||
{% else %}
|
||||
Not Connected
|
||||
{% endif %}
|
||||
icon: "mdi:wifi"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/suresh/suresh"
|
||||
name: "Suresh iPhone Wifi State"
|
||||
value_template: >
|
||||
{% if value_json.conn == "w" %}
|
||||
Connected
|
||||
{% else %}
|
||||
Not Connected
|
||||
{% endif %}
|
||||
icon: "mdi:wifi"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/srinika/srinika"
|
||||
name: "Srinika iPhone Wifi State"
|
||||
value_template: >
|
||||
{% if value_json.conn == "w" %}
|
||||
Connected
|
||||
{% else %}
|
||||
Not Connected
|
||||
{% endif %}
|
||||
icon: "mdi:wifi"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/hasika/hasika"
|
||||
name: "Hasika iPhone Wifi State"
|
||||
value_template: >
|
||||
{% if value_json.conn == "w" %}
|
||||
Connected
|
||||
{% else %}
|
||||
Not Connected
|
||||
{% endif %}
|
||||
icon: "mdi:wifi"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/mallika/mallika"
|
||||
name: "Mallika Driving Speed"
|
||||
value_template: '{{ value_json.vel |int|round}}'
|
||||
unit_of_measurement: miles
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/suresh/suresh"
|
||||
name: "Suresh Driving Speed"
|
||||
value_template: '{{ value_json.vel |int|round}}'
|
||||
unit_of_measurement: miles
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/srinika/srinika"
|
||||
name: "Srinika Driving Speed"
|
||||
value_template: '{{ value_json.vel |int|round}}'
|
||||
unit_of_measurement: miles
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "owntracks/hasika/hasika"
|
||||
name: "Hasika Driving Speed"
|
||||
value_template: '{{ value_json.vel |int|round}}'
|
||||
unit_of_measurement: miles
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
suresh_iphone_battery_ot:
|
||||
unit_of_measurement: '%'
|
||||
value_template: >
|
||||
{% if states('sensor.suresh_iphone_battery_ot') != "unknown" %}
|
||||
{{ states('sensor.suresh_iphone_battery_ot')| int }}
|
||||
{% else %}
|
||||
0
|
||||
{% endif %}
|
||||
icon_template: >-
|
||||
{% if states('sensor.suresh_iphone_battery_ot') != "unknown" %}
|
||||
{% set battery_level = states('sensor.suresh_iphone_battery_ot')|int (-1)%}
|
||||
{% set battery_round = (battery_level|int / 10)|int * 10 %}
|
||||
{% if states.sensor.suresh_iphone_battery_state.state | lower == "charging" %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery-charging-100
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-charging-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
mallika_iphone_battery_ot:
|
||||
unit_of_measurement: '%'
|
||||
value_template: "{{ states('sensor.mallika_iphone_battery_ot')|int(-1) }}"
|
||||
icon_template: >-
|
||||
{% if states('sensor.mallika_iphone_battery_ot') != "unknown" %}
|
||||
{% set battery_level = states('sensor.mallika_iphone_battery_ot')|int (-1)%}
|
||||
{% set battery_round = (battery_level|int / 10)|int * 10 %}
|
||||
{% if states.sensor.mallika_iphone_battery_state.state | lower == "charging" %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery-charging-100
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-charging-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
srinika_iphone_battery_ot:
|
||||
unit_of_measurement: '%'
|
||||
value_template: "{{ states('sensor.srinika_iphone_battery_ot')|int(-1) }}"
|
||||
icon_template: >-
|
||||
{% if states('sensor.srinika_iphone_battery_ot') != "unknown" %}
|
||||
{% set battery_level = states('sensor.srinika_iphone_battery_ot')|int (-1)%}
|
||||
{% set battery_round = (battery_level|int / 10)|int * 10 %}
|
||||
{% if states.sensor.srinika_iphone_battery_state.state | lower == "charging" %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery-charging-100
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-charging-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
hasika_iphone_battery_ot:
|
||||
unit_of_measurement: '%'
|
||||
value_template: "{{ states('sensor.hasika_iphone_battery_ot')|int(-1) }}"
|
||||
icon_template: >-
|
||||
{% if states('sensor.hasika_iphone_battery_ot') != "unknown" %}
|
||||
{% set battery_level = states('sensor.hasika_iphone_battery_ot')|int (-1)%}
|
||||
{% set battery_round = (battery_level|int / 10)|int * 10 %}
|
||||
{% if states.sensor.hasika_iphone_battery_state.state | lower == "charging" %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery-charging-100
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-charging-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if battery_level == -1 %}
|
||||
mdi:battery-unknown
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
#
|
||||
# This automation alerts family members when they are "moving" - meaning either in driving from work,
|
||||
# kids got on the school bus, and bus is moving...etc
|
||||
# This will only announces/ alert when someone is at home.
|
||||
#
|
||||
- alias: Alert When Moving
|
||||
trigger:
|
||||
platform: numeric_state
|
||||
entity_id:
|
||||
- sensor.suresh_driving_speed
|
||||
- sensor.mallika_driving_speed
|
||||
- sensor.srinika_driving_speed
|
||||
- sensor.hasika_driving_speed
|
||||
above: 8
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{%- if states.automation.alert_when_moving.attributes.last_triggered -%}
|
||||
{{ (as_timestamp(now()) - as_timestamp(states.automation.alert_when_moving.attributes.last_triggered)) > 300 }}
|
||||
{%- else -%}
|
||||
true
|
||||
{%- endif -%}
|
||||
- condition: template
|
||||
value_template: "{{ states.input_boolean.home_mode_away.state == 'off' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.alarm_control_panel.simplisafe.state | lower != 'armed_away' }}"
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{% set apostrophe = "\'" %}
|
||||
{{ trigger.entity_id.split('.')[1].split('_')[0] |title ~ apostrophe ~ 's' }} vehicle is in motion.
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >-
|
||||
{% set apostrophe = "\'" %}
|
||||
{{ trigger.entity_id.split('.')[1].split('_')[0] |title ~ apostrophe ~ 's' }} vehicle is going at {{ trigger.to_state.state |round *2 }} mph.
|
||||
|
||||
###############################################################################
|
||||
# Automation: Notify of iPhone Low Battery
|
||||
###############################################################################
|
||||
- alias: Notify Low battery
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: numeric_state
|
||||
entity_id:
|
||||
- device_tracker.suresh_suresh
|
||||
- device_tracker.mallika_mallika
|
||||
- device_tracker.srinika_srinika
|
||||
- device_tracker.hasika_hasika
|
||||
value_template: '{{ state.attributes.battery }}'
|
||||
below: 25
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.battery_notifications.state == "on" }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.attributes.friendly_name }}'s phone battery is less than: {{ trigger.to_state.attributes.battery }}%."
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.attributes.friendly_name }}'s phone battery is less than: {{ trigger.to_state.attributes.battery }}%."
|
||||
|
||||
|
||||
- alias: Alert Low Battery
|
||||
trigger:
|
||||
- platform: template
|
||||
value_template: >
|
||||
{% set ns = namespace(lowBattery=false) %}
|
||||
{%- for x in states if x.attributes and x.attributes.battery_level and x.attributes.battery_level |int <= 24 %}
|
||||
{% set ns.lowBattery = true %}{% endfor %}
|
||||
{{ ns.lowBattery }}
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{% set ns = namespace(lowBattery) %}
|
||||
{%- for x in states if x.attributes and x.attributes.battery_level and x.attributes.battery_level |int <= 24 %}
|
||||
{% set ns.lowBattery = ns.lowBattery ~ ',' ~ x.name %}
|
||||
{%- endfor %}
|
||||
{{ ns.lowBattery -}}
|
||||
{{- ' battery is ' if ns.lowBattery.split(',')|count == 1 else ' batteries are ' -}} less than 25 percent.
|
||||
|
||||
# ###############################################################################
|
||||
# # Automation: Notify of Sensor's Low Battery
|
||||
# ###############################################################################
|
||||
# - alias: Alert Low Battery Level of Sensors
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# platform: state
|
||||
# entity_id:
|
||||
# - binary_sensor.motion_sensor_158d00016c2d0e
|
||||
# - binary_sensor.motion_sensor_158d00016db6d2
|
||||
# - binary_sensor.motion_sensor_158d0001a25041
|
||||
# - binary_sensor.motion_sensor_158d0001a662fe
|
||||
# - sensor.illumination_158d00016c2d0e
|
||||
# - sensor.illumination_158d00016db6d2
|
||||
# - sensor.illumination_158d0001a25041
|
||||
# - sensor.illumination_158d0001a662fe
|
||||
# - zwave.aeotec_water_sensor
|
||||
# - zwave.audio_detector
|
||||
# - zwave.back_door_sensor
|
||||
# - zwave.basement_door_sensor
|
||||
# - zwave.downstairs_multi_sensor
|
||||
# - zwave.front_room_multi_sensor
|
||||
# - zwave.front_room_window_sensor
|
||||
# - zwave.garage_door_sensor
|
||||
# - zwave.guest_bedroom_multi_sensor
|
||||
# - zwave.kitchen_motion_sensor
|
||||
# - zwave.single_car_garage_door_tilt_sensor
|
||||
# - zwave.stairs_motion_sensor
|
||||
# - zwave.tv_multi_sensor
|
||||
# - zwave.two_car_garage_door_tilt_sensor
|
||||
# - zwave.upstairs_multi_sensor
|
||||
# - zwave.wallmote
|
||||
# action:
|
||||
# - service: script.voice_notify
|
||||
# data_template:
|
||||
# message: >-
|
||||
# {%- for item in states if item.entity_id.split('.')[0] != "device_tracker" -%}
|
||||
# {%- for attrib in item.attributes|sort() if 'battery' in attrib and item.attributes[attrib] | int < 10 %}
|
||||
# {{ item.name }} Battery is at {{ item.attributes[attrib] }} percent
|
||||
# {%- endfor -%}
|
||||
# {%- endfor -%}
|
||||
|
||||
- alias: Check Wi-Fi Status of iPhones At Home
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- device_tracker.mallika_mallika
|
||||
- device_tracker.suresh_suresh
|
||||
- device_tracker.srinika_srinika
|
||||
- device_tracker.hasika_hasika
|
||||
from: 'not_home'
|
||||
to: 'home'
|
||||
for: '00:05:00'
|
||||
condition:
|
||||
condition: or
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.hasika_iphone_wifi_state
|
||||
state: 'Not Connected'
|
||||
- condition: state
|
||||
entity_id: sensor.mallika_iphone_wifi_state
|
||||
state: 'Not Connected'
|
||||
- condition: state
|
||||
entity_id: sensor.srinika_iphone_wifi_state
|
||||
state: 'Not Connected'
|
||||
- condition: state
|
||||
entity_id: sensor.suresh_iphone_wifi_state
|
||||
state: 'Not Connected'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{% set member = trigger.entity_id.split('.')[1].split('_')[0] %}
|
||||
{{ member | title }}'s iPhone is not connected to Wi-Fi at home!
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{% set member = trigger.entity_id.split('.')[1].split('_')[0] %}
|
||||
{{ member | title }}'s iPhone is not connected to Wi-Fi at home!
|
9
packages/bed_sensors.yaml
Executable file
9
packages/bed_sensors.yaml
Executable file
@@ -0,0 +1,9 @@
|
||||
homeassistant:
|
||||
|
||||
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Master Bed Sensor"
|
||||
state_topic: "/master_bed/master_bed/WeightChanA"
|
||||
value_template: "{{ value }}"
|
||||
unit_of_measurement: load
|
239
packages/birthday.yaml
Executable file
239
packages/birthday.yaml
Executable file
@@ -0,0 +1,239 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/28/2017
|
||||
# @package : Birthday
|
||||
# @description : Birthday reminders, greetings/wishes - all good stuff!
|
||||
#
|
||||
# THREE IMPORTANT THINGS YOU NEED:
|
||||
# 1. Copy birtday_wishes.yaml file from templates folder to your templates folder
|
||||
# 2. Copy this file to Packages folder & add following to configuration.yaml
|
||||
# packages: !include_dir_named packages
|
||||
# 3. Add the following to your secrets.yaml file, change name and date
|
||||
# name_birthday: "MM-DD". See below for example:
|
||||
#
|
||||
# srinika_birthday: "04-01"
|
||||
# hasika_birthday: "07-25"
|
||||
# mallika_birthday: "12-31"
|
||||
#
|
||||
# Update: I added mqtt code to refresh the sensor values dynamically.
|
||||
# The sensor values update on hourly basis.
|
||||
#
|
||||
# PLEASE NOTE THAT THIS PACKAGE USES "DATE" SENSOR. IF YOU SEE THE BIRTHDAY
|
||||
# VALUES AS "NOT SET", YOU NEED TO ADD THE FOLLOWING TO YOUR CONFIGURATION FILE
|
||||
#
|
||||
# sensor:
|
||||
# - platform: time_date
|
||||
# display_options:
|
||||
# - 'time'
|
||||
# - 'date'
|
||||
# - 'date_time'
|
||||
# - 'time_date'
|
||||
#
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'birthday'
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
input_label.srinika_birthday:
|
||||
<<: *hidden
|
||||
input_label.hasika_birthday:
|
||||
<<: *hidden
|
||||
input_label.mallika_birthday:
|
||||
<<: *hidden
|
||||
|
||||
input_label:
|
||||
srinika_birthday:
|
||||
value: !secret srinika_birthday
|
||||
hasika_birthday:
|
||||
value: !secret hasika_birthday
|
||||
mallika_birthday:
|
||||
value: !secret mallika_birthday
|
||||
|
||||
srinika_birthday_days2go:
|
||||
icon: mdi:cake-variant
|
||||
name: Srinika's Birthday
|
||||
hasika_birthday_days2go:
|
||||
icon: mdi:cake-variant
|
||||
name: Hasika's Birthday
|
||||
mallika_birthday_days2go:
|
||||
icon: mdi:cake-variant
|
||||
name: Mallika's Birthday
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
###############################################################################
|
||||
# Build the excitement
|
||||
###############################################################################
|
||||
- alias: Birthday Countdown 30 Days
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- input_label.srinika_birthday_days2go
|
||||
- input_label.hasika_birthday_days2go
|
||||
- input_label.mallika_birthday_days2go
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: "{{ trigger.to_state.state | int > 0 and trigger.to_state.state | int < 30 }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "{{ trigger.entity_id.split('.')[1].split('_')[0] | title }}'s Birthday is only {{ trigger.to_state.state }} days to go!"
|
||||
|
||||
###############################################################################
|
||||
# Celebrate Birthday!!!
|
||||
###############################################################################
|
||||
- alias: Today is the Birthday
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- input_label.srinika_birthday_days2go
|
||||
- input_label.hasika_birthday_days2go
|
||||
- input_label.mallika_birthday_days2go
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: "{{ trigger.to_state.state | int == 0 }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Hurray! Today is {{ trigger.entity_id.split('.')[1].split('_')[0] | title }}'s Birthday!"
|
||||
|
||||
###############################################################################
|
||||
# Announce Happy Birthday message every hour starting 7 am until 9 PM
|
||||
###############################################################################
|
||||
- alias: Random Birthday Wishes
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
hours: '/1'
|
||||
minutes: 3
|
||||
seconds: 00
|
||||
condition:
|
||||
condition: and
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: time
|
||||
after: '07:00:00'
|
||||
before: '21:00:00'
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ states.input_label.srinika_birthday_days2go.state | int == 0 }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.input_label.hasika_birthday_days2go.state | int == 0 }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.input_label.mallika_birthday_days2go.state | int == 0 }}"
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: !include ../templates/birthday_wishes.yaml
|
||||
- delay:
|
||||
minutes: 1
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Alexa, Sing Happy Birthday Song."
|
||||
greeting: 'no'
|
||||
|
||||
- alias: Update Birthdays
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states.input_label.srinika_birthday.state.split('-') | length > 0 }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.input_label.hasika_birthday.state.split('-') | length > 0 }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.input_label.mallika_birthday.state.split('-') | length > 0 }}"
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: input_label.srinika_birthday_days2go
|
||||
value: >
|
||||
{% set year = states.sensor.date.state.split('-')[0] %}
|
||||
{% set month = states.sensor.date.state.split('-')[1] %}
|
||||
{% set date = states.sensor.date.state.split('-')[2] %}
|
||||
{% if states('input_label.srinika_birthday') != "unknown" %}
|
||||
{%- set bDayMonth = states.input_label.srinika_birthday.state.split('-')[0] -%}
|
||||
{%- set bDayDate = states.input_label.srinika_birthday.state.split('-')[1] -%}
|
||||
{%- set numOfDays = ((as_timestamp(strptime(year ~ '-' ~ bDayMonth ~ '-' ~ bDayDate , '%Y-%m-%d')) | timestamp_custom('%j', true) | int ) - (as_timestamp(strptime(year ~ '-' ~ month~ '-' ~ date , '%Y-%m-%d')) | timestamp_custom('%j', true) | int)) -%}
|
||||
{%- if numOfDays < 0 -%}
|
||||
{{ numOfDays + 365 }}
|
||||
{%- else -%}
|
||||
{{ numOfDays }}
|
||||
{%- endif -%}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: input_label.hasika_birthday_days2go
|
||||
value: >
|
||||
{% set year = states.sensor.date.state.split('-')[0] %}
|
||||
{% set month = states.sensor.date.state.split('-')[1] %}
|
||||
{% set date = states.sensor.date.state.split('-')[2] %}
|
||||
{% if states('input_label.hasika_birthday') != "unknown" %}
|
||||
{%- set bDayMonth = states.input_label.hasika_birthday.state.split('-')[0] -%}
|
||||
{%- set bDayDate = states.input_label.hasika_birthday.state.split('-')[1] -%}
|
||||
{%- set numOfDays = ((as_timestamp(strptime(year ~ '-' ~ bDayMonth ~ '-' ~ bDayDate , '%Y-%m-%d')) | timestamp_custom('%j', true) | int ) - (as_timestamp(strptime(year ~ '-' ~ month~ '-' ~ date , '%Y-%m-%d')) | timestamp_custom('%j', true) | int)) -%}
|
||||
{%- if numOfDays < 0 -%}
|
||||
{{ numOfDays + 365 }}
|
||||
{%- else -%}
|
||||
{{ numOfDays }}
|
||||
{%- endif -%}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: input_label.mallika_birthday_days2go
|
||||
value: >
|
||||
{% set year = states.sensor.date.state.split('-')[0] %}
|
||||
{% set month = states.sensor.date.state.split('-')[1] %}
|
||||
{% set date = states.sensor.date.state.split('-')[2] %}
|
||||
{% if states('input_label.mallika_birthday') != "unknown" %}
|
||||
{%- set bDayMonth = states.input_label.mallika_birthday.state.split('-')[0] -%}
|
||||
{%- set bDayDate = states.input_label.mallika_birthday.state.split('-')[1] -%}
|
||||
{%- set numOfDays = ((as_timestamp(strptime(year ~ '-' ~ bDayMonth ~ '-' ~ bDayDate , '%Y-%m-%d')) | timestamp_custom('%j', true) | int ) - (as_timestamp(strptime(year ~ '-' ~ month~ '-' ~ date , '%Y-%m-%d')) | timestamp_custom('%j', true) | int)) -%}
|
||||
{%- if numOfDays < 0 -%}
|
||||
{{ numOfDays + 365 }}
|
||||
{%- else -%}
|
||||
{{ numOfDays }}
|
||||
{%- endif -%}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
829
packages/cameras.yaml
Executable file
829
packages/cameras.yaml
Executable file
@@ -0,0 +1,829 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 07/16/2017
|
||||
# @package : Cameras
|
||||
# @description : Cameras and the automations
|
||||
# @Comment : USE AT YOUR RISK!!! I CAN'T GUARANTEE IF IT DOESN'T
|
||||
# WORK IN YOUR ENVIRONMENT!
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'cameras'
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
#
|
||||
# The camera url format in secrets.yaml would look like this:
|
||||
# frontdoor_camera_url: http://username:password@192.168.xxx.xxx/ISAPI/Streaming/channels/101/picture
|
||||
#
|
||||
camera:
|
||||
- platform: generic
|
||||
name: Frontdoor Camera
|
||||
still_image_url: !secret frontdoor_camera_url
|
||||
verify_ssl: false
|
||||
authentication: digest
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: generic
|
||||
name: Driveway Camera
|
||||
still_image_url: !secret driveway_camera_url
|
||||
verify_ssl: false
|
||||
authentication: digest
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: generic
|
||||
name: Patio Camera
|
||||
still_image_url: !secret patio_camera_url
|
||||
verify_ssl: false
|
||||
authentication: digest
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: generic
|
||||
name: Playarea Camera
|
||||
still_image_url: !secret playarea_camera_url
|
||||
verify_ssl: false
|
||||
authentication: digest
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: mjpeg
|
||||
mjpeg_url: !secret garage_camera_url
|
||||
name: Garage Camera
|
||||
|
||||
- platform: mjpeg
|
||||
mjpeg_url: !secret kitchen_camera_url
|
||||
name: Kitchen Camera
|
||||
|
||||
- platform: mjpeg
|
||||
mjpeg_url: !secret frontroom_camera_url
|
||||
name: Frontroom Camera
|
||||
|
||||
- platform: local_file
|
||||
name: Frontdoor Latest Scan
|
||||
file_path: "/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_latest.jpg"
|
||||
- platform: local_file
|
||||
name: Driveway Latest Scan
|
||||
file_path: "/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_latest.jpg"
|
||||
- platform: local_file
|
||||
name: Patio Latest Scan
|
||||
file_path: "/home/homeassistant/.homeassistant/www/downloads/camera/patio/patio_latest.jpg"
|
||||
- platform: local_file
|
||||
name: Playarea Latest Scan
|
||||
file_path: "/home/homeassistant/.homeassistant/www/downloads/camera/playarea/playarea_latest.jpg"
|
||||
- platform: local_file
|
||||
name: Garage Latest Scan
|
||||
file_path: "/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_latest.jpg"
|
||||
|
||||
binary_sensor:
|
||||
|
||||
- platform: hikvision
|
||||
name: Frontdoor Camera
|
||||
ssl: false
|
||||
host: !secret frontdoor_camera_ip
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: hikvision
|
||||
name: Driveway Camera
|
||||
ssl: false
|
||||
host: !secret driveway_camera_ip
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: hikvision
|
||||
name: Patio Camera
|
||||
ssl: false
|
||||
host: !secret patio_camera_ip
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
- platform: hikvision
|
||||
name: Playarea Camera
|
||||
ssl: false
|
||||
host: !secret playarea_camera_ip
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
|
||||
image_processing:
|
||||
- platform: tensorflow
|
||||
scan_interval: 10000
|
||||
confidence: 75
|
||||
source:
|
||||
- entity_id: camera.frontdoor_camera
|
||||
- entity_id: camera.driveway_camera
|
||||
- entity_id: camera.patio_camera
|
||||
- entity_id: camera.playarea_camera
|
||||
- entity_id: camera.garage_camera
|
||||
file_out:
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/{{- camera_entity.split('.')[1].split('_')[0] -}}/{{ camera_entity.split('.')[1].split('_')[0] }}_latest.jpg"
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/{{- camera_entity.split('.')[1].split('_')[0] -}}/{{ camera_entity.split('.')[1].split('_')[0] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
|
||||
model:
|
||||
graph: /home/homeassistant/.homeassistant/tensorflow/frozen_inference_graph.pb
|
||||
# categories:
|
||||
# - person
|
||||
# - car
|
||||
# - truck
|
||||
|
||||
input_label:
|
||||
current_stream:
|
||||
name: Current Stream
|
||||
|
||||
# frontdoor_camera_text_overlay_url: http://192.168.xxx.xxx/Video/inputs/channels/1/overlays/text/1
|
||||
rest_command:
|
||||
set_camera_text_left_bottom:
|
||||
url: !secret frontdoor_camera_text_overlay_url
|
||||
username: !secret camera_username
|
||||
password: !secret camera_password
|
||||
method: PUT
|
||||
content_type: 'text/xml'
|
||||
payload: >-
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TextOverlay version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
|
||||
<id>1</id><enabled>true</enabled>
|
||||
<posX>45</posX><posY>520</posY>
|
||||
<message>{{ message }} </message>
|
||||
</TextOverlay>
|
||||
|
||||
###############################################################################
|
||||
# _____ _ _
|
||||
# / ____| (_) | |
|
||||
# | (___ ___ _ __ _ _ __ | |_ ___
|
||||
# \___ \ / __| '__| | '_ \| __/ __|
|
||||
# ____) | (__| | | | |_) | |_\__ \
|
||||
# |_____/ \___|_| |_| .__/ \__|___/
|
||||
# | |
|
||||
# |_|
|
||||
#
|
||||
script:
|
||||
|
||||
###############################################################################
|
||||
# Camera Text Overlay Script - sets a given text as an overlay on camera feed
|
||||
#
|
||||
camera_text_overlay:
|
||||
sequence:
|
||||
- service: rest_command.set_camera_text_left_bottom
|
||||
data_template:
|
||||
message: "{{text}}"
|
||||
|
||||
###############################################################################
|
||||
# On-Demand camera stream to chromecast scripts
|
||||
#
|
||||
stream_frontdoor_camera_to_chromecast:
|
||||
sequence:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret frontdoor_camera_stream_url
|
||||
name: 'frontyard'
|
||||
|
||||
stream_driveway_camera_to_chromecast:
|
||||
sequence:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret driveway_camera_stream_url
|
||||
name: 'driveway'
|
||||
|
||||
stream_patio_camera_to_chromecast:
|
||||
sequence:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret patio_camera_stream_url
|
||||
name: 'patio'
|
||||
|
||||
stream_playarea_camera_to_chromecast:
|
||||
sequence:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret playarea_camera_stream_url
|
||||
name: 'playarea'
|
||||
|
||||
###############################################################################
|
||||
# Stream2Chromecast script streams a given URL to Chromecast
|
||||
# But before it streams, it turns ON the media player if it is OFF, and after
|
||||
# streaming the URL, it saves the current stream name
|
||||
# BY calling media_player.turn_off, it forces Chromecast stream onto be active
|
||||
# on TV as soon as it turns ON TV
|
||||
stream2chromecast:
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_label.current_stream') != name }}"
|
||||
- service: media_player.play_media
|
||||
data_template:
|
||||
entity_id: media_player.attic_tv
|
||||
media_content_id: "{{ url }}"
|
||||
media_content_type: "video"
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: input_label.current_stream
|
||||
value: "{{ name }}"
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
#
|
||||
# Scan front door and driveway cameras when motion detected
|
||||
# if the garage doors are open, scan garage cameras as well
|
||||
#
|
||||
- alias: Scan Frontdoor Camera On Motion
|
||||
initial_state: true
|
||||
hide_entity: false
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.motion_sensor_158d00024ee084
|
||||
to: 'on'
|
||||
action:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret frontdoor_camera_stream_url
|
||||
name: 'frontyard'
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_frontdoor_camera
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_driveway_camera
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') != None %}
|
||||
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') |count > 0 %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{%- set e_id = "image_processing.tensorflow_frontdoor_camera" -%}
|
||||
{%- if state_attr(e_id, 'summary') -%}
|
||||
{%- set count = state_attr(e_id, 'summary') | count -%}
|
||||
{%- for x in state_attr(e_id, 'summary') | list -%}
|
||||
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
||||
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
||||
{%- endfor -%}
|
||||
{{ " detected in the front yard." }}
|
||||
{%- endif -%}
|
||||
greeting: 'no'
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Front door motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected at the front door on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_latest.jpg"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" or
|
||||
states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
True
|
||||
{% else %}
|
||||
False
|
||||
{% endif %}
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_garage_camera
|
||||
#
|
||||
# Scan driveway and frontdoor cameras when motion detected
|
||||
# if the garage doors are open, scan garage cameras as well
|
||||
#
|
||||
- alias: Scan Driveway Camera When Motion
|
||||
initial_state: true
|
||||
hide_entity: false
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.motion_sensor_158d00024e57fb
|
||||
to: 'on'
|
||||
action:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret driveway_camera_stream_url
|
||||
name: 'driveway'
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_driveway_camera
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_frontdoor_camera
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{% if state_attr('image_processing.tensorflow_driveway_camera', 'summary') != None %}
|
||||
{% if state_attr('image_processing.tensorflow_driveway_camera', 'summary') |count > 0 %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{%- set e_id = "image_processing.tensorflow_driveway_camera" -%}
|
||||
{%- if state_attr(e_id, 'summary') -%}
|
||||
{%- set count = state_attr(e_id, 'summary') | count -%}
|
||||
{%- for x in state_attr(e_id, 'summary') | list -%}
|
||||
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
||||
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
||||
{%- endfor -%}
|
||||
{{ " detected in the driveway" }}
|
||||
{%- endif -%}
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Driveway motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected at the driveway on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_latest.jpg"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" or
|
||||
states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
True
|
||||
{% else %}
|
||||
False
|
||||
{% endif %}
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_garage_camera
|
||||
|
||||
#
|
||||
# When motion detected in garage, scan garage camera
|
||||
# If any of the garage doors are open, scan front door, driveway as well!
|
||||
#
|
||||
- alias: Scan Garage Camera When Motion
|
||||
initial_state: true
|
||||
hide_entity: false
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.motion_sensor_158d000272bf48
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
action:
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_garage_camera
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" or
|
||||
states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
True
|
||||
{% else %}
|
||||
False
|
||||
{% endif %}
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_driveway_camera
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_frontdoor_camera
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{% if state_attr('image_processing.tensorflow_garage_camera', 'summary') != None %}
|
||||
{% if state_attr('image_processing.tensorflow_garage_camera', 'summary') |count > 0 %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{%- set e_id = "image_processing.tensorflow_garage_camera" -%}
|
||||
{%- if state_attr(e_id, 'summary') -%}
|
||||
{%- set count = state_attr(e_id, 'summary') | count -%}
|
||||
{%- for x in state_attr(e_id, 'summary') | list -%}
|
||||
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
||||
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
||||
{%- endfor -%}
|
||||
{{ " detected in the garage." }}
|
||||
{%- endif -%}
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Garage motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected in the garage on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_latest.jpg"
|
||||
#
|
||||
# When motion detected in the backyard, scan both cameras
|
||||
#
|
||||
- alias: Scan Backyard Camera When Motion
|
||||
initial_state: true
|
||||
hide_entity: false
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.motion_sensor_158d00024e842c
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
action:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret playarea_camera_stream_url
|
||||
name: 'backyard'
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_patio_camera
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: image_processing.tensorflow_playarea_camera
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{% if state_attr('image_processing.tensorflow_patio_camera', 'summary') != None %}
|
||||
{% if state_attr('image_processing.tensorflow_patio_camera', 'summary') |count > 0 %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{%- set e_id = "image_processing.tensorflow_patio_camera" -%}
|
||||
{%- if state_attr(e_id, 'summary') -%}
|
||||
{%- set count = state_attr(e_id, 'summary') | count -%}
|
||||
{%- for x in state_attr(e_id, 'summary') | list -%}
|
||||
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
||||
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
||||
{%- endfor -%}
|
||||
{{ " detected in the backyard." }}
|
||||
{%- endif -%}
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Backyard motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected in the backyard on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/patio/patio_latest.jpg"
|
||||
- "/home/homeassistant/.homeassistant/www/downloads/camera/playarea/playarea_latest.jpg"
|
||||
|
||||
# Before you think this code is crazy, here is an explanation.
|
||||
#
|
||||
# I have a xiaomi aqara PIR motion sensor near the front door, and
|
||||
# when it triggers, I capture photo from the camera, save it locally
|
||||
# using last_triggered date and time as filename... then send that
|
||||
# image to my email as an attacment.
|
||||
#
|
||||
# In the action, I have multiple services I am calling, and one service
|
||||
# creates file, and I needed that file name in the second service.
|
||||
# Since passing variables/info between the services within an action,
|
||||
# is not possible, I generate the file name based on the automation's
|
||||
# last_triggered date. Since that info is same across all the services
|
||||
# within the automation, I now can access/use the same file name everywhere!
|
||||
#
|
||||
# I only send iOS notifications when I am home, as my HA is not exposed to
|
||||
# Internet, & I can't see my camera unless I login to my vpn on my device.
|
||||
# That's why you see the condition right above iOS notification service.
|
||||
#
|
||||
# Make sure you add the path to white_list in the configuration.yaml file.
|
||||
# If front door is open, wait for a couple of seconds, before taking pic!
|
||||
#
|
||||
|
||||
# I could have combined all the 3 automations into one, but if all the motion
|
||||
# sensors are triggered at the same time, the automation would only fire once,
|
||||
# and the code gets ugly big and unmanageable. 3 simple automations is better!
|
||||
|
||||
###############################################################################
|
||||
# ______ _ _
|
||||
# | ____| | | | |
|
||||
# | |__ _ __ ___ _ __ | |_ __| | ___ ___ _ __
|
||||
# | __| '__/ _ \| '_ \| __/ _` |/ _ \ / _ \| '__|
|
||||
# | | | | | (_) | | | | || (_| | (_) | (_) | |
|
||||
# |_| |_| \___/|_| |_|\__\__,_|\___/ \___/|_|
|
||||
|
||||
- alias: Notify Frontdoor Camera Snapshots
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.motion_sensor_158d00024ee084
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
action:
|
||||
- delay: "{{ '00:00:08' if states.binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor.state == 'on' else '0:0:0' }}"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.frontdoor_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.driveway_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.garage_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Front door motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected at the front door on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") -}}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.device_tracker.suresh_suresh.state == 'home' }}"
|
||||
- service: notify.ios_devices
|
||||
data_template:
|
||||
message: "Check Front Door camera!"
|
||||
data:
|
||||
push:
|
||||
category: camera
|
||||
entity_id: "camera.frontdoor_camera"
|
||||
attachment:
|
||||
url: "{{ states.camera.frontdoor_camera.attributes.entity_picture }}"
|
||||
content-type: jpg
|
||||
|
||||
# ###############################################################################
|
||||
# # _____ _
|
||||
# # | __ \ (_)
|
||||
# # | | | |_ __ ___ _______ ____ _ _ _
|
||||
# # | | | | '__| \ \ / / _ \ \ /\ / / _` | | | |
|
||||
# # | |__| | | | |\ V / __/\ V V / (_| | |_| |
|
||||
# # |_____/|_| |_| \_/ \___| \_/\_/ \__,_|\__, |
|
||||
# # __/ |
|
||||
# # |___/
|
||||
- alias: Notify Driveway Camera Snapshots
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.motion_sensor_158d00024e57fb
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
action:
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.frontdoor_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.driveway_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.garage_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Driveway motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected at the Driveway on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.device_tracker.suresh_suresh.state == 'home' }}"
|
||||
- service: notify.ios_devices
|
||||
data_template:
|
||||
message: "Check Driveway camera!"
|
||||
data:
|
||||
push:
|
||||
category: camera
|
||||
entity_id: "camera.driveway_camera"
|
||||
attachment:
|
||||
url: "{{ states.camera.driveway_camera.attributes.entity_picture }}"
|
||||
content-type: jpg
|
||||
|
||||
# ###############################################################################
|
||||
# # ____ _ _
|
||||
# # | _ \ | | | |
|
||||
# # | |_) | __ _ ___| | ___ _ __ _ _ __ __| |
|
||||
# # | _ < / _` |/ __| |/ / | | |/ _` | '__/ _` |
|
||||
# # | |_) | (_| | (__| <| |_| | (_| | | | (_| |
|
||||
# # |____/ \__,_|\___|_|\_\\__, |\__,_|_| \__,_|
|
||||
# # __/ |
|
||||
# # |___/
|
||||
- alias: Notify Backyard Camera Snapshots
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.motion_sensor_158d00024e842c
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'armed_home' or states('alarm_control_panel.simplisafe') == 'armed_away' }}"
|
||||
action:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') != None %}
|
||||
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') |count > 0 %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.patio_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/patio/patio_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.playarea_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/playarea/playarea_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Backyard motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: 'Motion detected in the Backyard on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
||||
data:
|
||||
images:
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/patio/patio_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/playarea/playarea_' ~
|
||||
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.device_tracker.suresh_suresh.state == 'home' }}"
|
||||
- service: notify.ios_devices
|
||||
data_template:
|
||||
message: "Check Patio camera!"
|
||||
data:
|
||||
push:
|
||||
category: camera
|
||||
entity_id: "camera.patio_camera"
|
||||
attachment:
|
||||
url: "{{ states.camera.patio_camera.attributes.entity_picture }}"
|
||||
content-type: jpg
|
||||
|
||||
|
||||
###############################################################################
|
||||
# _______ _ ____ _
|
||||
# |__ __| | | / __ \ | |
|
||||
# | | _____ _| |_ | | | |_ _____ _ __| | __ _ _ _
|
||||
# | |/ _ \ \/ / __| | | | \ \ / / _ \ '__| |/ _` | | | |
|
||||
# | | __/> <| |_ | |__| |\ V / __/ | | | (_| | |_| |
|
||||
# |_|\___/_/\_\\__| \____/ \_/ \___|_| |_|\__,_|\__, |
|
||||
# __/ |
|
||||
# |___/
|
||||
#
|
||||
# Show latest weather information on camera (refresh every 2 minutes), but only
|
||||
# do it if the last updated is more than 2 minutes; In case some other automation
|
||||
# sets a new text overlay, make sure it stays for at least 2 minutes before
|
||||
# replacing with the weather information
|
||||
#
|
||||
- alias: Show Outdoor Temperature on Camera
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: '/2'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if state_attr('script.camera_text_overlay', 'last_triggered') != None %}
|
||||
{{ (as_timestamp(now()) - as_timestamp(
|
||||
state_attr('script.camera_text_overlay', 'last_triggered'))) | int > 120 }}
|
||||
{% else %}
|
||||
true
|
||||
{% endif %}
|
||||
action:
|
||||
- service: script.camera_text_overlay
|
||||
data_template:
|
||||
text: >
|
||||
{{ '* ' if states('alarm_control_panel.simplisafe') == 'armed_home' or
|
||||
states('alarm_control_panel.simplisafe') == 'armed_away' -}}
|
||||
{{- states('sensor.dark_sky_temperature')|int}} °F, Feels like
|
||||
{{- ' ' ~ states('sensor.dark_sky_apparent_temperature') |int -}}
|
||||
|
||||
###############################################################################
|
||||
# _____ _ _
|
||||
# / ____| | | |
|
||||
# | | | |__ _ __ ___ _ __ ___ ___ ___ __ _ ___| |_
|
||||
# | | | '_ \| '__/ _ \| '_ ` _ \ / _ \/ __/ _` / __| __|
|
||||
# | |____| | | | | | (_) | | | | | | __/ (_| (_| \__ \ |_
|
||||
# \_____|_| |_|_| \___/|_| |_| |_|\___|\___\__,_|___/\__|
|
||||
#
|
||||
#
|
||||
# Automation to keep Chromecast ON always
|
||||
# When chromecase goes into screen saver mode, the status becomes OFF
|
||||
# This automation will turn it back on if it is OFF for more than 30 seconds
|
||||
- alias: Keep Chromecast On
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: media_player.attic_tv
|
||||
to: 'off'
|
||||
for:
|
||||
seconds: 30
|
||||
- platform: state
|
||||
entity_id: media_player.attic_tv
|
||||
to: 'idle'
|
||||
for:
|
||||
seconds: 30
|
||||
action:
|
||||
- service: media_player.turn_on
|
||||
entity_id: media_player.attic_tv
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.attic_tv
|
||||
media_content_id: !secret frontdoor_camera_stream_url
|
||||
media_content_type: video
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: input_label.current_stream
|
||||
value: "frontyard"
|
||||
|
||||
# Motion can be detected anywhere around the house, but the main focus is "Frontyard".
|
||||
# By default, the "frontyard" camera stream is played on Chromecast, but when motion
|
||||
# detected anywhere else, it changes the stream to that corresponding camera.
|
||||
# This automation restores back to "default" (frontyard) after 15 seconds!
|
||||
#
|
||||
- alias: Restore Frontyard Stream
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
seconds: '/5'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_label.current_stream') != 'frontyard' }}"
|
||||
- condition: template
|
||||
value_template: "{{ (as_timestamp(now()) -
|
||||
as_timestamp(states.input_label.current_stream.last_updated))
|
||||
| int > 15 }}"
|
||||
action:
|
||||
- service: script.stream2chromecast
|
||||
data_template:
|
||||
url: !secret frontdoor_camera_stream_url
|
||||
name: 'frontyard'
|
409
packages/cameras_machinebox.yaml
Executable file
409
packages/cameras_machinebox.yaml
Executable file
@@ -0,0 +1,409 @@
|
||||
#
|
||||
# I COMMENTED OUT ALL THE TAGBOX RELATED STUFF AS I USE TENSORFLOW COMPONENT FOR IT.
|
||||
#
|
||||
homeassistant:
|
||||
customize:
|
||||
image_processing.facebox_frontdoor_camera:
|
||||
friendly_name: People @ Front Door
|
||||
image_processing.facebox_driveway_camera:
|
||||
friendly_name: People @ Driveway
|
||||
image_processing.facebox_patio_camera:
|
||||
friendly_name: People @ Patio
|
||||
image_processing.facebox_playarea_camera:
|
||||
friendly_name: People @ Playarea
|
||||
image_processing.facebox_garage_camera:
|
||||
friendly_name: People @ Garage
|
||||
|
||||
image_processing.tagbox_frontdoor_camera:
|
||||
friendly_name: Frontdoor Tag
|
||||
image_processing.tagbox_driveway_camera:
|
||||
friendly_name: Driveway Tag
|
||||
image_processing.tagbox_playarea_camera:
|
||||
friendly_name: Playarea Tag
|
||||
image_processing.tagbox_patio_camera:
|
||||
friendly_name: Patio Tag
|
||||
image_processing.tagbox_garage_camera:
|
||||
friendly_name: Garage Tag
|
||||
|
||||
sensor.frontdoor_camera_objects:
|
||||
friendly_name: Things At Front Door
|
||||
sensor.driveway_camera_objects:
|
||||
friendly_name: Things At Driveway
|
||||
sensor.playarea_camera_objects:
|
||||
friendly_name: Things At Playarea
|
||||
sensor.patio_camera_objects:
|
||||
friendly_name: Things At Patio
|
||||
sensor.garage_camera_objects:
|
||||
friendly_name: Things in Garage
|
||||
sensor.frontdoor_camera_people:
|
||||
friendly_name: People At Front Door
|
||||
sensor.driveway_camera_people:
|
||||
friendly_name: People Driveway
|
||||
sensor.playarea_camera_people:
|
||||
friendly_name: People Playarea
|
||||
sensor.patio_camera_people:
|
||||
friendly_name: People Patio
|
||||
sensor.garage_camera_people:
|
||||
friendly_name: Garage Patio
|
||||
|
||||
image_processing:
|
||||
- platform: facebox
|
||||
ip_address: !secret ha_ip_address
|
||||
scan_interval: 360
|
||||
port: 8080
|
||||
source:
|
||||
- entity_id: camera.frontdoor_camera
|
||||
- entity_id: camera.driveway_camera
|
||||
- entity_id: camera.patio_camera
|
||||
- entity_id: camera.playarea_camera
|
||||
- entity_id: camera.garage_camera
|
||||
# - platform: tagbox
|
||||
# scan_interval: 10000 # Default 10
|
||||
# ip_address: !secret ha_ip_address
|
||||
# port: 8081
|
||||
# source:
|
||||
# - entity_id: camera.frontdoor_camera
|
||||
# - entity_id: camera.driveway_camera
|
||||
# - entity_id: camera.patio_camera
|
||||
# - entity_id: camera.playarea_camera
|
||||
# - entity_id: camera.garage_camera
|
||||
|
||||
sensor:
|
||||
|
||||
##
|
||||
#Facebox related sensors
|
||||
##
|
||||
- platform: template
|
||||
sensors:
|
||||
frontdoor_camera_people:
|
||||
value_template: >-
|
||||
{% set faces = state_attr('image_processing.facebox_frontdoor_camera', 'matched_faces') %}
|
||||
{% if None != faces %}
|
||||
{% if faces | list | count == 0 %}
|
||||
Clear
|
||||
{% else %}
|
||||
{%- for face in faces | list %}{%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{ face }}{%- endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
icon_template: mdi:cctv
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
driveway_camera_people:
|
||||
value_template: >-
|
||||
{% set faces = state_attr('image_processing.facebox_driveway_camera', 'matched_faces') %}
|
||||
{% if None != faces %}
|
||||
{% if faces | list | count == 0 %}
|
||||
Clear
|
||||
{% else %}
|
||||
{%- for face in faces | list %}{%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{ face }}{%- endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
icon_template: mdi:cctv
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
patio_camera_people:
|
||||
value_template: >-
|
||||
{% set faces = state_attr('image_processing.facebox_patio_camera', 'matched_faces') %}
|
||||
{% if None != faces %}
|
||||
{% if faces | list | count == 0 %}
|
||||
Clear
|
||||
{% else %}
|
||||
{%- for face in faces | list %}{%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{ face }}{%- endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
icon_template: mdi:cctv
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
playarea_camera_people:
|
||||
value_template: >-
|
||||
{% set faces = state_attr('image_processing.facebox_playarea_camera', 'matched_faces') %}
|
||||
{% if None != faces %}
|
||||
{% if faces | list | count == 0 %}
|
||||
Clear
|
||||
{% else %}
|
||||
{%- for face in faces | list %}{%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{ face }}{%- endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
icon_template: mdi:cctv
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
garage_camera_people:
|
||||
value_template: >-
|
||||
{% set faces = state_attr('image_processing.facebox_garage_camera', 'matched_faces') %}
|
||||
{% if None != faces %}
|
||||
{% if faces | list | count == 0 %}
|
||||
Clear
|
||||
{% else %}
|
||||
{%- for face in faces | list %}{%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{ face }}{%- endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
icon_template: mdi:cctv
|
||||
|
||||
# ###########################################################################################################################
|
||||
# # Tagbox related Sensors; Please don't go crazy looking at the code. Here is the simple explanation.
|
||||
# # The tagbox gives a bunch of tags for each picture, and I eliminate a bunch of unwanted tags by filtering them out
|
||||
# # The unwanted tags are something that I really don't care - like a Tree in the front yard.
|
||||
# # Then I do custom mapping of the tags that fits my needs. That way I can display what I want rather than what I was given.
|
||||
# # I have no control over what tagbox gives, I want to pick and choose tags irrespective of confidence level.
|
||||
# ###########################################################################################################################
|
||||
|
||||
# - platform: template
|
||||
# sensors:
|
||||
# frontdoor_camera_objects:
|
||||
# value_template: >-
|
||||
# {% set attribs = state_attr('image_processing.tagbox_frontdoor_camera', 'tags') %}
|
||||
# {%- if None != attribs -%}
|
||||
# {%- set tag_map = {'Vehicle':'Car', 'Sedan':'Car', 'Luxury vehicle':'Car', 'Driving':'Car',
|
||||
# 'Wheel':'Car', 'Automotive design':'Car', 'Automotive exterior':'Car',
|
||||
# 'Transport':'Car', 'Sports car':'Car', 'Land vehicle':'Car', 'Supercar':'Car',
|
||||
# 'Waterway':'Rain', 'Super car': 'Car'
|
||||
# } -%}
|
||||
# {%- set unwanted_tags = ['Asphalt', 'Backyard', 'City', 'Estate', 'Flower', 'Garden', 'Grass', 'Tree', 'Car', 'Vehicle', 'Suburb', 'Street',
|
||||
# 'Highway', 'Infrastructure', 'Lane', 'Lawn', 'Neighbourhood', 'Public space', 'Super car', 'Snow', 'Winter', 'Supercar',
|
||||
# 'Residential area', 'Road', 'Road surface', 'Sidewalk', 'Tarmac', 'Race track', 'Sport venue', 'Soil', 'Outdoor structure', 'Cartoon', 'Poster', 'Illustration',
|
||||
# 'Transport', 'Walkway', 'Yard', 'Screenshot', 'Night', 'Lighting and Light', 'Drawing', 'Sketch', 'Stadium',
|
||||
# 'Black-and-white', 'Monochrome', 'Monochrome photography', 'Black and White', 'Parking lot', 'Parking',
|
||||
# 'Black', 'White', 'Darkness', 'Light', 'Text'] -%}
|
||||
# {%- macro filter_unwanted(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in unwanted_tags -%}{{- comma() -}}{{- item -}}{% endfor %}{%- endmacro -%}
|
||||
# {%- macro mapped_items(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in tag_map -%}{{- comma() -}}{{- item -}}
|
||||
# {%- endfor -%}
|
||||
# {%- for item in tags if item in tag_map -%}{{- comma() -}}{{- tag_map[item] -}}{%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {% macro get_final_output(output_list) %}
|
||||
# {%- for x in output_list if x != "" -%}
|
||||
# {%- if loop.first %}{% elif loop.last %},{% else %},{% endif -%}{{- x -}}
|
||||
# {%- endfor -%}
|
||||
# {% endmacro %}
|
||||
# {%- set result = filter_unwanted(attribs| map(attribute='name')|list).split(',') -%}
|
||||
# {%- set output = get_final_output(mapped_items(result).split(',') | unique|list) -%}
|
||||
# {{- "Clear" if output |trim == "" else output -}}
|
||||
# {% endif %}
|
||||
# icon_template: mdi:cctv
|
||||
|
||||
# - platform: template
|
||||
# sensors:
|
||||
# driveway_camera_objects:
|
||||
# value_template: >-
|
||||
# {%- set attribs = state_attr('image_processing.tagbox_driveway_camera', 'tags') -%}
|
||||
# {%- if None != attribs -%}
|
||||
# {%- set tag_map = {'Vehicle':'Car', 'Sedan':'Car', 'Luxury vehicle':'Car', 'Driving':'Car',
|
||||
# 'Wheel':'Car', 'Automotive design':'Car', 'Automotive exterior':'Car',
|
||||
# 'Transport':'Car', 'Sports car':'Car', 'Land vehicle':'Car','Supercar':'Car',
|
||||
# 'Waterway':'Rain', 'Super car': 'Car'
|
||||
# } -%}
|
||||
# {%- set unwanted_tags = ['Asphalt', 'Backyard', 'City', 'Estate', 'Flower', 'Garden', 'Grass', 'Tree', 'Car', 'Vehicle', 'Suburb', 'Street',
|
||||
# 'Highway', 'Infrastructure', 'Lane', 'Lawn', 'Neighbourhood', 'Public space', 'Super car', 'Sport venue', 'Supercar',
|
||||
# 'Residential area', 'Road', 'Road surface', 'Sidewalk', 'Tarmac', 'Race track', 'Snow', 'Winter', 'Soil', 'Outdoor structure', 'Cartoon', 'Poster', 'Illustration',
|
||||
# 'Transport', 'Walkway', 'Yard', 'Screenshot', 'Night', 'Lighting and Light', 'Drawing', 'Sketch', 'Stadium',
|
||||
# 'Black-and-white', 'Monochrome', 'Monochrome photography', 'Black and White',
|
||||
# 'Black', 'White', 'Darkness', 'Light', 'Text'] -%}
|
||||
# {%- macro filter_unwanted(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in unwanted_tags -%}{{- comma() -}}{{- item -}}{% endfor %}{%- endmacro -%}
|
||||
# {%- macro mapped_items(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in tag_map -%}{{- comma() -}}{{- item -}}
|
||||
# {%- endfor -%}
|
||||
# {%- for item in tags if item in tag_map -%}{{- comma() -}}{{- tag_map[item] -}}{%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {% macro get_final_output(output_list) %}
|
||||
# {%- for x in output_list if x != "" -%}
|
||||
# {%- if loop.first %}{% elif loop.last %},{% else %},{% endif -%}{{- x -}}
|
||||
# {%- endfor -%}
|
||||
# {% endmacro %}
|
||||
# {%- set result = filter_unwanted(attribs| map(attribute='name')|list).split(',') -%}
|
||||
# {%- set output = get_final_output(mapped_items(result).split(',') | unique|list) -%}
|
||||
# {{- "Clear" if output |trim == "" else output -}}
|
||||
# {% endif %}
|
||||
# icon_template: mdi:cctv
|
||||
|
||||
# - platform: template
|
||||
# sensors:
|
||||
# patio_camera_objects:
|
||||
# value_template: >-
|
||||
# {% set attribs = state_attr('image_processing.tagbox_patio_camera', 'tags') %}
|
||||
# {%- if None != attribs -%}
|
||||
# {%- set tag_map = {'Waterway':'Rain'} -%}
|
||||
# {%- set unwanted_tags = ['Asphalt', 'Backyard', 'City', 'Estate', 'Flower', 'Garden', 'Grass', 'Tree', 'Vehicle','Driving', 'Transport', 'Car', 'Vehicle', 'Suburb', 'Street',
|
||||
# 'Highway', 'Infrastructure', 'Lane', 'Lawn', 'Neighbourhood', 'Public space', 'Car', 'Wheel', 'Sports car','Super car', 'Sport venue', 'Outdoor structure', 'Cartoon', 'Poster', 'Illustration',
|
||||
# 'Residential area', 'Road', 'Road surface', 'Sidewalk', 'Tarmac', 'Race track', 'Sedan', 'Automotive design', 'Snow', 'Winter', 'Soil', 'Stadium',
|
||||
# 'Transport', 'Walkway', 'Yard', 'Screenshot', 'Night', 'Lighting and Light', 'Luxury vehicle', 'Automotive exterior', 'Drawing', 'Sketch',
|
||||
# 'Black-and-white', 'Monochrome', 'Monochrome photography', 'Black and White', 'Black', 'White', 'Light', 'Text'] -%}
|
||||
# {%- macro filter_unwanted(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in unwanted_tags -%}{{- comma() -}}{{- item -}}{% endfor %}{%- endmacro -%}
|
||||
# {%- macro mapped_items(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in tag_map -%}{{- comma() -}}{{- item -}}
|
||||
# {%- endfor -%}
|
||||
# {%- for item in tags if item in tag_map -%}{{- comma() -}}{{- tag_map[item] -}}{%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {% macro get_final_output(output_list) %}
|
||||
# {%- for x in output_list if x != "" -%}
|
||||
# {%- if loop.first %}{% elif loop.last %},{% else %},{% endif -%}{{- x -}}
|
||||
# {%- endfor -%}
|
||||
# {% endmacro %}
|
||||
# {%- set result = filter_unwanted(attribs| map(attribute='name')|list).split(',') -%}
|
||||
# {%- set output = get_final_output(mapped_items(result).split(',') | unique|list) -%}
|
||||
# {{- "Clear" if output |trim == "" else output -}}
|
||||
# {% endif %}
|
||||
# icon_template: mdi:cctv
|
||||
|
||||
# - platform: template
|
||||
# sensors:
|
||||
# playarea_camera_objects:
|
||||
# value_template: >-
|
||||
# {% set attribs = state_attr('image_processing.tagbox_playarea_camera', 'tags') %}
|
||||
# {%- if None != attribs -%}
|
||||
# {%- set tag_map = {'Waterway':'Rain'} -%}
|
||||
# {%- set unwanted_tags = ['Asphalt', 'Backyard', 'City', 'Estate', 'Flower', 'Garden', 'Grass', 'Tree', 'Vehicle','Driving', 'Transport', 'Car', 'Vehicle', 'Suburb', 'Street',
|
||||
# 'Highway', 'Infrastructure', 'Lane', 'Lawn', 'Neighbourhood', 'Public space', 'Car', 'Wheel', 'Sports car', 'Super car', 'Winter', 'Soil', 'Stadium',
|
||||
# 'Residential area', 'Road', 'Road surface', 'Sidewalk', 'Tarmac', 'Race track', 'Sedan', 'Automotive design', 'Snow', 'Sport venue', 'Outdoor structure', 'Cartoon', 'Poster', 'Illustration',
|
||||
# 'Transport', 'Walkway', 'Yard', 'Screenshot', 'Night', 'Lighting and Light', 'Luxury vehicle', 'Automotive exterior', 'Drawing', 'Sketch',
|
||||
# 'Black-and-white', 'Monochrome', 'Monochrome photography', 'Black and White', 'Black', 'White', 'Light', 'Text'] -%}
|
||||
# {%- macro filter_unwanted(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in unwanted_tags -%}{{- comma() -}}{{- item -}}{% endfor %}{%- endmacro -%}
|
||||
# {%- macro mapped_items(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in tag_map -%}{{- comma() -}}{{- item -}}{%- endfor -%}
|
||||
# {%- for item in tags if item in tag_map -%}{{- comma() -}}{{- tag_map[item] -}}{%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {% macro get_final_output(output_list) %}
|
||||
# {%- for x in output_list if x != "" -%}
|
||||
# {%- if loop.first %}{% elif loop.last %},{% else %},{% endif -%}{{- x -}}
|
||||
# {%- endfor -%}
|
||||
# {% endmacro %}
|
||||
# {%- set result = filter_unwanted(attribs| map(attribute='name')|list).split(',') -%}
|
||||
# {%- set output = get_final_output(mapped_items(result).split(',') | unique|list) -%}
|
||||
# {{- "Clear" if output |trim == "" else output -}}
|
||||
# {% endif %}
|
||||
# icon_template: mdi:cctv
|
||||
|
||||
# - platform: template
|
||||
# sensors:
|
||||
# garage_camera_objects:
|
||||
# value_template: >-
|
||||
# {% set attribs = state_attr('image_processing.tagbox_garage_camera', 'tags') %}
|
||||
# {%- if None != attribs -%}
|
||||
# {%- set tag_map = {'Waterway':'Rain'} -%}
|
||||
# {%- set unwanted_tags = ['Asphalt', 'Backyard', 'City', 'Estate', 'Flower', 'Garden', 'Grass', 'Tree', 'Driving', 'Transport', 'Suburb', 'Street',
|
||||
# 'Highway', 'Infrastructure', 'Lane', 'Lawn', 'Neighbourhood', 'Public space', 'Winter', 'Soil', 'Stadium',
|
||||
# 'Residential area', 'Road', 'Road surface', 'Sidewalk', 'Tarmac', 'Race track', 'Sedan', 'Automotive design', 'Snow', 'Sport venue', 'Outdoor structure', 'Cartoon', 'Poster', 'Illustration',
|
||||
# 'Transport', 'Walkway', 'Yard', 'Screenshot', 'Night', 'Lighting and Light', 'Luxury vehicle', 'Automotive exterior', 'Drawing', 'Sketch',
|
||||
# 'Black-and-white', 'Monochrome', 'Monochrome photography', 'Black and White', 'Black', 'White', 'Light', 'Text'] -%}
|
||||
# {%- macro filter_unwanted(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in unwanted_tags -%}{{- comma() -}}{{- item -}}{% endfor %}{%- endmacro -%}
|
||||
# {%- macro mapped_items(tags) -%}
|
||||
# {%- set comma = joiner(',') -%}
|
||||
# {%- for item in tags if item not in tag_map -%}{{- comma() -}}{{- item -}}{%- endfor -%}
|
||||
# {%- for item in tags if item in tag_map -%}{{- comma() -}}{{- tag_map[item] -}}{%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {% macro get_final_output(output_list) %}
|
||||
# {%- for x in output_list if x != "" -%}
|
||||
# {%- if loop.first %}{% elif loop.last %},{% else %},{% endif -%}{{- x -}}
|
||||
# {%- endfor -%}
|
||||
# {% endmacro %}
|
||||
# {%- set result = filter_unwanted(attribs| map(attribute='name')|list).split(',') -%}
|
||||
# {%- set output = get_final_output(mapped_items(result).split(',') | unique|list) -%}
|
||||
# {{- "Clear" if output |trim == "" else output -}}
|
||||
# {% endif %}
|
||||
# icon_template: mdi:cctv
|
||||
|
||||
automation:
|
||||
|
||||
- alias: Alert Family Member Activity
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- sensor.frontdoor_camera_people
|
||||
- sensor.driveway_camera_people
|
||||
- sensor.patio_camera_people
|
||||
- sensor.playarea_camera_people
|
||||
- sensor.garage_camera_people
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: '{{ trigger.to_state.state | trim != "" and
|
||||
trigger.to_state.state | lower | trim != "unknown" and
|
||||
trigger.to_state.state | lower | trim != "clear" }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >-
|
||||
{% set camera_name = states['camera'][trigger.entity_id.split('.')[1].split('_')[0] ~ '_camera'].attributes.friendly_name %}
|
||||
{{ trigger.to_state.state }} is at the {{ camera_name }}.
|
||||
|
||||
# - alias: Alert Object Activity
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id:
|
||||
# - sensor.frontdoor_camera_objects
|
||||
# - sensor.driveway_camera_objects
|
||||
# - sensor.patio_camera_objects
|
||||
# - sensor.playarea_camera_objects
|
||||
# - sensor.garage_camera_objects
|
||||
# condition:
|
||||
# - condition: template
|
||||
# value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
# - condition: template
|
||||
# value_template: '{{ trigger.to_state.state | trim != "" and
|
||||
# trigger.to_state.state | lower | trim != "unknown" and
|
||||
# trigger.to_state.state | lower | trim != "clear" }}'
|
||||
# action:
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: >-
|
||||
# {% set camera_name = states['camera'][trigger.entity_id.split('.')[1].split('_')[0] ~ '_camera'].attributes.friendly_name %}
|
||||
# {{ trigger.to_state.state }} detected at the {{ camera_name }}.
|
||||
|
||||
#
|
||||
# This automation basically scans image and keeps a count of people from each camera view and notifies using iOS notification
|
||||
# There is another automation that alerts in the house (using TTS) based on the data
|
||||
#
|
||||
- alias: Scan People and Objects
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.frontdoor_camera_motion
|
||||
- binary_sensor.driveway_camera_motion
|
||||
- binary_sensor.patio_camera_motion
|
||||
- binary_sensor.playarea_camera_motion
|
||||
- binary_sensor.frontdoor_camera_field_detection
|
||||
- binary_sensor.driveway_camera_field_detection
|
||||
- binary_sensor.patio_camera_field_detection
|
||||
- binary_sensor.playarea_camera_field_detection
|
||||
- binary_sensor.frontdoor_camera_line_crossing
|
||||
- binary_sensor.driveway_camera_line_crossing
|
||||
- binary_sensor.patio_camera_line_crossing
|
||||
- binary_sensor.playarea_camera_line_crossing
|
||||
- binary_sensor.garage_motion
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% macro last_triggered(entity) %}
|
||||
{% set time_in_seconds = 30 %}
|
||||
{{ ( (as_timestamp(now()) - as_timestamp(states["binary_sensor"][entity].attributes.last_tripped_time)))|round|abs < time_in_seconds }}
|
||||
{% endmacro %}
|
||||
{{ last_triggered(trigger.entity_id.split('.')[1].split('_')[0] ~ '_camera_motion')}}
|
||||
action:
|
||||
- service: image_processing.scan
|
||||
data_template:
|
||||
entity_id: "image_processing.facebox_{{- trigger.entity_id.split('.')[1].split('_')[0] -}}_camera"
|
||||
# - service: image_processing.scan
|
||||
# data_template:
|
||||
# entity_id: "image_processing.tagbox_{{- trigger.entity_id.split('.')[1].split('_')[0] -}}_camera"
|
297
packages/daily_routines.yaml
Executable file
297
packages/daily_routines.yaml
Executable file
@@ -0,0 +1,297 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Daily Light Routine around the house
|
||||
# @description : Daily light routine stuff
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛ
|
||||
# °°ÛÛÛÛÛÛ ÛÛÛÛÛÛ °°°
|
||||
# °ÛÛÛ°ÛÛÛÛÛ°ÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ
|
||||
# °ÛÛÛ°°ÛÛÛ °ÛÛÛ ÛÛÛ°°ÛÛÛ°°ÛÛÛ°°ÛÛÛ°°ÛÛÛ°°ÛÛÛ °°ÛÛÛ °°ÛÛÛ°°ÛÛÛ ÛÛÛ°°ÛÛÛ
|
||||
# °ÛÛÛ °°° °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °°° °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ
|
||||
# °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ
|
||||
# ÛÛÛÛÛ ÛÛÛÛÛ°°ÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛ°°ÛÛÛÛÛÛÛ
|
||||
# °°°°° °°°°° °°°°°° °°°°° °°°° °°°°° °°°°° °°°° °°°°° °°°°°ÛÛÛ
|
||||
# ÛÛÛ °ÛÛÛ
|
||||
# °°ÛÛÛÛÛÛ
|
||||
# °°°°°°
|
||||
###############################################################################
|
||||
# Turn Indoor lights ON only during weekdays
|
||||
###############################################################################
|
||||
- alias: Morning Indoor Lights ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: 'binary_sensor.workday_sensor'
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.wakeup_hour.state |int == now().hour |int }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.wakeup_minute.state|int == now().minute|int }}'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
data:
|
||||
entity_id: switch.kitchen
|
||||
|
||||
###############################################################################
|
||||
# Turn ON Master Bedroom lights ON in the morning
|
||||
# Turn On Bedroom Lights 10 minutes after wake up time
|
||||
###############################################################################
|
||||
- alias: Morning Master Bedroom Lights ON (Mallika)
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: 'binary_sensor.workday_sensor'
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.wakeup_hour.state |int == now().hour|int }}'
|
||||
- condition: template
|
||||
value_template: '{{ now().minute | int == (states.sensor.wakeup_minute.state | int + 10) }}'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.master_bedroom_2
|
||||
transition: 15
|
||||
brightness: 25
|
||||
color_temp: 154
|
||||
|
||||
- alias: Morning Master Bedroom Lights OFF (Mallika)
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: 'binary_sensor.workday_sensor'
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.wakeup_hour.state|int == now().hour|int }}'
|
||||
- condition: template
|
||||
value_template: '{{ now().minute|int == (states.sensor.wakeup_minute.state|int + 15) }}'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_off
|
||||
data:
|
||||
entity_id: light.master_bedroom_2
|
||||
|
||||
###############################################################################
|
||||
# Turn off outdoor lights 15 minutes after sunrise
|
||||
###############################################################################
|
||||
- alias: Morning Outdoor Lights OFF
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunrise
|
||||
offset: '00:15:00'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.frontyard_light
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.wemobackyardlightswitch
|
||||
|
||||
###############################################################################
|
||||
# Turn OF Kitchen Lights after 3 hours of wake up time during school/work days
|
||||
###############################################################################
|
||||
- alias: Morning Kitchen Light OFF
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: 'binary_sensor.workday_sensor'
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: '{{ now().hour|int == (states.sensor.wakeup_hour.state|int + 3) }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.wakeup_minute.state|int == now().minute|int }}'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.kitchen
|
||||
|
||||
# ÛÛÛÛÛÛÛÛÛÛ ÛÛÛ
|
||||
# °°ÛÛÛ°°°°°Û °°°
|
||||
# °ÛÛÛ Û ° ÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ
|
||||
# °ÛÛÛÛÛÛ °°ÛÛÛ °°ÛÛÛ ÛÛÛ°°ÛÛÛ°°ÛÛÛ°°ÛÛÛ °°ÛÛÛ °°ÛÛÛ°°ÛÛÛ ÛÛÛ°°ÛÛÛ
|
||||
# °ÛÛÛ°°Û °ÛÛÛ °ÛÛÛ °ÛÛÛÛÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ
|
||||
# °ÛÛÛ ° Û °°ÛÛÛ ÛÛÛ °ÛÛÛ°°° °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ
|
||||
# ÛÛÛÛÛÛÛÛÛÛ °°ÛÛÛÛÛ °°ÛÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛ°°ÛÛÛÛÛÛÛ
|
||||
# °°°°°°°°°° °°°°° °°°°°° °°°° °°°°° °°°°° °°°° °°°°° °°°°°ÛÛÛ
|
||||
# ÛÛÛ °ÛÛÛ
|
||||
# °°ÛÛÛÛÛÛ
|
||||
# °°°°°°
|
||||
###############################################################################
|
||||
# Turn outdoor lights on 15 minutes before sunset
|
||||
###############################################################################
|
||||
- alias: Evening Outdoor Lights ON (At Sunset)
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunset
|
||||
offset: '+00:00:00'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.frontyard_light
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.wemobackyardlightswitch
|
||||
|
||||
###############################################################################
|
||||
# Turn indoor lights on 30 minutes before sunset
|
||||
###############################################################################
|
||||
- alias: Evening Indoor Lights ON Before Sunset
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunset
|
||||
offset: '-00:30:00'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
data:
|
||||
entity_id: switch.kitchen
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_1
|
||||
transition: 15
|
||||
brightness: 255
|
||||
color_temp: 154
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_2
|
||||
transition: 15
|
||||
brightness: 255
|
||||
color_temp: 154
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_3
|
||||
transition: 15
|
||||
brightness: 255
|
||||
color_temp: 154
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.master_bedroom_1
|
||||
brightness: 25
|
||||
color_temp: 366
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.master_bedroom_2
|
||||
brightness: 25
|
||||
color_temp: 366
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.zwave_smart_switch_switch
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.kids_bed_accent
|
||||
|
||||
# ÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ
|
||||
# °°ÛÛÛÛÛÛ °°ÛÛÛ °°° °°ÛÛÛ °°ÛÛÛ
|
||||
# °ÛÛÛ°ÛÛÛ °ÛÛÛ ÛÛÛÛ ÛÛÛÛÛÛÛ °ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ
|
||||
# °ÛÛÛ°°ÛÛÛ°ÛÛÛ °°ÛÛÛ ÛÛÛ°°ÛÛÛ °ÛÛÛ°°ÛÛÛ °°°ÛÛÛ°
|
||||
# °ÛÛÛ °°ÛÛÛÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ
|
||||
# °ÛÛÛ °°ÛÛÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ ÛÛÛ
|
||||
# ÛÛÛÛÛ °°ÛÛÛÛÛ ÛÛÛÛÛ°°ÛÛÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛ °°ÛÛÛÛÛ
|
||||
# °°°°° °°°°° °°°°° °°°°°ÛÛÛ°°°° °°°°° °°°°°
|
||||
# ÛÛÛ °ÛÛÛ
|
||||
# °°ÛÛÛÛÛÛ
|
||||
# °°°°°°
|
||||
###############################################################################
|
||||
# Set the mood for bed time - Dim Family Room lights if they are ON
|
||||
###############################################################################
|
||||
- alias: Night Dim TV Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.bedtime_hour.state|int == now().hour|int }}'
|
||||
- condition: template
|
||||
value_template: '{{ (states.sensor.bedtime_minute.state|int - 15 ) == now().minute|int }}'
|
||||
- condition: state
|
||||
entity_id: light.family_room
|
||||
state: 'on'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.family_room
|
||||
brightness: 30
|
||||
color_temp: 154
|
||||
transition: 15
|
||||
|
||||
###############################################################################
|
||||
# TURN INDOOR LIGHTS OFF AFTER BED TIME
|
||||
###############################################################################
|
||||
- alias: Night Turn Lights Off
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.bedtime_hour.state|int == now().hour|int }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.bedtime_minute.state|int == now().minute|int }}'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: script.all_indoor_lights_off
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "It is bed time, turned lights off!"
|
||||
|
||||
###############################################################################
|
||||
# Provide Bed time Report via TTS
|
||||
###############################################################################
|
||||
- alias: Night Bedtime Report
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time
|
||||
at: '22:10:00'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.nightly_report') == 'on' }}"
|
||||
action:
|
||||
- service: script.good_night_tts
|
333
packages/door_sensors.yaml
Executable file
333
packages/door_sensors.yaml
Executable file
@@ -0,0 +1,333 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'door_sensors'
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
zwave.two_car_garage_door_tilt_sensor:
|
||||
friendly_name: 2-Car Garage Door Sensor
|
||||
<<: *hidden
|
||||
zwave.single_car_garage_door_tilt_sensor:
|
||||
friendly_name: 1-Car Garage Door Sensor
|
||||
<<: *hidden
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
single_car_garage_door_sensor_status:
|
||||
friendly_name: Single Car Garage Door Sensor Status
|
||||
value_template: >-
|
||||
{% if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == 'on' %}
|
||||
Open
|
||||
{% elif states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == 'off' %}
|
||||
Closed
|
||||
{% else %}
|
||||
Unknown
|
||||
{% endif %}
|
||||
icon_template: >-
|
||||
{% set door_status = states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state |d('unknown') %}
|
||||
{% if door_status == 'unknown' %}
|
||||
mdi:alert-circle
|
||||
{% else %}
|
||||
{% if door_status == 'on' %}
|
||||
mdi:garage-open
|
||||
{% else %}
|
||||
mdi:garage
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
two_car_garage_door_sensor_status:
|
||||
value_template: >-
|
||||
{% if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == 'on' %}
|
||||
Open
|
||||
{% elif states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == 'off' %}
|
||||
Closed
|
||||
{% else %}
|
||||
Unknown
|
||||
{% endif %}
|
||||
friendly_name: Double Car Garage Door Sensor Status
|
||||
icon_template: >-
|
||||
{% set door_status = states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state |d('unknown') %}
|
||||
{% if door_status == 'unknown' %}
|
||||
mdi:alert-circle
|
||||
{% else %}
|
||||
{% if door_status == 'on' %}
|
||||
mdi:garage-open
|
||||
{% else %}
|
||||
mdi:garage
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
binary_sensor:
|
||||
- platform: mqtt
|
||||
state_topic: "/garage/motion"
|
||||
name: "Garage Motion"
|
||||
device_class: motion
|
||||
payload_on: 'on'
|
||||
payload_off: 'off'
|
||||
value_template: "{{ value }}"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/kitchen/motion"
|
||||
name: "Kitchen Camera Motion"
|
||||
device_class: motion
|
||||
payload_on: 'on'
|
||||
payload_off: 'off'
|
||||
value_template: "{{ value }}"
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/frontroom/motion"
|
||||
name: "Frontroom Camera Motion"
|
||||
device_class: motion
|
||||
payload_on: 'on'
|
||||
payload_off: 'off'
|
||||
value_template: "{{ value }}"
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
- alias: Garage Motion Reset
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.garage_motion
|
||||
to: 'on'
|
||||
from: 'off'
|
||||
action:
|
||||
- delay: '00:00:30'
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "/garage/motion"
|
||||
payload: 'off'
|
||||
retain: false
|
||||
|
||||
- alias: Kitchen Camera Motion Reset
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.kitchen_camera_motion
|
||||
to: 'on'
|
||||
from: 'off'
|
||||
action:
|
||||
- delay: '00:00:30'
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "/kitchen/motion"
|
||||
payload: 'off'
|
||||
retain: false
|
||||
|
||||
- alias: Frontroom Camera Motion Reset
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.frontroom_camera_motion
|
||||
to: 'on'
|
||||
from: 'off'
|
||||
action:
|
||||
- delay: '00:00:30'
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "/frontroom/motion"
|
||||
payload: 'off'
|
||||
retain: false
|
||||
|
||||
################################################################################
|
||||
# Notifies when either of the garage door is opened or closed
|
||||
# When the garage is opened, it sends an actionable ios notification with an
|
||||
# option to close the garage door. This iso actionable notification only occurs
|
||||
# when garage door is open and not when it is closed.
|
||||
###############################################################################
|
||||
- alias: Notify Garage Door Status
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
- binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{% if trigger.from_state %} True {% else %} False {% endif %}"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.to_state.state != 'unknown' }}"
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.garage
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{% if trigger.to_state.state | lower == "on" %}
|
||||
{{ trigger.to_state.attributes.friendly_name }} is now OPENED!
|
||||
{% elif trigger.to_state.state | lower == "off" %}
|
||||
{{ trigger.to_state.attributes.friendly_name }} is now CLOSED!
|
||||
{% endif %}
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{% set doors = "" %}
|
||||
{% if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" and
|
||||
states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
{% set doors = "Atention! Both Garage Doors are OPEN" %}
|
||||
{% elif states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "off" and
|
||||
states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "off" %}
|
||||
{% set doors = "Both Garage Doors are now CLOSED" %}
|
||||
{% else %}
|
||||
{% if trigger.to_state.state | lower == "on" %}
|
||||
Attention! Your {{ trigger.to_state.attributes.friendly_name }} is now OPENED!
|
||||
{% elif trigger.to_state.state | lower == "off" %}
|
||||
Your {{ trigger.to_state.attributes.friendly_name }} is now CLOSED!
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ doors }}
|
||||
- delay: "00:00:05"
|
||||
- service: camera.snapshot
|
||||
data_template:
|
||||
entity_id: "camera.garage_camera"
|
||||
filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~
|
||||
(states.automation.notify_garage_door_status.last_triggered ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Garage Door Status {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: >-
|
||||
{% set doors = "" %}
|
||||
{% if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" and
|
||||
states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
{% set doors = "Both Garage Doors are OPEN" %}
|
||||
{% elif states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "off" and
|
||||
states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "off" %}
|
||||
{% set doors = "Both Garage Doors are CLOSED" %}
|
||||
{% else %}
|
||||
{% set doors = states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.name ~ " is " ~
|
||||
('Closed' if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == 'off' else 'OPEN')
|
||||
~ " and " ~ states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.name ~ " is " ~
|
||||
('Closed' if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == 'off' else 'OPEN') %}
|
||||
{% endif %}
|
||||
Your {{doors}} on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please check the garage snapshot below.
|
||||
data:
|
||||
images:
|
||||
- "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~
|
||||
(states.automation.notify_garage_door_status.last_triggered ~ '').replace('-','_')
|
||||
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
- service_template: >
|
||||
{% if trigger.to_state.state | lower == "on" %}
|
||||
switch.turn_on
|
||||
{% else %}
|
||||
switch.turn_off
|
||||
{% endif%}
|
||||
data:
|
||||
entity_id: switch.garage
|
||||
|
||||
################################################################################
|
||||
# When I open the garage door
|
||||
# if it is dark outside, OR
|
||||
# both the garage doors are closed
|
||||
# ==> turn the Garage lights ON, and start timer!
|
||||
################################################################################
|
||||
- alias: Garage Lights On When Door is Opened
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.garage_door_sensor_sensor
|
||||
to: 'on'
|
||||
condition:
|
||||
condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: '{{states.sun.sun.state == "below_horizon"}}'
|
||||
- condition: and
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == 'off' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == 'off' }}"
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.garage
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_garage
|
||||
|
||||
# Notify Entry Door Status
|
||||
###############################################################################
|
||||
- alias: Notify Entry Door Status
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor
|
||||
- binary_sensor.back_door_sensor_sensor
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{% if trigger.from_state %} True {% else %} False {% endif %}"
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{% if trigger.to_state.state | lower == "on" %}
|
||||
Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is OPEN,
|
||||
{% if states.alarm_control_panel.simplisafe.state == 'armed_home' or
|
||||
states.alarm_control_panel.simplisafe.state == 'armed_away' %}
|
||||
But your home security system is ON.
|
||||
{% endif %}
|
||||
{% elif trigger.to_state.state | lower == "off" %}
|
||||
Your {{ trigger.to_state.attributes.friendly_name.replace('Sensor', '') }} is CLOSED!
|
||||
{% endif %}
|
||||
greeting: 'no'
|
||||
only_at_night: >
|
||||
{% if states.alarm_control_panel.simplisafe.state == 'armed_home' %}
|
||||
no
|
||||
{% else %}
|
||||
yes
|
||||
{% endif %}
|
||||
|
||||
# Turn ON and OFF basement ambient lights
|
||||
###############################################################################
|
||||
- alias: Basement Accent Lights ON When Basement Door Opened
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.basement_door_sensor_sensor
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: homeassistant.turn_on
|
||||
entity_id: switch.rf_switch_one
|
||||
|
||||
- alias: Basement Accent Lights OFF After 5 minutes
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- switch.rf_switch_one
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: homeassistant.turn_off
|
||||
entity_id: switch.rf_switch_one
|
312
packages/emergency.yaml
Executable file
312
packages/emergency.yaml
Executable file
@@ -0,0 +1,312 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 11/22/2017
|
||||
# @package : Emergency Stuff
|
||||
# @description : When $hit hapens, this package gets called!
|
||||
#
|
||||
# In case of emergency - turn on the emergency_mode (input boolean)
|
||||
# lights, crazy sounds and alarms repeatedly until someone turns off
|
||||
# input boolean and/or Home Security System is turned OFF.
|
||||
#
|
||||
# All automations that alert during emerency situations, will turn on
|
||||
# input boolean emergency_mode and notify using standard notification
|
||||
#
|
||||
# My Home TTS/voice notifications will not work when music is being played
|
||||
# The automations will stop MPD media player ( just to makesure), so that
|
||||
# the TTS notifications will be played in case if someone plays music and
|
||||
# forgot to turn if off.
|
||||
###############################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
script.emergency_script:
|
||||
friendly_name: Emergency Script
|
||||
hidden: true
|
||||
script.emergency_script_loop:
|
||||
friendly_name: Emergency Script Loop
|
||||
hidden: true
|
||||
script.emergency_all_lights_switches_on:
|
||||
friendly_name: All Lights & Switches ON
|
||||
script.all_indoor_lights_off:
|
||||
friendly_name: All Indoor Lights OFF
|
||||
|
||||
input_boolean:
|
||||
emergency_mode:
|
||||
name: Emergency Mode
|
||||
initial: 'off'
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
###############################################################################
|
||||
# When emergency mode is OFF, Keep the lights ON
|
||||
###############################################################################
|
||||
- alias: Emergency Mode Disabled
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.emergency_mode
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
action:
|
||||
- delay: '00:00:05'
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Attention! Emergency mode is now deactivated!"
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Emergency mode is now deactivated!"
|
||||
|
||||
# Water Leak detected - initiate the emergency process
|
||||
###############################################################################
|
||||
- alias: Water Leak Detected
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.aeotec_water_sensor_flood
|
||||
from: '0'
|
||||
to: '2'
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.emergency_mode
|
||||
- service: script.emergency_all_lights_switches_on
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "EMERGENCY! Water Leak Detected in the Basement!"
|
||||
- service: script.emergency_script
|
||||
data:
|
||||
volume_level: 25
|
||||
alarm_code: 2
|
||||
message: "ALERT! Water Leak Detected in the Basement!"
|
||||
|
||||
# # Carbon Monoxide Detected in the house
|
||||
# ###############################################################################
|
||||
# - alias: CO Detected
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: sensor.audio_detector_carbon_monoxide
|
||||
# from: '0'
|
||||
# condition:
|
||||
# - condition: template
|
||||
# value_template: "{{ trigger.to_state.state != '0' }}"
|
||||
# action:
|
||||
# - service: script.voice_notify
|
||||
# data_template:
|
||||
# message: "Attention!: CARBON MONOXIDE DETECTED! GET THE HELL OUT OF THE HOUSE!"
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: "Attention!: CARBON MONOXIDE DETECTED!. GET THE HELL OUT OF THE HOUSE!"
|
||||
# - service: input_boolean.turn_on
|
||||
# entity_id: input_boolean.emergency_mode
|
||||
# - service: media_player.media_stop
|
||||
# entity_id: media_player.mpd
|
||||
# - service: script.emergency_script
|
||||
# data:
|
||||
# volume_level: 99
|
||||
# alarm_code: 2
|
||||
# message: "Attention! Cabon Monoxide detected. Leave the house immediately!"
|
||||
|
||||
# # Smoke Detected in the house
|
||||
# ###############################################################################
|
||||
# - alias: Smoke Detected
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: sensor.audio_detector_smoke
|
||||
# from: '0'
|
||||
# condition:
|
||||
# - condition: template
|
||||
# value_template: "{{ trigger.to_state.state != '0' }}"
|
||||
# action:
|
||||
# - service: script.voice_notify
|
||||
# data_template:
|
||||
# message: "Attention!: SMOKE DETECTED! CALL 911!"
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: "Attention!: SMOKE DETECTED!. CALL 911!"
|
||||
# - service: input_boolean.turn_on
|
||||
# entity_id: input_boolean.emergency_mode
|
||||
# - service: media_player.media_stop
|
||||
# entity_id: media_player.mpd
|
||||
# - service: script.emergency_script
|
||||
# data:
|
||||
# volume_level: 99
|
||||
# alarm_code: 2
|
||||
# message: "Smoke Detected. Please get out of the home and call 911 immediately!"
|
||||
|
||||
# Disable Emergency Mode upon Disabling Home Security System
|
||||
###############################################################################
|
||||
- alias: Disable Emergency Mode Upon Disabling Home Security
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: alarm_control_panel.simplisafe
|
||||
to: 'disarmed'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.emergency_mode.state == "on" }}'
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.emergency_mode
|
||||
|
||||
- alias: Home Security Away Motion Deteted Inside
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- binary_sensor.back_door_sensor_sensor
|
||||
- binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor
|
||||
- binary_sensor.basement_door_sensor_sensor
|
||||
- binary_sensor.garage_door_sensor_sensor
|
||||
- binary_sensor.front_room_multi_sensor_sensor
|
||||
- binary_sensor.tv_multi_sensor_sensor
|
||||
- binary_sensor.kitchen_motion_sensor_sensor
|
||||
- binary_sensor.stairs_motion_sensor_sensor
|
||||
- binary_sensor.upstairs_multi_sensor_sensor
|
||||
- binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
- binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
- binary_sensor.motion_sensor_158d0001a662fe
|
||||
- binary_sensor.motion_sensor_158d0001a25041
|
||||
- binary_sensor.motion_sensor_158d00016db6d2
|
||||
- binary_sensor.motion_sensor_158d00016c2d0e
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.from_state }}"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set state = states.alarm_control_panel.simplisafe.state %}
|
||||
{% if state != "" and state != "unknown" and state == "armed_away" %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set suresh = states.device_tracker.suresh_suresh.state %}
|
||||
{% set mallika = states.device_tracker.mallika_mallika.state %}
|
||||
{% set srinika = states.device_tracker.srinika_srinika.state %}
|
||||
{% set hasika = states.device_tracker.hasika_hasika.state %}
|
||||
{% if suresh != "home" and mallika != "home" and srinika != "home" and hasika != "home" %}
|
||||
True
|
||||
{% else %}
|
||||
False
|
||||
{% endif %}
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.emergency_mode
|
||||
- service: script.emergency_all_lights_switches_on
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "MOTION DETECTED '{{ trigger.to_state.attributes.friendly_name | upper }}',
|
||||
BUT NO ONE IS HOME. CALL FOR EMERGENCY!"
|
||||
- service: notify.ios_devices
|
||||
data_template:
|
||||
title: >
|
||||
{{ trigger.to_state.attributes.friendly_name }}
|
||||
message: >
|
||||
Attention: "MOTION DETECTED '{{ trigger.to_state.attributes.friendly_name | upper }}',
|
||||
BUT NO ONE IS HOME. CALL FOR EMERGENCY!"
|
||||
- service: script.emergency_script
|
||||
data:
|
||||
volume_level: 99
|
||||
alarm_code: 1
|
||||
message: "Police are on the way!...Police are on the way!...Police are on the way!...Police are on the way!...Police are on the way!"
|
||||
|
||||
script:
|
||||
|
||||
# Main Emergency Script
|
||||
###############################################################################
|
||||
emergency_script:
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.emergency_mode.state | lower == "on" }}'
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: '{{ message }}'
|
||||
greeting: 'no'
|
||||
- service: xiaomi_aqara.play_ringtone
|
||||
data_template:
|
||||
ringtone_id: '{{ alarm_code }}'
|
||||
ringtone_vol: '{{ volume_level }}'
|
||||
- delay: '00:00:01'
|
||||
- service: script.emergency_script_loop
|
||||
data_template:
|
||||
message: '{{ message }}'
|
||||
alarm_code: '{{ alarm_code }}'
|
||||
volume_level: '{{ volume_level }}'
|
||||
|
||||
# This script checks for the emergency_mode input_boolean and continue to
|
||||
# stay in emergency mode based on the input_boolean value
|
||||
###############################################################################
|
||||
emergency_script_loop:
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.emergency_mode.state == "on" }}'
|
||||
- delay: '00:00:02'
|
||||
- service: script.emergency_script
|
||||
data_template:
|
||||
message: '{{ message }}'
|
||||
alarm_code: '{{ alarm_code }}'
|
||||
volume_level: '{{ volume_level }}'
|
||||
|
||||
# Turns ALL lights & Switches ON (Lights in RED where possible)
|
||||
###############################################################################
|
||||
emergency_all_lights_switches_on:
|
||||
sequence:
|
||||
- service: script.xiaomi_red
|
||||
- service: script.ifttt_leeo_color_change
|
||||
data_template:
|
||||
value1: "#FF0000"
|
||||
- service: light.turn_on
|
||||
entity_id: light.family_room
|
||||
data:
|
||||
transition: 0
|
||||
brightness: 255
|
||||
rgb_color: [255,0,0]
|
||||
- service: light.turn_on
|
||||
entity_id: light.master_bedroom
|
||||
data:
|
||||
transition: 0
|
||||
brightness: 255
|
||||
rgb_color: [255,0,0]
|
||||
- service: switch.turn_on
|
||||
entity_id:
|
||||
- switch.basement_left
|
||||
- switch.basement_right
|
||||
- switch.garage
|
||||
- switch.guest_bedroom
|
||||
- switch.prayer_room
|
||||
- switch.kids_bed_accent
|
||||
- switch.kids_bedroom
|
||||
- switch.office_room
|
||||
- switch.smart_outlet_1
|
||||
- switch.kitchen
|
||||
- switch.zwave_smart_switch_switch
|
||||
- switch.rf_switch_five
|
||||
- switch.rf_switch_four
|
||||
- switch.rf_switch_one
|
||||
- switch.rf_switch_three
|
||||
- switch.rf_switch_two
|
||||
- switch.wemobackyardlightswitch
|
||||
- switch.frontyard_light
|
||||
- switch.downstairs_bathroom_fragrance_outlet
|
||||
- switch.downstairs_fragrance
|
||||
- switch.upstairs_fragrance
|
||||
- switch.kitchen_siren_switch
|
||||
- switch.kitchen_siren_switch_2
|
||||
- switch.kitchen_siren_switch_3
|
||||
- switch.kitchen_siren_switch_4
|
||||
- switch.kitchen_siren_switch_5
|
||||
- switch.wemoswitch1
|
56
packages/esxi.yaml
Executable file
56
packages/esxi.yaml
Executable file
@@ -0,0 +1,56 @@
|
||||
homeassistant:
|
||||
|
||||
sensor:
|
||||
- platform: snmp
|
||||
name: 'ESXi Server Description'
|
||||
host: !secret esxi_server
|
||||
baseoid: 1.3.6.1.2.1.1.1.0
|
||||
accept_errors: true
|
||||
|
||||
- platform: snmp
|
||||
name: 'ESXi Total RAM'
|
||||
host: !secret esxi_server
|
||||
baseoid: 1.3.6.1.2.1.25.2.3.1.5.6
|
||||
accept_errors: true
|
||||
|
||||
- platform: snmp
|
||||
name: 'ESXi Used RAM'
|
||||
host: !secret esxi_server
|
||||
baseoid: 1.3.6.1.2.1.25.2.3.1.6.6
|
||||
accept_errors: true
|
||||
|
||||
- platform: snmp
|
||||
name: 'ESXi System Uptime Epoch'
|
||||
host: !secret esxi_server
|
||||
baseoid: 1.3.6.1.2.1.25.1.1.0
|
||||
accept_errors: true
|
||||
|
||||
- platform: snmp
|
||||
name: 'ESXi Number of Network Interfaces'
|
||||
host: !secret esxi_server
|
||||
baseoid: 1.3.6.1.2.1.2.1.0
|
||||
accept_errors: true
|
||||
|
||||
- platform: snmp
|
||||
name: 'ESXi System Memory Size'
|
||||
host: !secret esxi_server
|
||||
baseoid: 1.3.6.1.2.1.25.2.2.0
|
||||
accept_errors: true
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
esxi_memory_used:
|
||||
friendly_name: "ESXi Memory Usage"
|
||||
unit_of_measurement: '%'
|
||||
value_template: "{{(states('sensor.esxi_used_ram') | float / states('sensor.esxi_total_ram') | float * 100) | round }}"
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
esxi_system_uptime:
|
||||
friendly_name: "ESXi System Uptime"
|
||||
value_template: >
|
||||
{% set time = states.sensor.esxi_system_uptime_epoch.state | int %}
|
||||
{% set minutes = ((time % 360000) / 6000) | int %}
|
||||
{% set hours = ((time % 8640000) / 360000) | int %}
|
||||
{% set days = (time / 8640000) | int %}
|
||||
{{ days }} days, {{ hours }} hours {{ minutes }} minutes.
|
91
packages/frontend_themes.yaml
Executable file
91
packages/frontend_themes.yaml
Executable file
@@ -0,0 +1,91 @@
|
||||
frontend:
|
||||
themes:
|
||||
dark_red:
|
||||
dark-primary-color: "#c66900"
|
||||
disabled-text-color: "#545454"
|
||||
divider-color: "rgba(255, 255, 255, 0.12)"
|
||||
light-primary-color: "#e06c6c"
|
||||
paper-card-background-color: "#1d1d1d"
|
||||
paper-grey-200: "#191919"
|
||||
paper-item-icon-color: "#d3d3d3"
|
||||
paper-listbox-background-color: "#202020"
|
||||
primary-background-color: "#303030"
|
||||
primary-color: "#d32f2f"
|
||||
primary-text-color: "#cfcfcf"
|
||||
secondary-background-color: "#131313"
|
||||
sidebar-text_-_background: "#62717b"
|
||||
paper-card-header-color: "var(--paper-item-icon-color)"
|
||||
paper-item-icon-active-color: "var(--primary-color)"
|
||||
paper-item-icon_-_color: "var(--primary-text-color)"
|
||||
paper-listbox-color: "var(--primary-text-color)"
|
||||
paper-grey-50: "var(--primary-text-color)"
|
||||
paper-slider-active-color: "var(--primary-color)"
|
||||
paper-slider-knob-color: "var(--primary-color)"
|
||||
paper-slider-knob-start-color: "var(--primary-color)"
|
||||
paper-slider-pin-color: "var(--primary-color)"
|
||||
paper-slider-secondary-color: "var(--light-primary-color)"
|
||||
paper-toggle-button-checked-ink-color: "var(--dark-primary-color)"
|
||||
paper-toggle-button-checked-button-color: "var(--primary-color)"
|
||||
paper-toggle-button-checked-bar-color: "var(--light-primary-color)"
|
||||
paper-toggle-button-unchecked-bar-color: "var(--primary-text-color)"
|
||||
secondary-text-color: "var(--primary-color)"
|
||||
table-row-background-color: "var(--paper-card-background-color)"
|
||||
table-row-alternative-background-color: "var(--sidebar-text_-_background)"
|
||||
light_pink:
|
||||
dark-primary-color: "#ff084a"
|
||||
primary-color: "#fc3468"
|
||||
light-primary-color: "#ffc2cd"
|
||||
paper-toggle-button-checked-ink-color: "#ff6289"
|
||||
paper-toggle-button-checked-button-color: "#ff084a"
|
||||
paper-toggle-button-checked-bar-color: "#ffc2cd"
|
||||
paper-slider-knob-color: "#ff084a"
|
||||
paper-slider-knob-start-color: "#ff084a"
|
||||
paper-slider-pin-color: "#ff084a"
|
||||
paper-slider-active-color: "#ff084a"
|
||||
paper-slider-secondary-color: "#ff93ac"
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
- alias: Random Theme At Startup
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- service_template: frontend.set_theme
|
||||
data_template:
|
||||
name: >
|
||||
{% if states.sun.sun.state == "above_horizon" %}
|
||||
{{ ["light_pink", "default"] | random }}
|
||||
{% else %}
|
||||
{{ [ "dark_red" ] | random }}
|
||||
{% endif %}
|
||||
|
||||
- alias: Random Darker Theme At Sunset
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunset
|
||||
action:
|
||||
- service: frontend.set_theme
|
||||
data_template:
|
||||
name: '{{ ["dark_red"] | random }}'
|
||||
|
||||
- alias: Random Lighter Theme At Sunrise
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunrise
|
||||
action:
|
||||
- service: frontend.set_theme
|
||||
data_template:
|
||||
name: '{{ ["light_pink", "default"] | random }}'
|
36
packages/fun.yaml
Executable file
36
packages/fun.yaml
Executable file
@@ -0,0 +1,36 @@
|
||||
# # ##############################################################################
|
||||
# # @author : Mahasri Kalavala
|
||||
# # @date : 04/15/2017
|
||||
# # @package : Random Chuck Norris Facts
|
||||
# # @description : Daily dose of Chuck Norris.
|
||||
# # It is intentionally set to query once a day.
|
||||
# # Know your limits, too much of Chuck Norris is not good!
|
||||
# #
|
||||
# # These are facts, and not jokes. DO NOT JOKE ABOUT CHUCK NORRIS!
|
||||
# # ##############################################################################
|
||||
# homeassistant:
|
||||
# customize:
|
||||
# sensor.fact_of_the_day:
|
||||
# hidden: true
|
||||
|
||||
# sensor:
|
||||
# - platform: rest
|
||||
# name: fact_of_the_day
|
||||
# resource: http://api.icndb.com/jokes/random?firstName=Chuck&lastName=Norris&limitTo=[nerdy]
|
||||
# value_template: '{{ value_json.value.joke }}'
|
||||
# scan_interval: 86400
|
||||
|
||||
# automation:
|
||||
|
||||
# - alias: Chuck Norris Fact At Startup
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: homeassistant
|
||||
# event: start
|
||||
# action:
|
||||
# - delay:
|
||||
# seconds: 15
|
||||
# - service: persistent_notification.create
|
||||
# data:
|
||||
# title: 'Chuck Norris fact:'
|
||||
# message: '{{ states.sensor.fact_of_the_day.state }}'
|
34
packages/gearbest.yaml
Executable file
34
packages/gearbest.yaml
Executable file
@@ -0,0 +1,34 @@
|
||||
# sensor:
|
||||
# - platform: gearbest
|
||||
# currency: USD
|
||||
# items:
|
||||
# - url: https://www.gearbest.com/alarm-systems/pp_659226.html
|
||||
# name: Xiaomi Aqara Human Body Sensor
|
||||
# - url: https://www.gearbest.com/access-control/pp_626702.html
|
||||
# name: Xiaomi Aqara Temperature Humidity Sensor
|
||||
# - url: https://www.gearbest.com/living-appliances/pp_364494.html
|
||||
# name: xiaomi cube
|
||||
|
||||
# automation:
|
||||
# - alias: Alert Low Price of Cube
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: template
|
||||
# value_template: '{{ states.sensor.xiaomi_cube.state | int < 10 }}'
|
||||
# - platform: template
|
||||
# value_template: '{{ states.sensor.xiaomi_aqara_human_body_sensor.state | int < 10 }}'
|
||||
# - platform: template
|
||||
# value_template: '{{ states.sensor.xiaomi_aqara_temperature_humidity_sensor.state | int < 10 }}'
|
||||
# action:
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: >
|
||||
# {% if states.sensor.xiaomi_aqara_human_body_sensor.state | int < 10 %}
|
||||
# Xiaomi Aqara Motion Sensor is on sale, it is less than $10.... care to buy?
|
||||
# {% endif %}
|
||||
# {% if states.sensor.xiaomi_cube.state | int < 11 %}
|
||||
# Xiaomi Cube is on sale, it is less than $11... buy one?
|
||||
# {% endif %}
|
||||
# {% if states.sensor.xiaomi_aqara_temperature_humidity_sensor.state | int < 7 %}
|
||||
# Xiaomi Temp & Humidity Sensor is on sale for less than $7. Time to buy!
|
||||
# {% endif %}
|
52
packages/google_geocode.yaml
Executable file
52
packages/google_geocode.yaml
Executable file
@@ -0,0 +1,52 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
# Locations
|
||||
sensor.suresh_location:
|
||||
friendly_name: Suresh
|
||||
icon: mdi:map-marker
|
||||
sensor.mallika_location:
|
||||
friendly_name: Mallika
|
||||
icon: mdi:map-marker
|
||||
sensor.srinika_location:
|
||||
friendly_name: Srinika
|
||||
icon: mdi:map-marker
|
||||
sensor.hasika_location:
|
||||
friendly_name: Hasika
|
||||
icon: mdi:map-marker
|
||||
|
||||
# Google Calendar
|
||||
google:
|
||||
client_id: !secret google_client_id
|
||||
client_secret: !secret google_client_secret
|
||||
|
||||
# Google Travel Times and Geo Code/Location
|
||||
sensor:
|
||||
# Address/Location Details
|
||||
- platform: google_geocode
|
||||
name: Suresh Location
|
||||
api_key: !secret google_maps_geocoding_api
|
||||
origin: device_tracker.suresh_suresh
|
||||
options: formatted_address
|
||||
display_zone: hide
|
||||
|
||||
- platform: google_geocode
|
||||
name: Mallika Location
|
||||
api_key: !secret google_maps_geocoding_api
|
||||
origin: device_tracker.mallika_mallika
|
||||
options: formatted_address
|
||||
display_zone: hide
|
||||
|
||||
- platform: google_geocode
|
||||
name: Srinika Location
|
||||
api_key: !secret google_maps_geocoding_api
|
||||
origin: device_tracker.srinika_srinika
|
||||
options: formatted_address
|
||||
display_zone: hide
|
||||
|
||||
- platform: google_geocode
|
||||
name: Hasika Location
|
||||
api_key: !secret google_maps_geocoding_api
|
||||
origin: device_tracker.hasika_hasika
|
||||
options: formatted_address
|
||||
display_zone: hide
|
39
packages/hdmi_cec.yaaml
Executable file
39
packages/hdmi_cec.yaaml
Executable file
@@ -0,0 +1,39 @@
|
||||
# sudo usermod -a -G video homeassistant
|
||||
# ln -s /usr/local/lib/python3.4/dist-packages/cec /srv/homeassistant/lib/python3.4/site-packages
|
||||
|
||||
# echo scan | cec-client -s -d 1
|
||||
|
||||
# opening a connection to the CEC adapter...
|
||||
# requesting CEC bus information ...
|
||||
# CEC bus information
|
||||
# ===================
|
||||
# device #0: TV
|
||||
# address: 0.0.0.0
|
||||
# active source: no
|
||||
# vendor: Vizio
|
||||
# osd string: TV
|
||||
# CEC version: 1.4
|
||||
# power status: on
|
||||
# language: eng
|
||||
#
|
||||
#
|
||||
# device #1: Recorder 1
|
||||
# address: 2.0.0.0
|
||||
# active source: no
|
||||
# vendor: Pulse Eight
|
||||
# osd string: CECTester
|
||||
# CEC version: 1.4
|
||||
# power status: on
|
||||
# language: eng
|
||||
|
||||
# currently active source: unknown (-1)
|
||||
|
||||
|
||||
# Edit /boot/config.txt and include the line to prevent turning TV on when you restart Raspberry Pi
|
||||
# hdmi_ignore_cec_init=1
|
||||
|
||||
|
||||
hdmi_cec:
|
||||
devices:
|
||||
TV: 0.0.0.0
|
||||
PI: 2.0.0.0
|
111
packages/holidays.yaml
Executable file
111
packages/holidays.yaml
Executable file
@@ -0,0 +1,111 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 10/28/2017
|
||||
# @package : Holidays
|
||||
# @description : Retrieves the holiday
|
||||
###############################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
sensor.holiday:
|
||||
hidden: true
|
||||
icon: mdi:beach
|
||||
friendly_name: US Holiday
|
||||
|
||||
###############################################################################
|
||||
# Sensor updates once every 4 hours (14400 seconds) & runs 6 times in 24 hours
|
||||
#
|
||||
# First it checks for holiday in static section, if that doesn't exist,
|
||||
# it checks in the dynamic section. If neither exists, the value will be empty
|
||||
###############################################################################
|
||||
sensor:
|
||||
- platform: rest
|
||||
resource: https://raw.githubusercontent.com/skalavala/smarthome/master/holidays.json
|
||||
name: Holiday
|
||||
scan_interval: 14400
|
||||
value_template: >
|
||||
{% set today = now().month ~ '/' ~ now().day %}
|
||||
{% set holiday = value_json.MAJOR_US.static[ today ] %}
|
||||
{% if holiday | trim == "" %}
|
||||
{% set today = now().month ~ '/' ~ now().day ~ '/' ~ now().year %}
|
||||
{% set holiday = value_json.MAJOR_US.dynamic[ today ] %}
|
||||
{% endif %}
|
||||
{{ holiday }}
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
- alias: Notify Holiday State Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.holiday
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('sensor.holiday') != 'unknown' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states.sensor.holiday.state | trim != '' }}"
|
||||
action:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
message: 'Today is {{ states.sensor.holiday.state }}.'
|
||||
title: '{{ states.sensor.holiday.state }}'
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: 'Today is: {{states.sensor.holiday.state }}'
|
||||
|
||||
- alias: Notify Indian Holidays
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time
|
||||
at: '09:00:00'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{%- set days2NextEvent = 0 -%}
|
||||
{%- if now().year == strptime(states.calendar.holidays_in_india.attributes.start_time, '%Y-%m-%d %H:%M:%S').year -%}
|
||||
{%- set days2NextEvent = strptime(states.calendar.holidays_in_india.attributes.start_time, '%Y-%m-%d %H:%M:%S').strftime('%j') | int - (now().strftime('%j') | int) -%}
|
||||
{%- else -%}
|
||||
{% set days2NextEvent = strptime((now().year ~ "-12-31 12:02:05"), '%Y-%m-%d %H:%M:%S').strftime('%j') | int - (now().strftime('%j') | int) + (strptime(states.calendar.holidays_in_india.attributes.start_time, '%Y-%m-%d %H:%M:%S').strftime('%j') | int) -%}
|
||||
{%- endif -%}
|
||||
{%- if days2NextEvent <= (states.input_number.calendar_remind_before_days.state | int) -%}
|
||||
{%- if days2NextEvent |int == 0 -%}
|
||||
true
|
||||
{%- elif days2NextEvent | int == 1 -%}
|
||||
true
|
||||
{%- elif days2NextEvent | int == 2 -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >-
|
||||
{%- set days2NextEvent = 0 -%}
|
||||
{%- if now().year == strptime(states.calendar.holidays_in_india.attributes.start_time, '%Y-%m-%d %H:%M:%S').year -%}
|
||||
{%- set days2NextEvent = strptime(states.calendar.holidays_in_india.attributes.start_time, '%Y-%m-%d %H:%M:%S').strftime('%j') | int - (now().strftime('%j') | int) -%}
|
||||
{%- else -%}
|
||||
{% set days2NextEvent = strptime((now().year ~ "-12-31 12:02:05"), '%Y-%m-%d %H:%M:%S').strftime('%j') | int - (now().strftime('%j') | int) + (strptime(states.calendar.holidays_in_india.attributes.start_time, '%Y-%m-%d %H:%M:%S').strftime('%j') | int) -%}
|
||||
{%- endif -%}
|
||||
{%- if days2NextEvent <= (states.input_number.calendar_remind_before_days.state | int) -%}
|
||||
{%- if days2NextEvent |int == 0 -%}
|
||||
Today is {{ states.calendar.holidays_in_india.attributes.message | replace(".", "") | title }}.
|
||||
{%- elif days2NextEvent |int == 1 -%}
|
||||
Tomorrow is {{ states.calendar.holidays_in_india.attributes.message | replace(".", "") | title }}.
|
||||
{%- elif days2NextEvent |int == 2 -%}
|
||||
{{ states.calendar.holidays_in_india.attributes.message | replace(".", "") | title }}. is day after tomorrow.
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
214
packages/homeassistant.yaml
Executable file
214
packages/homeassistant.yaml
Executable file
@@ -0,0 +1,214 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Home Assistant
|
||||
# @description : Bunch of Sensors that are system or environment related
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'homeassistant'
|
||||
|
||||
hidden: &hidden
|
||||
hidden: true
|
||||
|
||||
group.system_monitor:
|
||||
order: 3
|
||||
group.internet_speed:
|
||||
order: 4
|
||||
|
||||
group.home_assistant_automations:
|
||||
order: 50
|
||||
|
||||
group.manuals:
|
||||
order: 70
|
||||
group.common_urls:
|
||||
order: 71
|
||||
|
||||
binary_sensor.workday_sensor:
|
||||
<<: *hidden
|
||||
|
||||
sensor.external_ip:
|
||||
friendly_name: External IP Address
|
||||
|
||||
# System Info Sensor
|
||||
sensor.cpu_speed:
|
||||
friendly_name: CPU Speed
|
||||
|
||||
sensor.disk_free:
|
||||
friendly_name: Disk Free Space
|
||||
|
||||
sensor.ipv4_address_ens160:
|
||||
friendly_name: Local IP Address
|
||||
|
||||
sensor.last_boot:
|
||||
friendly_name: Last Boot
|
||||
|
||||
sensor.ha_installed_version:
|
||||
icon: mdi:home-assistant
|
||||
sensor.ha_current_version:
|
||||
icon: mdi:home-assistant
|
||||
sensor.ha_last_restart:
|
||||
icon: mdi:home-assistant
|
||||
|
||||
automation.login_failure:
|
||||
friendly_name: Alert Login Failures
|
||||
|
||||
automation.startup_notification:
|
||||
friendly_name: Notify Startup Events
|
||||
icon: mdi:thumb-up
|
||||
|
||||
automation.update_available_notification:
|
||||
friendly_name: Notify of new updates
|
||||
icon: mdi:update
|
||||
|
||||
script.update_hass:
|
||||
friendly_name: Update Home Assistant
|
||||
icon: mdi:home-assistant
|
||||
|
||||
script.restart_hass:
|
||||
friendly_name: Restart Home Assistant
|
||||
icon: mdi:home-assistant
|
||||
|
||||
script.stop_hass:
|
||||
friendly_name: Stop Home Assistant
|
||||
icon: mdi:home-assistant
|
||||
|
||||
sensor.my_domain:
|
||||
hidden: true
|
||||
|
||||
script:
|
||||
stop_hass:
|
||||
sequence:
|
||||
- service: shell_command.stop_hass
|
||||
update_hass:
|
||||
sequence:
|
||||
- service: shell_command.update_hass
|
||||
restart_hass:
|
||||
sequence:
|
||||
- service: shell_command.restart_hass
|
||||
|
||||
shell_command:
|
||||
stop_hass: >-
|
||||
hassctl stop
|
||||
|
||||
restart_hass: >-
|
||||
hassctl restart
|
||||
|
||||
update_hass: >-
|
||||
hassctl update-hass && hassctl config && hassctl restart
|
||||
|
||||
speedtestdotnet:
|
||||
scan_interval:
|
||||
hours: 1
|
||||
monitored_conditions:
|
||||
- ping
|
||||
- download
|
||||
- upload
|
||||
|
||||
sensor:
|
||||
|
||||
- platform: uptime
|
||||
name: Home Assistant Up Time
|
||||
unit_of_measurement: hours
|
||||
|
||||
- platform: whois
|
||||
domain: !secret namecheap_domain_name
|
||||
name: My Domain
|
||||
|
||||
- platform: rest
|
||||
resource: http://icanhazip.com
|
||||
name: external_ip
|
||||
value_template: '{{ value }}'
|
||||
scan_interval: 86400
|
||||
|
||||
- platform: systemmonitor
|
||||
resources:
|
||||
- type: disk_free
|
||||
arg: /
|
||||
- type: memory_free
|
||||
- type: processor_use
|
||||
- type: ipv4_address
|
||||
arg: ens160
|
||||
- type: last_boot
|
||||
|
||||
- platform: rest
|
||||
resource: https://pypi.python.org/pypi/homeassistant/json
|
||||
name: HA Current Version
|
||||
value_template: '{{ value_json.info.version }}'
|
||||
|
||||
- platform: command_line
|
||||
name: HA Installed Version
|
||||
command: /srv/homeassistant/bin/hass --version
|
||||
scan_interval: 86400
|
||||
|
||||
- platform: pi_hole
|
||||
host: !secret pi_hole_ip
|
||||
ssl: false
|
||||
verify_ssl: false
|
||||
monitored_conditions:
|
||||
- ads_blocked_today
|
||||
- ads_percentage_today
|
||||
- dns_queries_today
|
||||
- domains_being_blocked
|
||||
- queries_cached
|
||||
- queries_forwarded
|
||||
- unique_clients
|
||||
- unique_domains
|
||||
- clients_ever_seen
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# Notify me when I get a new public IP from my ISP
|
||||
######################################################
|
||||
|
||||
- alias: Notify Of New External IP
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.external_ip
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{% if trigger.from_state and trigger.to_state %} true {% else %} false {% endif %}"
|
||||
- condition: template
|
||||
value_template: "{% if trigger.from_state.state == 'unknown' %} false {% else %} true {% endif %}"
|
||||
- condition: template
|
||||
value_template: "{% if trigger.to_state.state == 'unknown' %} false {% else %} true {% endif %}"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Your External IP changed from {{ trigger.from_state.state }} to {{ trigger.to_state.state }}"
|
||||
|
||||
- alias: Update Available Notification
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: updater.updater
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data: {"message":"New HASS update is available. Please update!"}
|
||||
|
||||
- alias: Remind domain renewal
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: numeric_state
|
||||
entity_id: sensor.my_domain
|
||||
below: 30
|
||||
action:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: 'Domain Renew'
|
||||
message: 'It is time to renew your domain. The domain will expire in {{ states.sensor.my_domain.state }} days.'
|
61
packages/homebridge.yaml
Executable file
61
packages/homebridge.yaml
Executable file
@@ -0,0 +1,61 @@
|
||||
homeassistant:
|
||||
customize_domain:
|
||||
|
||||
alarm_control_panel:
|
||||
homebridge_hidden: true
|
||||
|
||||
binary_sensor:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
climate:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
cover:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
calendar:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
device_tracker:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
fan:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
input_boolean:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
light:
|
||||
homebridge_hidden: false
|
||||
emulated_hue_hidden: false
|
||||
|
||||
lock:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
media_player:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
scene:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
remote:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
sensor:
|
||||
homebridge_hidden: true
|
||||
emulated_hue_hidden: true
|
||||
|
||||
switch:
|
||||
homebridge_hidden: false
|
||||
emulated_hue_hidden: false
|
25
packages/homekit.yaml
Executable file
25
packages/homekit.yaml
Executable file
@@ -0,0 +1,25 @@
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
# automation:
|
||||
|
||||
# - alias: 'Start HomeKit'
|
||||
# trigger:
|
||||
# - platform: event
|
||||
# event_type: zwave.network_ready
|
||||
# action:
|
||||
# - service: homekit.start
|
||||
|
||||
# - alias: 'Start HomeKit on HA Restart'
|
||||
# trigger:
|
||||
# - platform: homeassistant
|
||||
# event: start
|
||||
# action:
|
||||
# - delay: 00:05 # Waits 5 minutes
|
||||
# - service: homekit.start
|
476
packages/homesecurity.yaml
Executable file
476
packages/homesecurity.yaml
Executable file
@@ -0,0 +1,476 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Home Security
|
||||
# @description : Home Security System Sensors and Automations
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
group.home_security_system:
|
||||
order: 7
|
||||
|
||||
alarm_control_panel.simplisafe:
|
||||
friendly_name: Home Security System
|
||||
icon: mdi:security
|
||||
sensor.my_alarm_control_panel:
|
||||
friendly_name: Home Security System
|
||||
icon: mdi:security
|
||||
|
||||
simplisafe:
|
||||
accounts:
|
||||
- username: !secret simplisafe_username
|
||||
password: !secret simplisafe_password
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
###############################################################################
|
||||
# Leeo light - color indication of Home Security System
|
||||
# BLUE for Secured (Home and Away), and RED for OFF or Trigerred
|
||||
###############################################################################
|
||||
- alias: Home Security Status Leeo Color
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: alarm_control_panel.simplisafe
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{% if trigger.from_state %} True {% else %} False {% endif %}"
|
||||
- condition: template
|
||||
value_template: '{{ states.alarm_control_panel.simplisafe.state != "unknown" }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.alarm_control_panel.simplisafe.state | trim != "" }}'
|
||||
action:
|
||||
- service_template: >
|
||||
{% if states.alarm_control_panel.simplisafe.state == "armed_home" %}
|
||||
script.xiaomi_blue
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "armed_away" %}
|
||||
script.xiaomi_green
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "triggered" %}
|
||||
script.xiaomi_red
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "disarmed" %}
|
||||
script.xiaomi_red
|
||||
{% endif %}
|
||||
- service: script.ifttt_leeo_color_change
|
||||
data_template:
|
||||
value1: >
|
||||
{% if states.alarm_control_panel.simplisafe.state == "armed_home" %}
|
||||
"#0000FF"
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "armed_away" %}
|
||||
"#00FF00"
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "triggered" %}
|
||||
"#FF0000"
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "disarmed" %}
|
||||
"#FF0000"
|
||||
{% endif %}
|
||||
|
||||
###############################################################################
|
||||
# Notify Security System State Change
|
||||
###############################################################################
|
||||
- alias: Notify Home Security Status Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: alarm_control_panel.simplisafe
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{%- if states.automation.notify_home_security_status_change.attributes.last_triggered -%}
|
||||
{{ (as_timestamp(now()) - as_timestamp(states.automation.notify_home_security_status_change.attributes.last_triggered)) > 90 }}
|
||||
{%- else -%}
|
||||
true
|
||||
{%- endif -%}
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{% if states.alarm_control_panel.simplisafe.state == "armed_home" %}
|
||||
Your home is now secured!
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "armed_away" %}
|
||||
Your Home Security System is now set to Away mode!
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "triggered" %}
|
||||
Attention!: Your Home Security System is triggered! It has been notified to the authorities.
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "disarmed" %}
|
||||
Attention!: Your Home Security System is turned OFF.
|
||||
{% endif %}
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{% if states.alarm_control_panel.simplisafe.state == "armed_home" %}
|
||||
Your home is now secured!
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "armed_away" %}
|
||||
Your Home Security System is now set to Away mode!
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "triggered" %}
|
||||
Attention!: Your Home Security System is triggered! It has been notified to the authorities.
|
||||
{% elif states.alarm_control_panel.simplisafe.state == "disarmed" %}
|
||||
Attention!: Your Home Security System is turned OFF.
|
||||
{% endif %}
|
||||
- condition: template
|
||||
value_template: '{{ states.alarm_control_panel.simplisafe.state != "disarmed" }}'
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.notify_camera_motion
|
||||
|
||||
###############################################################################
|
||||
# A gentle 10 minute reminder that the Home Security system is OFF
|
||||
###############################################################################
|
||||
- alias: Home Security System WatchDog 10 minutes
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- alarm_control_panel.simplisafe
|
||||
to: 'disarmed'
|
||||
for:
|
||||
minutes: 10
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "Home Security System is OFF for more than 10 minutes!"
|
||||
|
||||
###############################################################################
|
||||
# A gentle reminder that the home security is OFF for more than 30 minutes
|
||||
###############################################################################
|
||||
- alias: Home Security System WatchDog 30 minutes
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- alarm_control_panel.simplisafe
|
||||
to: 'disarmed'
|
||||
for:
|
||||
minutes: 30
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "Home Security System is OFF for more than 30 minutes!"
|
||||
|
||||
###############################################################################
|
||||
# When home security system is turned OFF or turned to Home mode from "away"
|
||||
# means, someone reached home from outside
|
||||
###############################################################################
|
||||
- alias: Turn ON Thermostat upon reaching home
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: alarm_control_panel.simplisafe
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if trigger.from_state.state == 'armed_away' and
|
||||
(trigger.to_state.state == 'armed_home' or trigger.to_state.state == 'disarmed') %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
action:
|
||||
- service: climate.set_away_mode
|
||||
data_template:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: 'false'
|
||||
|
||||
###############################################################################
|
||||
# TURN HOME SECURITY SYSTEM ON AT BED TIME
|
||||
###############################################################################
|
||||
- alias: Night HomeSecurity On
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.bedtime_hour.state|int == now().hour|int }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.bedtime_minute.state|int == now().minute|int }}'
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') != 'away' }}"
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: "{{ states('alarm_control_panel.simplisafe') == 'disarmed' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.security_system_alerts') == 'on' }}"
|
||||
action:
|
||||
- service: alarm_control_panel.alarm_arm_home
|
||||
data:
|
||||
entity_id: alarm_control_panel.simplisafe
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "It's bedtime, you forgot to turn ON Home Security System. Turned it ON for you."
|
||||
|
||||
###############################################################################
|
||||
# Check for Garage Door Status when Home Security System State changes
|
||||
###############################################################################
|
||||
# - alias: Home Security System And Garage Door Check
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: time_pattern
|
||||
# minutes: '/15'
|
||||
# seconds: 00
|
||||
# condition:
|
||||
# condition: and
|
||||
# conditions:
|
||||
# - condition: template
|
||||
# value_template: '{{ states.alarm_control_panel.simplisafe.state == "armed_home" or states.alarm_control_panel.simplisafe.state == "armed_away" }}'
|
||||
# - condition: or
|
||||
# conditions:
|
||||
# - condition: template
|
||||
# value_template: '{{ states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" }}'
|
||||
# - condition: template
|
||||
# value_template: '{{ states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" }}'
|
||||
# action:
|
||||
# - service: switch.turn_on
|
||||
# entity_id: switch.garage
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: >
|
||||
# Attention! Your home Security system is set to {{ states.alarm_control_panel.simplisafe.state.split('_')[1] | upper }} mode.
|
||||
# BUT THE {% if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" -%}DOUBLE CAR {%- else %}SINGLE CAR {% endif %}GARAGE DOOR IS STILL OPEN!
|
||||
# - service: camera.snapshot
|
||||
# data_template:
|
||||
# entity_id: "camera.garage_camera"
|
||||
# filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~ (states.automation.home_security_system_and_garage_door_check.last_updated ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
# - service: camera.snapshot
|
||||
# data_template:
|
||||
# entity_id: "camera.driveway_camera"
|
||||
# filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_' ~ (states.automation.home_security_system_and_garage_door_check.last_updated ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
# - service: camera.snapshot
|
||||
# data_template:
|
||||
# entity_id: "camera.frontdoor_camera"
|
||||
# filename: "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_' ~ (states.automation.home_security_system_and_garage_door_check.last_updated ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
# - service: notify.notify_smtp
|
||||
# data_template:
|
||||
# title: 'Garage Picture {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
# message: >-
|
||||
# {%- macro get_date(dt) %}
|
||||
# {%- set date_suffix = ["th", "st", "nd", "rd"] -%}
|
||||
# {{ dt.day }}
|
||||
# {%- if dt.day % 10 in [1, 2, 3] and dt.day not in [11, 12, 13] -%}
|
||||
# {{ date_suffix[dt.day%10] }}
|
||||
# {%- else -%}
|
||||
# {{ date_suffix[0] }}
|
||||
# {%- endif %} {{ dt.strftime("%B %Y")}}
|
||||
# {%- endmacro -%}
|
||||
# {% set doors = "" %}
|
||||
# {% if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" and states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
# {% set doors = "Both garage doors" %}
|
||||
# {% elif states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on"%}
|
||||
# {% set doors = states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.name %}
|
||||
# {% elif states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
# {% set doors = states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.name %}
|
||||
# {% endif %}
|
||||
# Your {{ doors }} seem to be open while your home security system is set to "{{ states.alarm_control_panel.simplisafe.state.split('_')[1]| title }}" mode. Today is {{ get_date(now()) }}, and time is {{ now().strftime("%I:%M:%S %p") }}. Please see the attached pictures and make sure everything is okay.
|
||||
# data:
|
||||
# images:
|
||||
# - "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/garage/garage_' ~ (states.automation.home_security_system_and_garage_door_check.last_updated ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
# - "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/driveway/driveway_' ~ (states.automation.home_security_system_and_garage_door_check.last_updated ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
# - "{{ '/home/homeassistant/.homeassistant/www/downloads/camera/frontdoor/frontdoor_' ~ (states.automation.home_security_system_and_garage_door_check.last_updated ~ '').replace('-','_').replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
||||
# - condition: template
|
||||
# value_template: '{{ states.alarm_control_panel.simplisafe.state == "armed_home" }}'
|
||||
# - service: script.voice_notify
|
||||
# data_template:
|
||||
# message: >
|
||||
# {% set doors = "" %}
|
||||
# {% if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" and states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
# {% set doors = "Both garage doors" %}
|
||||
# {% elif states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on"%}
|
||||
# {% set doors = states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.name %}
|
||||
# {% elif states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" %}
|
||||
# {% set doors = states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.name %}
|
||||
# {% endif %}
|
||||
# Attention! Your home Security system is set to {{ states.alarm_control_panel.simplisafe.state.split('_')[1] | upper }} mode.
|
||||
# BUT the {{ doors }} {{ 'are' if doors.endswith('s') else 'is' }} open.
|
||||
|
||||
###############################################################################
|
||||
# Turn Home Security System ON at sunset time
|
||||
###############################################################################
|
||||
# - alias: Turn On Home Security System At Sunset
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# platform: sun
|
||||
# event: sunset
|
||||
# offset: '+00:00:00'
|
||||
# condition:
|
||||
# - condition: state
|
||||
# entity_id: group.all_devices
|
||||
# state: 'home'
|
||||
# - condition: state
|
||||
# entity_id: alarm_control_panel.simplisafe
|
||||
# state: 'disarmed'
|
||||
# action:
|
||||
# - service_template: >-
|
||||
# {% if states.binary_sensor.back_door_sensor_sensor.state == "off" and
|
||||
# states.binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor.state == "off" and
|
||||
# states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "off" and
|
||||
# states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "off" %}
|
||||
# alarm_control_panel.alarm_arm_home
|
||||
# {% else %}
|
||||
# alarm_control_panel.disarm
|
||||
# {% endif %}
|
||||
# data:
|
||||
# entity_id: alarm_control_panel.simplisafe
|
||||
# - service: script.voice_notify
|
||||
# data_template:
|
||||
# message: >
|
||||
# {% if states.binary_sensor.back_door_sensor_sensor.state == "off" and
|
||||
# states.binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor.state == "off" and
|
||||
# states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "off" and
|
||||
# states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "off" %}
|
||||
# It's getting dark outside, and your home security system is now set to HOME mode.
|
||||
# {% else %}
|
||||
# It is getting dark outside.
|
||||
# {%- if states.binary_sensor.back_door_sensor_sensor.state == "on" -%}
|
||||
# {%- set doors = doors ~ " Back Door" -%}
|
||||
# {%- endif -%}
|
||||
# {%- if states.binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor.state == "on" -%}
|
||||
# {% if doors | trim != "" %}
|
||||
# {%- set doors = doors ~ " and Front Door" -%}
|
||||
# {% else %}
|
||||
# {%- set doors = doors ~ " Front Door" -%}
|
||||
# {% endif %}
|
||||
# {%- endif -%}
|
||||
# {%- if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" -%}
|
||||
# {% if doors | trim != "" %}
|
||||
# {%- set doors = doors ~ " and Two Car Garage Door" -%}
|
||||
# {% else %}
|
||||
# {%- set doors = doors ~ " Two Car Garage Door" -%}
|
||||
# {% endif %}
|
||||
# {%- endif -%}
|
||||
# {%- if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" -%}
|
||||
# {% if doors | trim != "" %}
|
||||
# {%- set doors = doors ~ " and Single Car Garage Door" -%}
|
||||
# {% else %}
|
||||
# {%- set doors = doors ~ " Single Car Garage Door" -%}
|
||||
# {% endif %}
|
||||
# {%- endif -%}
|
||||
# Your{{ doors }} {%- if 'and' in doors -%}s are {%- else %} is {%- endif %} open. Home Security System could not be turned on.
|
||||
# {% endif %}
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: >
|
||||
# {% if states.binary_sensor.back_door_sensor_sensor.state == "off" and
|
||||
# states.binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor.state == "off" and
|
||||
# states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "off" and
|
||||
# states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "off" %}
|
||||
# It's getting dark outside, and your home security system is now set to HOME mode.
|
||||
# {% else %}
|
||||
# It is getting dark outside.
|
||||
# {%- if states.binary_sensor.back_door_sensor_sensor.state == "on" -%}
|
||||
# {%- set doors = doors ~ " Back Door" -%}
|
||||
# {%- endif -%}
|
||||
# {%- if states.binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor.state == "on" -%}
|
||||
# {% if doors | trim != "" %}
|
||||
# {%- set doors = doors ~ " and Front Door" -%}
|
||||
# {% else %}
|
||||
# {%- set doors = doors ~ " Front Door" -%}
|
||||
# {% endif %}
|
||||
# {%- endif -%}
|
||||
# {%- if states.binary_sensor.two_car_garage_door_tilt_sensor_sensor.state == "on" -%}
|
||||
# {% if doors | trim != "" %}
|
||||
# {%- set doors = doors ~ " and Two Car Garage Door" -%}
|
||||
# {% else %}
|
||||
# {%- set doors = doors ~ " Two Car Garage Door" -%}
|
||||
# {% endif %}
|
||||
# {%- endif -%}
|
||||
# {%- if states.binary_sensor.single_car_garage_door_tilt_sensor_sensor.state == "on" -%}
|
||||
# {% if doors | trim != "" %}
|
||||
# {%- set doors = doors ~ " and Single Car Garage Door" -%}
|
||||
# {% else %}
|
||||
# {%- set doors = doors ~ " Single Car Garage Door" -%}
|
||||
# {% endif %}
|
||||
# {%- endif -%}
|
||||
# Your {{ doors}} {%- if 'and' in doors -%}s are {%- else %} is {%- endif %} open. Home Security System could not be turned on.
|
||||
# {% endif %}
|
||||
|
||||
##############################################################################
|
||||
# Ask me if I want to turn off Home Security System upon reaching front door
|
||||
# Ask me only when the security system is ON or AWAY mode
|
||||
##############################################################################
|
||||
# - alias: Turn Off Security Upon Reaching Home
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: device_tracker.suresh_suresh
|
||||
# from: 'not_home'
|
||||
# to: 'home'
|
||||
# condition:
|
||||
# condition: or
|
||||
# conditions:
|
||||
# - condition: template
|
||||
# value_template: '{{ states.alarm_control_panel.simplisafe.state | lower == "armed_away" }}'
|
||||
# - condition: template
|
||||
# value_template: '{{ states.alarm_control_panel.simplisafe.state | lower == "armed_home" }}'
|
||||
# action:
|
||||
# - service: notify.ios_suresh
|
||||
# data_template:
|
||||
# title: 'Welcome Home, Suresh!'
|
||||
# message: 'Turn Off Home Security System?'
|
||||
# data:
|
||||
# push:
|
||||
# badge: 0
|
||||
# category: 'welcome_home'
|
||||
|
||||
##############################################################################
|
||||
# Ask me if I want to turn off Home Security System when garage door is opened
|
||||
# Ask me only when the security system is ON or AWAY mode
|
||||
##############################################################################
|
||||
# - alias: Notify Garage Status And Home Security System
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# platform: state
|
||||
# entity_id:
|
||||
# - binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
# - binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
# to: 'on'
|
||||
# condition:
|
||||
# - condition: template
|
||||
# value_template: '{{ states.alarm_control_panel.simplisafe.state == "armed_home" or states.alarm_control_panel.simplisafe.state == "armed_away" }}'
|
||||
# action:
|
||||
# - service: notify.ios_suresh
|
||||
# data_template:
|
||||
# title: >
|
||||
# Your Home is armed, and {{ trigger.entity_id.split('.')[1].split('_')[0] |title }} Car Garage is just opened!
|
||||
# message: 'Turn Off Home Security System?'
|
||||
# data:
|
||||
# push:
|
||||
# badge: 0
|
||||
# category: 'welcome_home'
|
||||
|
||||
##############################################################################
|
||||
# iOS Actionable Notification that disables Home Security System
|
||||
##############################################################################
|
||||
# - alias: Disable Home Security iOS Action
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# platform: event
|
||||
# event_type: ios.notification_action_fired
|
||||
# event_data:
|
||||
# actionName: 'DISABLE_SECURITY'
|
||||
# action:
|
||||
# - service: alarm_control_panel.alarm_disarm
|
||||
# entity_id: alarm_control_panel.simplisafe
|
||||
# - service: notify.ios_suresh
|
||||
# data:
|
||||
# message: "Unlocked your home!"
|
56
packages/ios.yaml
Executable file
56
packages/ios.yaml
Executable file
@@ -0,0 +1,56 @@
|
||||
# homeassistant:
|
||||
# customize:
|
||||
# group.family:
|
||||
# order: 1
|
||||
# group.ios:
|
||||
# order: 98
|
||||
|
||||
# device_tracker.ipad:
|
||||
# hidden: true
|
||||
# device_tracker.suresh:
|
||||
# hidden: true
|
||||
# device_tracker.mallika:
|
||||
# hidden: true
|
||||
# device_tracker.srinika:
|
||||
# hidden: true
|
||||
# device_tracker.hasika:
|
||||
# hidden: true
|
||||
|
||||
# # Battery Levels
|
||||
# sensor.suresh_battery_level:
|
||||
# friendly_name: Suresh's Battery Level
|
||||
# hidden: true
|
||||
# sensor.mallika_battery_level:
|
||||
# friendly_name: Mallika's Battery Level
|
||||
# hidden: true
|
||||
# sensor.srinika_battery_level:
|
||||
# friendly_name: Srinika's Battery Level
|
||||
# hidden: true
|
||||
# sensor.hasika_battery_level:
|
||||
# friendly_name: Hasika's Battery Level
|
||||
# hidden: true
|
||||
# sensor.ipad_battery_level:
|
||||
# friendly_name: iPad's Battery State
|
||||
# hidden: true
|
||||
# sensor.iphone__battery_level:
|
||||
# friendly_name: iPhone
|
||||
# hidden: true
|
||||
|
||||
# sensor.suresh_battery_state:
|
||||
# friendly_name: Suresh's Battery State
|
||||
# hidden: true
|
||||
# sensor.mallika_battery_state:
|
||||
# friendly_name: Mallika's Battery State
|
||||
# hidden: true
|
||||
# sensor.srinika_battery_state:
|
||||
# friendly_name: Srinika's Battery State
|
||||
# hidden: true
|
||||
# sensor.hasika_battery_state:
|
||||
# friendly_name: Hasika's Battery State
|
||||
# hidden: true
|
||||
# sensor.ipad_battery_state:
|
||||
# friendly_name: iPad's Battery State
|
||||
# hidden: true
|
||||
# sensor.iphone__battery_state:
|
||||
# friendly_name: iphone
|
||||
# hidden: true
|
46
packages/life360.yaml
Executable file
46
packages/life360.yaml
Executable file
@@ -0,0 +1,46 @@
|
||||
###############################################################################
|
||||
# PACKAGE: LIFE360 SENSOR
|
||||
# Description: The Life360 sensor requires username, password and mqtt topic.
|
||||
# Whatever the topic you specify, the data will be dumped there.
|
||||
# Use the exact topic name in the Parse Life360 Data automation.
|
||||
###############################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
sensor.life360_sensor:
|
||||
friendly_name: Life 360
|
||||
hidden: true
|
||||
|
||||
sensor:
|
||||
- platform: life360
|
||||
username: !secret life360_username
|
||||
password: !secret life360_password
|
||||
mqtt_topic: "/life360/data"
|
||||
scan_interval: 15
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
###############################################################################
|
||||
# Alert me When the sensor fails
|
||||
###############################################################################
|
||||
- alias: Alert Life360 Error
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.life360_sensor
|
||||
to: 'error'
|
||||
for: '00:05:00'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Life360 Sensor state changed to: {{ trigger.to_state.state| upper }}."
|
487
packages/lights.yaml
Executable file
487
packages/lights.yaml
Executable file
@@ -0,0 +1,487 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Lights
|
||||
# @description : Lights, Lights, Lights! All the Lights are here!
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'lights'
|
||||
|
||||
exposed: &exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: true
|
||||
homebridge_hidden: false
|
||||
|
||||
not_exposed: ¬_exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: false
|
||||
homebridge_hidden: true
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
switch.frontyard_light:
|
||||
<<: *exposed
|
||||
icon: mdi:lightbulb
|
||||
friendly_name: Front Porch Lights
|
||||
emulated_hue_name: Front Yard Lights
|
||||
homebridge_name: Front Yard Lights
|
||||
|
||||
switch.wemoswitch1:
|
||||
<<: *exposed
|
||||
icon: mdi:lamp
|
||||
friendly_name: TV Switch
|
||||
emulated_hue_name: TV Switch
|
||||
homebridge_name: TV Switch
|
||||
|
||||
switch.wemobackyardlightswitch:
|
||||
<<: *exposed
|
||||
icon: mdi:lightbulb
|
||||
friendly_name: Backyard Lights
|
||||
emulated_hue_name: Backyard Lights
|
||||
homebridge_name: Backyard Lights
|
||||
|
||||
light.family_room:
|
||||
<<: *exposed
|
||||
friendly_name: Family Room Lights
|
||||
emulated_hue_name: Family Room Lights
|
||||
homebridge_name: Front Room Lights
|
||||
|
||||
light.master_bedroom:
|
||||
<<: *exposed
|
||||
friendly_name: Master Bedroom Lights
|
||||
emulated_hue_name: Master Bedroom Lights
|
||||
homebridge_name: Master Bedroom Lights
|
||||
|
||||
switch.guest_bedroom:
|
||||
<<: *exposed
|
||||
icon: mdi:lightbulb
|
||||
friendly_name: Guest Bedroom 1
|
||||
emulated_hue_name: Guest Bedroom 1
|
||||
homebridge_name: Guest Bedroom 1
|
||||
|
||||
switch.prayer_room:
|
||||
<<: *exposed
|
||||
icon: mdi:lightbulb
|
||||
friendly_name: Guest Bedroom 2
|
||||
emulated_hue_name: Guest Bedroom 2
|
||||
homebridge_name: Guest Bedroom 2
|
||||
|
||||
switch.zwave_smart_switch_switch:
|
||||
<<: *exposed
|
||||
friendly_name: Office Room Accent Lights
|
||||
emulated_hue_name: Office Room Accent Lights
|
||||
homebridge_name: Office Room Accent Lights
|
||||
assumed_state: false
|
||||
icon: mdi:lightbulb
|
||||
|
||||
switch.basement_left:
|
||||
<<: *exposed
|
||||
friendly_name: Basement Theater Lights
|
||||
assumed_state: false
|
||||
icon: mdi:lightbulb
|
||||
switch.basement_right:
|
||||
<<: *exposed
|
||||
friendly_name: Basement Right Side Lights
|
||||
assumed_state: false
|
||||
icon: mdi:lightbulb
|
||||
switch.kitchen:
|
||||
<<: *exposed
|
||||
friendly_name: Kitchen Light
|
||||
assumed_state: false
|
||||
icon: mdi:lightbulb
|
||||
switch.office_room:
|
||||
<<: *exposed
|
||||
friendly_name: Office Room Lights
|
||||
assumed_state: false
|
||||
icon: mdi:lightbulb
|
||||
switch.kids_bedroom:
|
||||
<<: *exposed
|
||||
friendly_name: Kids Bedroom
|
||||
icon: mdi:lightbulb
|
||||
switch.garage:
|
||||
<<: *exposed
|
||||
friendly_name: Garage Lights
|
||||
icon: mdi:lightbulb
|
||||
|
||||
# Xiaomi Gateway Light Scripts
|
||||
script.xiaomi_red:
|
||||
<<: *hidden
|
||||
script.xiaomi_blue:
|
||||
<<: *hidden
|
||||
script.xiaomi_green:
|
||||
<<: *hidden
|
||||
|
||||
light.all_hue_lights:
|
||||
<<: *hidden
|
||||
|
||||
light.hue_color_lamp_1:
|
||||
<<: *exposed
|
||||
friendly_name: Family Room Light 1
|
||||
color_set: false
|
||||
light.hue_color_lamp_2:
|
||||
<<: *exposed
|
||||
friendly_name: Family Room Light 2
|
||||
color_set: false
|
||||
light.hue_color_lamp_3:
|
||||
<<: *exposed
|
||||
friendly_name: Family Room Light 3
|
||||
color_set: false
|
||||
input_boolean.short_flash:
|
||||
<<: *not_exposed
|
||||
icon: mdi:flash
|
||||
friendly_name: Short Flash
|
||||
input_boolean.long_flash:
|
||||
<<: *not_exposed
|
||||
icon: mdi:flash
|
||||
friendly_name: Long Flash
|
||||
input_boolean.animate_downstairs_lights:
|
||||
<<: *not_exposed
|
||||
icon: mdi:flash-outline
|
||||
friendly_name: Animate Family Room Lights
|
||||
input_boolean.animate_upstairs_lights:
|
||||
<<: *not_exposed
|
||||
icon: mdi:flash-outline
|
||||
friendly_name: Animate Master Bedroom Lights
|
||||
|
||||
# Set assumed_state to false to show up as switch instead of two lightning symbols
|
||||
switch.rf_switch_one:
|
||||
friendly_name: Basement Light
|
||||
assumed_state: false
|
||||
switch.rf_switch_two:
|
||||
friendly_name: Switch Two
|
||||
assumed_state: false
|
||||
switch.rf_switch_three:
|
||||
friendly_name: Switch Three
|
||||
assumed_state: false
|
||||
switch.rf_switch_four:
|
||||
friendly_name: Front Room Light
|
||||
assumed_state: false
|
||||
switch.rf_switch_five:
|
||||
friendly_name: TV Switch
|
||||
assumed_state: false
|
||||
|
||||
hue:
|
||||
bridges:
|
||||
- host: !secret philips_hue_ipaddress
|
||||
|
||||
tplink:
|
||||
discovery: false
|
||||
switch:
|
||||
|
||||
# In-wall switches
|
||||
- host: !secret tplink_kids_bedroom
|
||||
- host: !secret tplink_guest_bedroom_1
|
||||
- host: !secret tplink_guest_bedroom_2
|
||||
- host: !secret tplink_garage
|
||||
- host: !secret tplink_basement_left
|
||||
- host: !secret tplink_basement_right
|
||||
- host: !secret tplink_kitchen
|
||||
- host: !secret tplink_office_room
|
||||
|
||||
# Smart Outlets
|
||||
- host: !secret tplink_smart_outlet1
|
||||
#name: Downstairs Fragrance Outlet
|
||||
- host: !secret tplink_smart_outlet2
|
||||
#name: Downstairs Bathroom Fragrance Outlet
|
||||
- host: !secret tplink_smart_outlet3
|
||||
#name: Upstairs Fragrance Outlet
|
||||
- host: !secret tplink_kids_bed_accent_light
|
||||
#name: Kids Bed Accent Light
|
||||
|
||||
switch:
|
||||
# RF Switches
|
||||
# - platform: mqtt
|
||||
# name: RF Switch One
|
||||
# command_topic: '/home/rfswitches/switch_one'
|
||||
# payload_on: "on"
|
||||
# payload_off: "off"
|
||||
# retain: true
|
||||
|
||||
# - platform: mqtt
|
||||
# name: RF Switch Two
|
||||
# command_topic: '/home/rfswitches/switch_two'
|
||||
# payload_on: "on"
|
||||
# payload_off: "off"
|
||||
# retain: true
|
||||
|
||||
# - platform: mqtt
|
||||
# name: RF Switch Three
|
||||
# command_topic: '/home/rfswitches/switch_three'
|
||||
# payload_on: "on"
|
||||
# payload_off: "off"
|
||||
# retain: true
|
||||
|
||||
# - platform: mqtt
|
||||
# name: RF Switch Four
|
||||
# command_topic: '/home/rfswitches/switch_four'
|
||||
# payload_on: "on"
|
||||
# payload_off: "off"
|
||||
# retain: true
|
||||
|
||||
# - platform: mqtt
|
||||
# name: RF Switch Five
|
||||
# command_topic: '/home/rfswitches/switch_five'
|
||||
# payload_on: "on"
|
||||
# payload_off: "off"
|
||||
# retain: true
|
||||
|
||||
wemo:
|
||||
static:
|
||||
- !secret wemo_switch_1
|
||||
- !secret wemo_switch_2
|
||||
- !secret wemo_switch_3
|
||||
- !secret wemo_sharp_tv
|
||||
|
||||
input_boolean:
|
||||
animate_upstairs_lights:
|
||||
name: Animate Master Bedroom Lights
|
||||
initial: off
|
||||
animate_downstairs_lights:
|
||||
name: Animate Family Room Lights
|
||||
initial: off
|
||||
animate_kitchen_lights:
|
||||
name: Animate Kitchen Lights
|
||||
initial: off
|
||||
long_flash:
|
||||
name: Long Flash Lights
|
||||
initial: off
|
||||
short_flash:
|
||||
name: Long Flash Lights
|
||||
initial: off
|
||||
|
||||
script:
|
||||
xiaomi_red:
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.gateway_light_34ce008ad65d
|
||||
brightness: 255
|
||||
rgb_color: [255,0,0]
|
||||
|
||||
xiaomi_blue:
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.gateway_light_34ce008ad65d
|
||||
brightness: 255
|
||||
rgb_color: [0,0,255]
|
||||
|
||||
xiaomi_green:
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.gateway_light_34ce008ad65d
|
||||
brightness: 255
|
||||
rgb_color: [0,255,0]
|
||||
|
||||
# start_colorloop:
|
||||
# sequence:
|
||||
# - service: light.lifx_effect_colorloop
|
||||
# data:
|
||||
# entity_id: light.dinette
|
||||
# brightness: 255
|
||||
# period: 2
|
||||
# spread: 360
|
||||
# change: 35
|
||||
|
||||
# stop_colorloop:
|
||||
# sequence:
|
||||
# - service: light.lifx_effect_stop
|
||||
# data:
|
||||
# entity_id: light.dinette
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# Animate Master Bedroom Lights
|
||||
###############################################################################
|
||||
- alias: Animate Master Bedroom Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
seconds: '/5'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.animate_upstairs_lights
|
||||
state: 'on'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: group.master_bedroom_lights
|
||||
transition: 5
|
||||
brightness: 255
|
||||
color_temp: 366
|
||||
data_template:
|
||||
rgb_color: ['{{ "{0:d}".format(range(0, 255)|random) }}' ,
|
||||
'{{ "{0:d}".format(range(0, 255)|random) }}',
|
||||
'{{ "{0:d}".format(range(0, 255)|random) }}']
|
||||
|
||||
# Restore Master Bedroom Lights
|
||||
###############################################################################
|
||||
- alias: Restore Masterbedroom Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.animate_upstairs_lights
|
||||
to: 'off'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: group.master_bedroom_lights
|
||||
transition: 5
|
||||
rgb_color: [224,175,102]
|
||||
brightness: 10
|
||||
color_temp: 366
|
||||
|
||||
# Animate Familyroom Lights
|
||||
###############################################################################
|
||||
- alias: Animate Familyroom Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
seconds: '/5'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.animate_downstairs_lights
|
||||
state: 'on'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: group.family_room_lights
|
||||
transition: 5
|
||||
brightness: 255
|
||||
color_temp: 366
|
||||
data_template:
|
||||
rgb_color: ['{{ "{0:d}".format(range(0, 255)|random) }}' ,
|
||||
'{{ "{0:d}".format(range(0, 255)|random) }}',
|
||||
'{{ "{0:d}".format(range(0, 255)|random) }}']
|
||||
|
||||
# Restore Familyroom Lights
|
||||
###############################################################################
|
||||
- alias: Restore Familyroom Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.animate_downstairs_lights
|
||||
to: 'off'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: group.family_room_lights
|
||||
transition: 5
|
||||
rgb_color: [255, 251, 245]
|
||||
brightness: 255
|
||||
color_temp: 162
|
||||
|
||||
# Animate Kitchen Lights ON
|
||||
###############################################################################
|
||||
# - alias: Animate Kitchen Lights ON
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: time_pattern
|
||||
# seconds: '/3'
|
||||
# condition:
|
||||
# - condition: state
|
||||
# entity_id: input_boolean.animate_kitchen_lights
|
||||
# state: 'on'
|
||||
# action:
|
||||
# - service: light.turn_on
|
||||
# entity_id: light.dinette
|
||||
# data_template:
|
||||
# rgb_color: ['{{ (range(0, 255)|random) }}',
|
||||
# '{{ (range(0, 255)|random) }}',
|
||||
# '{{ (range(0, 255)|random) }}']
|
||||
# brightness: 255
|
||||
# transition: '{{ (range(1, 2)|random) }}'
|
||||
|
||||
# Animate Kitchen Lights OFF
|
||||
###############################################################################
|
||||
# - alias: Animate Kitchen Lights OFF
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: input_boolean.animate_kitchen_lights
|
||||
# to: 'off'
|
||||
# action:
|
||||
# - service: light.turn_on
|
||||
# entity_id: light.dinette
|
||||
# data:
|
||||
# rgb_color: [255, 255, 255]
|
||||
# brightness: 255
|
||||
# color_temp: 155
|
||||
|
||||
# Long Flash All Lights
|
||||
###############################################################################
|
||||
- alias: Long Flash All Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.long_flash
|
||||
to: 'on'
|
||||
from: 'off'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id:
|
||||
- group.all_lights
|
||||
data:
|
||||
flash: long
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.long_flash
|
||||
|
||||
# Short Flash All Lights
|
||||
###############################################################################
|
||||
- alias: Short Flash All Lights
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.short_flash
|
||||
to: 'on'
|
||||
from: 'off'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id:
|
||||
- group.all_lights
|
||||
data:
|
||||
flash: short
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.short_flash
|
102
packages/logger.yaml
Executable file
102
packages/logger.yaml
Executable file
@@ -0,0 +1,102 @@
|
||||
# ###############################################################################
|
||||
# # @Description : Logger Package to set log level on the fly at runtime
|
||||
# ###############################################################################
|
||||
|
||||
# homeassistant:
|
||||
# customize:
|
||||
# sensor.current_log_level:
|
||||
# friendly_name: Current Log Level
|
||||
# hidden: true
|
||||
|
||||
# logger:
|
||||
# default: warning
|
||||
# logs:
|
||||
# gsp: critical
|
||||
# aiohttp.server: critical
|
||||
# simplipy.system: critical
|
||||
# homeassistant.components.light: critical
|
||||
# openzwave: debug
|
||||
# pywemo.ssdp: error
|
||||
# libopenzwave: error
|
||||
# netdisco.ssdp: error
|
||||
# homeassistant.core: error
|
||||
# homeassistant.setup: error
|
||||
# homeassistant.loader: error
|
||||
# homeassistant.components.api: error
|
||||
# homeassistant.helpers.script: error
|
||||
# homeassistant.components.mqtt: error
|
||||
# homeassistant.components.http: error
|
||||
# homeassistant.helpers.entity: error
|
||||
# homeassistant.components.zwave: error
|
||||
# homeassistant.components.sensor: error
|
||||
# homeassistant.helpers.condition: error
|
||||
# homeassistant.components.recorder: error
|
||||
# homeassistant.components.discovery: error
|
||||
# homeassistant.components.automation: error
|
||||
# homeassistant.components.light.lifx: error
|
||||
# homeassistant.components.emulated_hue: error
|
||||
# homeassistant.components.media_player: error
|
||||
# homeassistant.components.device_tracker: error
|
||||
# custom_components.sensor.life360: error
|
||||
# custom_components.sensor.command_line: error
|
||||
# custom_components.media_player.sharptv: error
|
||||
|
||||
# ###############################################################################
|
||||
# # Logger level
|
||||
# input_select:
|
||||
# log_level:
|
||||
# name: Log Level
|
||||
# options:
|
||||
# - critical
|
||||
# - fatal
|
||||
# - error
|
||||
# - warning
|
||||
# - warn
|
||||
# - info
|
||||
# - debug
|
||||
# - notset
|
||||
# initial: warning
|
||||
|
||||
# sensor:
|
||||
# - platform: mqtt
|
||||
# state_topic: '/homeassistant/log_level'
|
||||
# name: "Current Log Level"
|
||||
# value_template: "{{ value }}"
|
||||
|
||||
# automation:
|
||||
# ###############################################################################
|
||||
# # Sets Logging Level
|
||||
# ###############################################################################
|
||||
# - alias: Log Level
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: input_select.log_level
|
||||
# action:
|
||||
# - service: logger.set_level
|
||||
# data_template:
|
||||
# homeassistant.components: "{{ trigger.to_state.state }}"
|
||||
# - service: mqtt.publish
|
||||
# data_template:
|
||||
# topic: '/homeassistant/log_level'
|
||||
# payload: '{{ trigger.to_state.state }}'
|
||||
# retain: true
|
||||
|
||||
# ###############################################################################
|
||||
# # Restore Log Level
|
||||
# ###############################################################################
|
||||
# - alias: Restore Log Level on Startup
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# platform: homeassistant
|
||||
# event: start
|
||||
# action:
|
||||
# - delay:
|
||||
# minutes: 0
|
||||
# seconds: 15
|
||||
# - service: input_select.select_option
|
||||
# data_template:
|
||||
# entity_id: input_select.log_level
|
||||
# option: '{{ states.sensor.current_log_level.state | default("warning") }}'
|
209
packages/media_players.yaml
Executable file
209
packages/media_players.yaml
Executable file
@@ -0,0 +1,209 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Media Player
|
||||
# @description : Media Player Sensors, Automations
|
||||
###############################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'media_players'
|
||||
|
||||
exposed: &exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: true
|
||||
homebridge_hidden: false
|
||||
|
||||
not_exposed: ¬_exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: false
|
||||
homebridge_hidden: true
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
# Media Players
|
||||
media_player.snapcast_client_b827eb8604f5:
|
||||
friendly_name: Front Room Music
|
||||
media_player.snapcast_client_b827ebaa08f7:
|
||||
friendly_name: Kitchen Music
|
||||
media_player.snapcast_client_b827eb011e00:
|
||||
friendly_name: TV Room Music
|
||||
media_player.snapcast_client_b827eb4445b1:
|
||||
friendly_name: Master Bedroom Music
|
||||
media_player.snapcast_client_b827eba8e7ef:
|
||||
friendly_name: Guest Bedroom 1 Music
|
||||
media_player.snapcast_client_b827eb505e2d:
|
||||
friendly_name: Guest Bedroom 2 Music
|
||||
media_player.snapcast_client_001e8c40c713:
|
||||
friendly_name: Basement Music
|
||||
media_player.snapcast_client_b827ebf10965:
|
||||
friendly_name: Office Room Music
|
||||
media_player.snapcast_client_0018e7c4488f:
|
||||
friendly_name: HA Server (Basement)
|
||||
|
||||
script.stop_snapcast_server:
|
||||
friendly_name: Stop Snapcast Server
|
||||
script.start_snapcast_server:
|
||||
friendly_name: Start Snapcast Server
|
||||
script.restart_snapcast_server:
|
||||
friendly_name: Restart Snapcast Server
|
||||
|
||||
media_player.denon_avrx2400h:
|
||||
friendly_name: Denon AVRX2400H
|
||||
hidden: false
|
||||
media_player.mpd:
|
||||
friendly_name: Mopidy Media Player
|
||||
hidden: false
|
||||
media_player.gstreamer:
|
||||
friendly_name: Gstreamer Media Player
|
||||
hidden: false
|
||||
media_player.attic_tv:
|
||||
friendly_name: Chromecast Media Player
|
||||
hidden: false
|
||||
|
||||
binary_sensor.sharp_tv:
|
||||
<<: *not_exposed
|
||||
hidden: true
|
||||
binary_sensor.sharp_tv_command_state:
|
||||
<<: *not_exposed
|
||||
hidden: true
|
||||
|
||||
media_player:
|
||||
- platform: snapcast
|
||||
host: !secret snapcast_server_ip
|
||||
- platform: mpd
|
||||
name: mpd
|
||||
host: !secret mopidy_server_ip
|
||||
port: !secret mopidy_server_port
|
||||
|
||||
- platform: denon
|
||||
host: !secret denon_avr_ip_address
|
||||
name: DENON
|
||||
|
||||
|
||||
- platform: denonavr
|
||||
host: !secret denon_avr_ip_address
|
||||
name: MY DENON RECEIVER
|
||||
show_all_sources: true
|
||||
timeout: 5
|
||||
|
||||
- platform: plex
|
||||
entity_namespace: 'plex'
|
||||
include_non_clients: true
|
||||
scan_interval: 5
|
||||
use_episode_art: true
|
||||
remove_unavailable_clients: true
|
||||
client_remove_interval: 600
|
||||
|
||||
# If you get errors about GI not found, run the command below to link gsp/gi path to HA for Gstreamer to function properly
|
||||
|
||||
# For python 3.4:
|
||||
# sudo ln -s /usr/lib/python3/dist-packages/gi /srv/homeassistant/lib/python3.6/site-packages
|
||||
|
||||
# If you get GST not found error, run the following command
|
||||
# sudo apt-get install python-gst-1.0 \
|
||||
# gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 \
|
||||
# gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \
|
||||
# gstreamer1.0-tools
|
||||
|
||||
# Steps to set it up:
|
||||
#
|
||||
# 1. Setup venv using correct version of python - in this case, it is python3.6
|
||||
# 2. As homeassistant user, inside the venv, run python3.6 command
|
||||
# $ sudo -u homeassistant -H -s
|
||||
# $ source /srv/homeassistant/bin/activate
|
||||
# $ python3.6
|
||||
# Inside the python CLI, run
|
||||
# >>> import gi
|
||||
# >>> print (gi)
|
||||
# 3. That should print something like
|
||||
# <module 'gi' from '/srv/homeassistant/lib/python3.6/site-packages/gi/__init__.py'>
|
||||
# 4. Map that path to the GI location
|
||||
# $ sudo ln -s /usr/lib/python3/dist-packages/gi /srv/homeassistant/lib/python3.6/site-packages
|
||||
# restart machine
|
||||
|
||||
- platform: gstreamer
|
||||
pipeline: "audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo"
|
||||
|
||||
binary_sensor:
|
||||
- platform: mqtt
|
||||
name: Sharp TV
|
||||
state_topic: '/home/sharptv'
|
||||
payload_on: 'on'
|
||||
payload_off: 'off'
|
||||
value_template: '{{ value }}'
|
||||
|
||||
- platform: mqtt
|
||||
name: Sharp TV Command State
|
||||
state_topic: '/home/sharp_tv_cmd'
|
||||
payload_on: 'on'
|
||||
payload_off: 'off'
|
||||
value_template: '{{ value }}'
|
||||
|
||||
input_select:
|
||||
snapcast_server:
|
||||
name: Snapcast Server
|
||||
options:
|
||||
- Select One
|
||||
- Stop
|
||||
- Start
|
||||
- Restart
|
||||
initial: Select One
|
||||
icon: mdi:music
|
||||
|
||||
shell_command:
|
||||
stop_snapserver: >-
|
||||
sudo systemctl stop snapserver
|
||||
start_snapserver: >-
|
||||
sudo systemctl start snapserver
|
||||
restart_snapserver: >-
|
||||
sudo systemctl restart snapserver
|
||||
|
||||
script:
|
||||
stop_snapcast_server:
|
||||
sequence:
|
||||
- service: shell_command.stop_snapserver
|
||||
start_snapcast_server:
|
||||
sequence:
|
||||
- service: shell_command.start_snapserver
|
||||
restart_snapcast_server:
|
||||
sequence:
|
||||
- service: shell_command.restart_snapserver
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
###############################################################################
|
||||
# Snapcast Server Management
|
||||
###############################################################################
|
||||
- alias: Snapcast Action
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_select.snapcast_server
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_select.snapcast_server.state | lower != "select one" }}'
|
||||
action:
|
||||
- service_template: >-
|
||||
{% if states.input_select.snapcast_server.state | lower == "stop" %}
|
||||
shell_command.stop_snapserver
|
||||
{% elif states.input_select.snapcast_server.state | lower == "start" %}
|
||||
shell_command.start_snapserver
|
||||
{% else %}
|
||||
shell_command.restart_snapserver
|
||||
{% endif %}
|
218
packages/motion_counts.yaml
Executable file
218
packages/motion_counts.yaml
Executable file
@@ -0,0 +1,218 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
input_label.aeotec_zw120_door_window_sensor_gen5_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.back_door_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.basement_door_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.downstairs_multi_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.front_room_multi_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.front_room_window_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.garage_door_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.garage_motion:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.guest_bedroom_multi_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.kitchen_motion_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d00016c2d0e:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d00016db6d2:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d0001a25041:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d0001a662fe:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d00024e57d3:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d00024e57fb:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d00024e842c:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d00024ee084:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d000272bed1:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d000272bf48:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.motion_sensor_158d000272bfd7:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.single_car_garage_door_tilt_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.stairs_motion_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.two_car_garage_door_tilt_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
input_label.upstairs_multi_sensor_sensor:
|
||||
unit_of_measurement: 'count'
|
||||
|
||||
input_label:
|
||||
aeotec_zw120_door_window_sensor_gen5_sensor:
|
||||
name: Front Door
|
||||
icon: mdi:run-fast
|
||||
back_door_sensor_sensor:
|
||||
name: Back Door
|
||||
icon: mdi:run-fast
|
||||
basement_door_sensor_sensor:
|
||||
name: Basement Door
|
||||
icon: mdi:run-fast
|
||||
garage_door_sensor_sensor:
|
||||
name: Garage Door
|
||||
icon: mdi:run-fast
|
||||
|
||||
downstairs_multi_sensor_sensor:
|
||||
name: TV Room Multi Sensor
|
||||
icon: mdi:run-fast
|
||||
front_room_multi_sensor_sensor:
|
||||
name: Front Room Multi Sensor
|
||||
icon: mdi:run-fast
|
||||
front_room_window_sensor_sensor:
|
||||
name: Front Room Sensor
|
||||
icon: mdi:run-fast
|
||||
garage_motion:
|
||||
name: Garage Motion
|
||||
icon: mdi:run-fast
|
||||
guest_bedroom_multi_sensor_sensor:
|
||||
name: Guest Bedroom Motion
|
||||
icon: mdi:run-fast
|
||||
kitchen_motion_sensor_sensor:
|
||||
name: Kitchen Motion
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d00016c2d0e:
|
||||
name: Dining Room Motion (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d00016db6d2:
|
||||
name: Study Room Motion (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d0001a25041:
|
||||
name: Family Room (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d0001a662fe:
|
||||
name: Kitchen (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d00024e57d3:
|
||||
name: Master Bedroom (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d00024e57fb:
|
||||
name: Driveway Motion (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d00024e842c:
|
||||
name: Backyard Motion (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d00024ee084:
|
||||
name: Front Door Motion (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d000272bed1:
|
||||
name: Srinika Bedroom (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d000272bf48:
|
||||
name: Garage Motion (X)
|
||||
icon: mdi:run-fast
|
||||
motion_sensor_158d000272bfd7:
|
||||
name: Office Room Motion (X)
|
||||
icon: mdi:run-fast
|
||||
|
||||
single_car_garage_door_tilt_sensor_sensor:
|
||||
name: Single Car Garage Door
|
||||
icon: mdi:run-fast
|
||||
two_car_garage_door_tilt_sensor_sensor:
|
||||
name: Double Car Garage Door
|
||||
icon: mdi:run-fast
|
||||
stairs_motion_sensor_sensor:
|
||||
name: Stairs Motion
|
||||
icon: mdi:run-fast
|
||||
upstairs_multi_sensor_sensor:
|
||||
name: Upstairs Motion Sensor
|
||||
icon: mdi:run-fast
|
||||
|
||||
automation:
|
||||
- alias: Count Motions
|
||||
trigger:
|
||||
- platform: state
|
||||
to: 'on'
|
||||
entity_id:
|
||||
- binary_sensor.aeotec_zw120_door_window_sensor_gen5_sensor
|
||||
- binary_sensor.back_door_sensor_sensor
|
||||
- binary_sensor.basement_door_sensor_sensor
|
||||
- binary_sensor.downstairs_multi_sensor_sensor
|
||||
- binary_sensor.front_room_multi_sensor_sensor
|
||||
- binary_sensor.front_room_window_sensor_sensor
|
||||
- binary_sensor.garage_door_sensor_sensor
|
||||
- binary_sensor.garage_motion
|
||||
- binary_sensor.guest_bedroom_multi_sensor_sensor
|
||||
- binary_sensor.kitchen_motion_sensor_sensor
|
||||
- binary_sensor.motion_sensor_158d00016c2d0e
|
||||
- binary_sensor.motion_sensor_158d00016db6d2
|
||||
- binary_sensor.motion_sensor_158d0001a25041
|
||||
- binary_sensor.motion_sensor_158d0001a662fe
|
||||
- binary_sensor.motion_sensor_158d00024e57d3
|
||||
- binary_sensor.motion_sensor_158d00024e57fb
|
||||
- binary_sensor.motion_sensor_158d00024e842c
|
||||
- binary_sensor.motion_sensor_158d00024ee084
|
||||
- binary_sensor.motion_sensor_158d000272bed1
|
||||
- binary_sensor.motion_sensor_158d000272bf48
|
||||
- binary_sensor.motion_sensor_158d000272bfd7
|
||||
- binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
- binary_sensor.stairs_motion_sensor_sensor
|
||||
- binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
- binary_sensor.upstairs_multi_sensor_sensor
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: "input_label.{{ trigger.entity_id.split('.')[1] }}"
|
||||
value: >
|
||||
{% set cur_value = states("input_label." ~ trigger.entity_id.split('.')[1] ) | int %}
|
||||
{{ cur_value + 1 }}
|
||||
|
||||
- alias: Reset Motion Counters At Midnight
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "00:00:00"
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
data:
|
||||
value: 0
|
||||
entity_id:
|
||||
- input_label.aeotec_zw120_door_window_sensor_gen5_sensor
|
||||
- input_label.back_door_sensor_sensor
|
||||
- input_label.basement_door_sensor_sensor
|
||||
- input_label.downstairs_multi_sensor_sensor
|
||||
- input_label.front_room_multi_sensor_sensor
|
||||
- input_label.front_room_window_sensor_sensor
|
||||
- input_label.garage_door_sensor_sensor
|
||||
- input_label.garage_motion
|
||||
- input_label.guest_bedroom_multi_sensor_sensor
|
||||
- input_label.kitchen_motion_sensor_sensor
|
||||
- input_label.motion_sensor_158d00016c2d0e
|
||||
- input_label.motion_sensor_158d00016db6d2
|
||||
- input_label.motion_sensor_158d0001a25041
|
||||
- input_label.motion_sensor_158d0001a662fe
|
||||
- input_label.motion_sensor_158d00024e57d3
|
||||
- input_label.motion_sensor_158d00024e57fb
|
||||
- input_label.motion_sensor_158d00024e842c
|
||||
- input_label.motion_sensor_158d00024ee084
|
||||
- input_label.motion_sensor_158d000272bed1
|
||||
- input_label.motion_sensor_158d000272bf48
|
||||
- input_label.motion_sensor_158d000272bfd7
|
||||
- input_label.single_car_garage_door_tilt_sensor_sensor
|
||||
- input_label.stairs_motion_sensor_sensor
|
||||
- input_label.two_car_garage_door_tilt_sensor_sensor
|
||||
- input_label.upstairs_multi_sensor_sensor
|
||||
|
||||
# {% for x in states.binary_sensor if 'camera' not in x.entity_id and
|
||||
# 'cube' not in x.entity_id and
|
||||
# 'tesla' not in x.entity_id and
|
||||
# 'drone' not in x.entity_id and
|
||||
# 'audio' not in x.entity_id and
|
||||
# 'protection' not in x.entity_id and
|
||||
# 'tv' not in x.entity_id and
|
||||
# 'workday' not in x.entity_id and
|
||||
# 'home_away' not in x.entity_id and
|
||||
# 'dining_room' not in x.entity_id %}
|
||||
# {{ x.entity_id }}
|
||||
# {%- endfor %}
|
343
packages/motion_timers.yaml
Executable file
343
packages/motion_timers.yaml
Executable file
@@ -0,0 +1,343 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 11/19/2017
|
||||
# @package : Timers and Lights/Switches
|
||||
# @description : All lights and switches are now timer enabled
|
||||
# and the timer automatically extends when there is
|
||||
# motion. When timer elapses, it turns off lights.
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
timer.timer_kitchen:
|
||||
hidden: true
|
||||
timer.timer_familyroom:
|
||||
hidden: true
|
||||
timer.timer_frontroom:
|
||||
hidden: true
|
||||
timer.timer_garage:
|
||||
hidden: true
|
||||
timer.timer_diningroom:
|
||||
hidden: true
|
||||
timer.timer_masterbedroom:
|
||||
hidden: true
|
||||
timer.timer_officeroom:
|
||||
hidden: true
|
||||
|
||||
timer:
|
||||
timer_kitchen:
|
||||
duration: '00:10:00'
|
||||
timer_familyroom:
|
||||
duration: '00:05:00'
|
||||
timer_frontroom:
|
||||
duration: '00:05:00'
|
||||
timer_garage:
|
||||
duration: '00:05:00'
|
||||
timer_masterbedroom:
|
||||
duration: '00:05:00'
|
||||
timer_officeroom:
|
||||
duration: '00:05:00'
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# Office Room:
|
||||
# Motion Detected - Turn ON the light and extend timer
|
||||
###############################################################################
|
||||
- alias: Officeroom Motion & Timer
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.motion_sensor_158d000272bfd7
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_officeroom
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.office_room
|
||||
- condition: template
|
||||
value_template: '{{ states.sun.sun.state == "below_horizon" }}'
|
||||
- service: homeassistant.turn_on
|
||||
entity_id: switch.zwave_smart_switch_switch
|
||||
|
||||
- alias: Officeroom Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: timer.timer_officeroom
|
||||
from: 'active'
|
||||
to: 'idle'
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.office_room
|
||||
- service: homeassistant.turn_off
|
||||
entity_id: switch.zwave_smart_switch_switch
|
||||
|
||||
# Srinika's Bedroom:
|
||||
# Motion Detected - Turn ON the bedroom light and extend timer
|
||||
###############################################################################
|
||||
# - alias: Srinika Bedroom Motion & Timer
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: binary_sensor.motion_sensor_158d000272bed1
|
||||
# from: 'off'
|
||||
# to: 'on'
|
||||
# action:
|
||||
# - service: timer.start
|
||||
# entity_id: timer.timer_srinika_bedroom
|
||||
# - service: switch.turn_on
|
||||
# entity_id: switch.switch.guest_bedroom
|
||||
# - condition: template
|
||||
# value_template: '{{ states.sun.sun.state == "below_horizon" }}'
|
||||
|
||||
# - alias: Srinika Bedroom Timer Elapsed
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: timer.timer_srinika_bedroom
|
||||
# from: 'active'
|
||||
# to: 'idle'
|
||||
# action:
|
||||
# - service: switch.turn_off
|
||||
# entity_id: switch.guest_bedroom
|
||||
|
||||
# Front Room:
|
||||
# Motion Detected - Turn ON the light and extend timer
|
||||
###############################################################################
|
||||
- alias: Frontroom Motion & Timer
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.motion_sensor_158d00016db6d2
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_frontroom
|
||||
- condition: template
|
||||
value_template: '{{ states.sun.sun.state == "below_horizon" }}'
|
||||
- service: homeassistant.turn_on
|
||||
entity_id: switch.zwave_smart_switch_switch
|
||||
|
||||
# Front Room:
|
||||
# Timer Elapsed - Turn OFF lights
|
||||
###############################################################################
|
||||
- alias: Frontroom Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: timer.timer_frontroom
|
||||
from: 'active'
|
||||
to: 'idle'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.working_in_office_room.state == "off" }}'
|
||||
action:
|
||||
- service: homeassistant.turn_off
|
||||
entity_id: switch.rf_switch_four
|
||||
|
||||
# Kitchen:
|
||||
# Motion Detected - Turn ON the light and extend timer
|
||||
###############################################################################
|
||||
- alias: Kitchen Motion & Timer
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.motion_sensor_158d0001a662fe
|
||||
- binary_sensor.kitchen_motion_sensor_sensor
|
||||
- binary_sensor.basement_door_sensor_sensor
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'below_horizon'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.kitchen
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_kitchen
|
||||
|
||||
# Kitchen:
|
||||
# Timer Elapsed - Turn OFF lights
|
||||
###############################################################################
|
||||
- alias: Kitchen Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.timer_kitchen
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'below_horizon'
|
||||
action:
|
||||
- service_template: >
|
||||
{% if now().hour|int >= states.sensor.bedtime_hour.state|int and now().minute|int >= states.sensor.bedtime_minute.state|int %}
|
||||
switch.turn_off
|
||||
{% else %}
|
||||
switch.turn_on
|
||||
{% endif %}
|
||||
entity_id: switch.kitchen
|
||||
|
||||
# Family Room:
|
||||
# Motion Detected - When TV is OFF, turn ON the light 100% and extend timer
|
||||
###############################################################################
|
||||
- alias: Family Room Motion & Timer
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.tv_multi_sensor_sensor
|
||||
- binary_sensor.motion_sensor_158d0001a25041
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'below_horizon'
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.movie_time') != 'on' }}"
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id: light.family_room
|
||||
data_template:
|
||||
brightness: >
|
||||
{% if states.binary_sensor.sharp_tv.state == "on" %}
|
||||
25
|
||||
{% else %}
|
||||
254
|
||||
{% endif %}
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_familyroom
|
||||
|
||||
# Family Room:
|
||||
# Timer Elapsed - Turn OFF lights
|
||||
###############################################################################
|
||||
- alias: Family Room Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: timer.timer_familyroom
|
||||
from: 'active'
|
||||
to: 'idle'
|
||||
action:
|
||||
- service: light.turn_off
|
||||
entity_id: light.family_room
|
||||
- delay: '00:00:05'
|
||||
- service: light.turn_off
|
||||
entity_id: light.family_room
|
||||
|
||||
# Master Bedroom:
|
||||
# Motion Detected - Turn ON the lights and extend timer
|
||||
###############################################################################
|
||||
- alias: Master Bedroom Motion & Timer
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.upstairs_multi_sensor_sensor
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'below_horizon'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.master_bedroom_1
|
||||
rgb_color: [224,175,102]
|
||||
brightness: 10
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.master_bedroom_2
|
||||
rgb_color: [224,175,102]
|
||||
brightness: 10
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_masterbedroom
|
||||
|
||||
# Master Bedroom:
|
||||
# Timer Elapsed - Turn OFF lights
|
||||
###############################################################################
|
||||
- alias: Master Bedroom Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: timer.timer_masterbedroom
|
||||
from: 'active'
|
||||
to: 'idle'
|
||||
action:
|
||||
- service: light.turn_off
|
||||
entity_id: light.master_bedroom_1
|
||||
- service: light.turn_off
|
||||
entity_id: light.master_bedroom_2
|
||||
- delay: '00:00:05'
|
||||
- service: light.turn_off
|
||||
entity_id: light.master_bedroom
|
||||
|
||||
# Garage:
|
||||
# Motion Detected - Turn ON the light and extend timer
|
||||
#
|
||||
# Added a condition - if the lights were just turn off in the last 30 seconds,
|
||||
# do not turn ON the lights again
|
||||
###############################################################################
|
||||
- alias: Garage Motion & Timer
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.garage_motion
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.working_in_garage.state | lower == "on" }}'
|
||||
- condition: template
|
||||
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.switch.garage.last_updated)) | int > 30 }}'
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.garage
|
||||
|
||||
# Start the timer when the lights are ON
|
||||
###############################################################################
|
||||
- alias: Garage Timer Start When Garage Lights ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.garage
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.timer_garage
|
||||
|
||||
# Garage:
|
||||
# Timer Elapsed - Turn OFF lights, when "I am not working"
|
||||
###############################################################################
|
||||
- alias: Garage Timer Elapsed
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: timer.timer_garage
|
||||
from: 'active'
|
||||
to: 'idle'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.working_in_garage
|
||||
state: 'off'
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.garage
|
87
packages/nest_thermostat.yaml
Executable file
87
packages/nest_thermostat.yaml
Executable file
@@ -0,0 +1,87 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
binary_sensor.dining_room_thermostat_fan:
|
||||
friendly_name: Thermostat Fan
|
||||
binary_sensor.dining_room_thermostat_has_leaf:
|
||||
friendly_name: Thermostat has Leaf
|
||||
binary_sensor.dining_room_thermostat_is_locked:
|
||||
friendly_name: Thermostat is Locked
|
||||
binary_sensor.dining_room_thermostat_is_using_emergency_heat:
|
||||
friendly_name: Thermostart Emergency Heat
|
||||
binary_sensor.dining_room_thermostat_online:
|
||||
friendly_name: Thermostat Online
|
||||
|
||||
sensor.dining_room_thermostat_humidity:
|
||||
friendly_name: Thermostat Humidity
|
||||
sensor.dining_room_thermostat_hvac_state:
|
||||
friendly_name: Thermostat HVAC State
|
||||
sensor.dining_room_thermostat_operation_mode:
|
||||
friendly_name: Thermostat Operation Mode
|
||||
sensor.dining_room_thermostat_target:
|
||||
friendly_name: Thermostat Target
|
||||
sensor.dining_room_thermostat_temperature:
|
||||
friendly_name: Thermostat Temperature
|
||||
|
||||
nest:
|
||||
client_id: !secret nest_client_id
|
||||
client_secret: !secret nest_client_secret
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
###############################################################################
|
||||
# Turn OFF AC after 3 hours of cooling
|
||||
# Where we live, 3 hours is plenty to cool the house down!
|
||||
###############################################################################
|
||||
- alias: Turn Off AC After 3 Hours of Cooling
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: climate.dining_room
|
||||
to: 'cool'
|
||||
for: '03:00:00'
|
||||
action:
|
||||
- service: climate.set_away_mode
|
||||
data:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: 'true'
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Air Condition has been ON for 3 hours.
|
||||
Turning it Off to save power."
|
||||
|
||||
###############################################################################
|
||||
# Nest Thermostat automatically changes based on activity at home.
|
||||
# This automation is to keep an eye on what's going on with Nest
|
||||
###############################################################################
|
||||
- alias: Notify Thermostat State Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.dining_room_thermostat_operation_mode
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Nest Thermostat changed from '{{ trigger.from_state.state }}' to '{{ trigger.to_state.state }}'."
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Your home's thermostat is now changed to '{{ trigger.to_state.state }}' mode."
|
||||
|
||||
###############################################################################
|
||||
# A script that toggles Nest Thermostat between eco/away & non-eco/away modes
|
||||
###############################################################################
|
||||
script:
|
||||
toggle_climate:
|
||||
sequence:
|
||||
- service: climate.set_away_mode
|
||||
data_template:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: "{{ false if state_attr('climate.dining_room', 'away_mode') == 'on' else true }}"
|
234
packages/notify.yaml
Executable file
234
packages/notify.yaml
Executable file
@@ -0,0 +1,234 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Scripts
|
||||
# @description : Nothing but Notification Stuff!
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
group.tts_announcements:
|
||||
order: 52
|
||||
|
||||
# Script Stuff
|
||||
script.home_status:
|
||||
friendly_name: Home Status (Hourly Report)
|
||||
script.home_mode_away:
|
||||
friendly_name: Set Home Mode to AWAY
|
||||
script.good_night_tts:
|
||||
friendly_name: Good Night TTS Report
|
||||
|
||||
script.voice_notify:
|
||||
hidden: true
|
||||
script.voice_greeting:
|
||||
hidden: true
|
||||
script.ifttt_leeo_color_change:
|
||||
hidden: true
|
||||
script.ifttt_notify:
|
||||
hidden: true
|
||||
script.notify_me:
|
||||
hidden: true
|
||||
|
||||
ifttt:
|
||||
key: !secret ifttt_key
|
||||
|
||||
notify:
|
||||
- name: ios_devices
|
||||
platform: group
|
||||
services:
|
||||
- service: ios_ipad
|
||||
- service: ios_suresh
|
||||
- service: ios_mallika
|
||||
- service: ios_srinika
|
||||
- service: ios_hasika
|
||||
|
||||
# make sure you generate app password for your email if you have 2FA enabled!
|
||||
- name: notify_smtp
|
||||
platform: smtp
|
||||
server: smtp.gmail.com
|
||||
port: 587
|
||||
timeout: 15
|
||||
username: !secret smtp_username
|
||||
password: !secret smtp_password
|
||||
sender: !secret smtp_sender
|
||||
recipient: !secret smtp_recipient
|
||||
|
||||
- name: notify_aws_sns
|
||||
platform: aws_sns
|
||||
aws_access_key_id: !secret aws_access_key_id
|
||||
aws_secret_access_key: !secret aws_secret_access_key
|
||||
region_name: 'us-east-1'
|
||||
|
||||
- name: file_notify
|
||||
platform: file
|
||||
filename: debug.log
|
||||
|
||||
tts:
|
||||
- platform: amazon_polly
|
||||
aws_access_key_id: !secret aws_access_key_id
|
||||
aws_secret_access_key: !secret aws_secret_access_key
|
||||
region_name: 'us-east-1'
|
||||
text_type: ssml
|
||||
voice: Joanna
|
||||
|
||||
script:
|
||||
|
||||
###############################################################################
|
||||
# Notify Related Scripts
|
||||
###############################################################################
|
||||
ifttt_notify:
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: '{{ message | trim != "" }}'
|
||||
- service: ifttt.trigger
|
||||
data_template:
|
||||
event: "Smart_Home"
|
||||
value1: "{{ message }}"
|
||||
value2: ""
|
||||
|
||||
ifttt_leeo_color_change:
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: '{{ value1 | trim != "" }}'
|
||||
- service: ifttt.trigger
|
||||
data_template:
|
||||
event: "LEEO_COLOR_CHANGE"
|
||||
value1: '{{ value1 }}'
|
||||
|
||||
notify_me:
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.text_alerts
|
||||
state: 'on'
|
||||
- condition: template
|
||||
value_template: '{{ message | trim != "" }}'
|
||||
- service: script.ifttt_notify
|
||||
data_template:
|
||||
message: "{{ message }}"
|
||||
|
||||
good_night_tts:
|
||||
sequence:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: !include ../templates/goodnight.yaml
|
||||
|
||||
###############################################################################
|
||||
# Voice Notify
|
||||
# Conditions:
|
||||
# => Only Announce when people are home. Except in emergency mode!
|
||||
# => Only Announce when Music is NOT being played
|
||||
###############################################################################
|
||||
voice_notify:
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.voice_notifications.state == "on" }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.do_not_disturb.state | lower == "off" }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.media_player.gstreamer.state == "idle" }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.media_player.mpd.state != "playing" }}'
|
||||
- condition: template
|
||||
value_template: '{{ message | trim != "" }}'
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if states.input_boolean.emergency_mode.state == "on" %}
|
||||
true
|
||||
{% else %}
|
||||
{{ states.group.all_devices.state == "home" }}
|
||||
{% endif %}
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% if only_at_night | default('no', true ) == "yes" %}
|
||||
{% if states.sun.sun.state == "above_horizon" %}
|
||||
false
|
||||
{% else %}
|
||||
true
|
||||
{% endif %}
|
||||
{% else %}
|
||||
true
|
||||
{% endif %}
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.gstreamer
|
||||
data_template:
|
||||
volume_level: >
|
||||
{% if states.input_boolean.emergency_mode.state == "on" %}
|
||||
{{ states.input_number.tts_volume_level_alert.state }}
|
||||
{% else %}
|
||||
{% if now().hour | int < 12 and now().hour | int > 6 %}
|
||||
{{ states.input_number.tts_volume_level_morning.state }}
|
||||
{% elif now().hour|int > 12 and now().hour|int < 20 %}
|
||||
{{ states.input_number.tts_volume_level_afternoon.state }}
|
||||
{% else %}
|
||||
{{ states.input_number.tts_volume_level_evening.state }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
- service: tts.amazon_polly_say
|
||||
data_template:
|
||||
entity_id: media_player.gstreamer
|
||||
cache: true
|
||||
message: >
|
||||
{% set msg = "" %}
|
||||
{% macro getGreeting() %}
|
||||
{% if greeting | default('yes', true ) == "yes" %}
|
||||
{% if now().hour|int < 12 %}
|
||||
Good morning.
|
||||
{% elif now().hour|int < 18 %}
|
||||
Good afternoon.
|
||||
{% else %}
|
||||
Good evening.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{%- macro getEndGreeting() -%}
|
||||
{%- if greeting |default('yes', true ) == "yes" -%}
|
||||
Thank you!
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
{% set msg = msg + "<speak> " %}
|
||||
{% set msg = msg + getGreeting() %}
|
||||
{% set msg = msg + ". " + message %}
|
||||
{% set msg = msg.replace(".", " <break time='0.5s'/> ") %}
|
||||
{% set msg = msg + " " + getEndGreeting() %}
|
||||
{% set msg = msg + " </speak>" %}
|
||||
{{ msg }}
|
||||
|
||||
###############################################################################
|
||||
# Greeting
|
||||
###############################################################################
|
||||
voice_greeting:
|
||||
sequence:
|
||||
- service: tts.amazon_polly_say
|
||||
data_template:
|
||||
entity_id: media_player.gstreamer
|
||||
cache: true
|
||||
message: >
|
||||
{% set msg = "" %}
|
||||
{% macro getGreeting() %}
|
||||
{% if greeting | default('yes', true ) == "yes" %}
|
||||
{% if now().hour|int < 12 %}
|
||||
Good morning.
|
||||
{% elif now().hour|int < 18 %}
|
||||
Good afternoon.
|
||||
{% else %}
|
||||
Good evening.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% set msg = msg + "<speak> " %}
|
||||
{% set msg = msg + " " + getGreeting() %}
|
||||
{% set msg = msg.replace(".", " <break time='0.5s'/> ") %}
|
||||
{% set msg = msg + " </speak>" %}
|
||||
{{ msg }}
|
||||
|
||||
###############################################################################
|
||||
# Status around the house
|
||||
###############################################################################
|
||||
home_status:
|
||||
sequence:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: !include ../templates/home_status.yaml
|
222
packages/paloalto.yaml
Executable file
222
packages/paloalto.yaml
Executable file
@@ -0,0 +1,222 @@
|
||||
# ###############################################################################
|
||||
# # AUTHOR : Suresh Kalavala
|
||||
# # DATE : 03/04/2018
|
||||
# # PACKAGE : PALO ALTO APPLANCE/DEVICE SENSOR
|
||||
# # Description : Package to monitor PaloAlto device, logged-in users, vpn users
|
||||
# # and other system information
|
||||
# ###############################################################################
|
||||
# homeassistant:
|
||||
# customize:
|
||||
|
||||
# # Sensors from custom component
|
||||
# sensor.paloalto_host_name:
|
||||
# friendly_name: Palo Alto Host Name
|
||||
# sensor.paloalto_operation_mode:
|
||||
# friendly_name: Device Operation Mode
|
||||
# sensor.paloalto_serial_number:
|
||||
# friendly_name: Device Serial Number
|
||||
# sensor.paloalto_global_protect_user_count:
|
||||
# friendly_name: VPN Loggedin User Count
|
||||
# sensor.paloalto_global_protect_users:
|
||||
# friendly_name: VPN Loggedin Users
|
||||
# sensor.paloalto_global_protect_version:
|
||||
# friendly_name: VPN Software Version
|
||||
# sensor.paloalto_logdb_version:
|
||||
# friendly_name: Log Db Version
|
||||
# sensor.paloalto_software_version:
|
||||
# friendly_name: Device Software Version
|
||||
# sensor.paloalto_core_temperature:
|
||||
# friendly_name: Core Temperature
|
||||
# sensor.paloalto_system_temperature:
|
||||
# friendly_name: System Temperature
|
||||
# sensor.paloalto_up_time:
|
||||
# friendly_name: Up Time
|
||||
|
||||
# # Scripts
|
||||
# script.paloalto_clear_traffic_logs:
|
||||
# friendly_name: Clear Traffic Logs
|
||||
# script.paloalto_clear_threat_logs:
|
||||
# friendly_name: Clear Threat Logs
|
||||
# script.paloalto_clear_alarm_logs:
|
||||
# friendly_name: Clear Alarm Logs
|
||||
# script.paloalto_clear_authentication_logs:
|
||||
# friendly_name: Clear Authentication Logs
|
||||
# script.paloalto_clear_config_logs:
|
||||
# friendly_name: Clear Configuration Logs
|
||||
# script.paloalto_clear_system_logs:
|
||||
# friendly_name: Clear System Logs
|
||||
# script.paloalto_shutdown:
|
||||
# friendly_name: Shutdown Palo Alto Device
|
||||
# icon: mdi:power
|
||||
# script.paloalto_restart:
|
||||
# friendly_name: Restart Palo Alto Device
|
||||
# icon: mdi:restart
|
||||
|
||||
# sensor:
|
||||
# - platform: paloalto
|
||||
# api_key: !secret paloalto_authkey
|
||||
# ip_address: !secret paloalto_hostip
|
||||
# ssl: True
|
||||
# verify_ssl: False
|
||||
# scan_interval: 60
|
||||
# monitored_conditions:
|
||||
# - host_name
|
||||
# - up_time
|
||||
# - serial_no
|
||||
# - sw_version
|
||||
# - gp_version
|
||||
# - logdb_version
|
||||
# - operation_mode
|
||||
# - core_temp
|
||||
# - sys_temp
|
||||
# - gp_users
|
||||
# - gp_user_count
|
||||
# - loggedin_user_count
|
||||
# - loggedin_users
|
||||
|
||||
|
||||
# #
|
||||
# # All the URLs below use the following format
|
||||
# # For ex: paloalto_clear_traffic_logs: "curl -k 'https://192.xxx.xxx.xxx/api/?type=op&cmd=<clear><log><traffic></traffic></log></clear>&key=YOUR_API_KEY'"
|
||||
# # Check out secrets.example file for additional details about the commands
|
||||
# # https://github.com/skalavala/smarthome/blob/master/secrets.example
|
||||
# #
|
||||
# shell_command:
|
||||
# paloalto_clear_traffic_logs: !secret paloalto_clear_traffic_logs
|
||||
# paloalto_clear_threat_logs: !secret paloalto_clear_threat_logs
|
||||
# paloalto_clear_alarm_logs: !secret paloalto_clear_alarm_logs
|
||||
# paloalto_clear_authentication_logs: !secret paloalto_clear_authentication_logs
|
||||
# paloalto_clear_config_logs: !secret paloalto_clear_config_logs
|
||||
# paloalto_clear_system_logs: !secret paloalto_clear_system_logs
|
||||
# paloalto_shutdown: !secret paloalto_shutdown
|
||||
# paloalto_restart: !secret paloalto_restart
|
||||
|
||||
# script:
|
||||
# paloalto_clear_traffic_logs:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_clear_traffic_logs
|
||||
# paloalto_clear_threat_logs:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_clear_threat_logs
|
||||
# paloalto_clear_alarm_logs:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_clear_alarm_logs
|
||||
# paloalto_clear_authentication_logs:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_clear_authentication_logs
|
||||
# paloalto_clear_config_logs:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_clear_config_logs
|
||||
# paloalto_clear_system_logs:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_clear_system_logs
|
||||
# paloalto_shutdown:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_shutdown
|
||||
# paloalto_restart:
|
||||
# sequence:
|
||||
# - service: shell_command.paloalto_restart
|
||||
|
||||
# automation:
|
||||
# #
|
||||
# # Alerts me when someone logs into my VPN network
|
||||
# # This automation compares before and after state changes
|
||||
# # and alerts when someone logged in/out of VPN
|
||||
# #
|
||||
# - alias: Alert When Someone Logged into VPN
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: sensor.paloalto_global_protect_users
|
||||
# condition:
|
||||
# - condition: template
|
||||
# value_template: '{{ trigger.from_state.state | lower != trigger.to_state.state | lower }}'
|
||||
# action:
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: >-
|
||||
# {% set before = trigger.from_state.state %}
|
||||
# {% set after = trigger.to_state.state %}
|
||||
# {% macro loggedIn(beforeList, afterList) %}
|
||||
# {%- for user in afterList if user != 'None' and user not in beforeList%}
|
||||
# {%- if loop.first %}{% elif loop.last %} and{% else %},{% endif -%}
|
||||
# {{- user }}
|
||||
# {%- endfor %}
|
||||
# {%- endmacro %}
|
||||
# {% macro loggedOut(beforeList, afterList) %}
|
||||
# {%- for user in beforeList if user != 'None' and user not in afterList %}
|
||||
# {%- if loop.first %}{% elif loop.last %} and{% else %},{% endif -%}
|
||||
# {{- user }}
|
||||
# {%- endfor %}
|
||||
# {%- endmacro %}
|
||||
# {%- macro checkUsers(beforeList, afterList) -%}
|
||||
# {%- set loggedInUsers = loggedIn(beforeList, afterList) -%}
|
||||
# {%- set loggedOutUsers = loggedOut(beforeList, afterList) -%}
|
||||
# {%- if loggedInUsers | trim != "" -%}
|
||||
# Alert! {{- loggedInUsers | title }} just logged into your Web VPN.
|
||||
# {%- endif -%}
|
||||
# {%- if loggedOutUsers | trim != "" %}
|
||||
# {{- loggedOutUsers |title }} just logged out of your Web VPN.
|
||||
# {% endif %}
|
||||
# {%- endmacro -%}
|
||||
# {{ checkUsers(before.split(','), after.split(',')) }}
|
||||
|
||||
# #
|
||||
# # Alerts me when someone logs into my firewall.
|
||||
# # This automation compares before and after state changes
|
||||
# # and alerts when someone logged in/out of Firewall
|
||||
# #
|
||||
# - alias: Alert When Someone Logged into Firewall
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: sensor.paloalto_loggedin_users
|
||||
# condition:
|
||||
# - condition: template
|
||||
# value_template: '{{ trigger.from_state.state | lower != trigger.to_state.state | lower }}'
|
||||
# action:
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: >-
|
||||
# {% set before = trigger.from_state.state %}
|
||||
# {% set after = trigger.to_state.state %}
|
||||
# {% macro loggedIn(beforeList, afterList) %}
|
||||
# {%- for user in afterList if user != 'None' and user not in beforeList%}
|
||||
# {%- if loop.first %}{% elif loop.last %} and{% else %},{% endif -%}
|
||||
# {{- user }}
|
||||
# {%- endfor %}
|
||||
# {%- endmacro %}
|
||||
# {% macro loggedOut(beforeList, afterList) %}
|
||||
# {%- for user in beforeList if user != 'None' and user not in afterList %}
|
||||
# {%- if loop.first %}{% elif loop.last %} and{% else %},{% endif -%}
|
||||
# {{- user }}
|
||||
# {%- endfor %}
|
||||
# {%- endmacro %}
|
||||
# {%- macro checkUsers(beforeList, afterList) -%}
|
||||
# {%- set loggedInUsers = loggedIn(beforeList, afterList) -%}
|
||||
# {%- set loggedOutUsers = loggedOut(beforeList, afterList) -%}
|
||||
# {%- if loggedInUsers | trim != "" -%}
|
||||
# Alert! {{- loggedInUsers | title }} just logged into your Palo Alto Firewall.
|
||||
# {%- endif -%}
|
||||
# {%- if loggedOutUsers | trim != "" %}
|
||||
# {{- loggedOutUsers |title }} just logged out of your Palo Alto Firewall.
|
||||
# {% endif %}
|
||||
# {%- endmacro -%}
|
||||
# {{ checkUsers(before.split(','), after.split(',')) }}
|
||||
|
||||
# #
|
||||
# # Palo Alto PA-200 device sucks ass in terms of its disk space!
|
||||
# # A work around would be to clear traffic logs periodically
|
||||
# # This automation runs every hour and clears traffic log/log files
|
||||
# #
|
||||
# - alias: Clear Traffic Logs
|
||||
# initial_state: True
|
||||
# hide_entity: True
|
||||
# trigger:
|
||||
# - platform: time_pattern
|
||||
# hours: '/1'
|
||||
# minutes: 00
|
||||
# action:
|
||||
# - service: script.paloalto_clear_traffic_logs
|
554
packages/pi_admin.yaml
Executable file
554
packages/pi_admin.yaml
Executable file
@@ -0,0 +1,554 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 12/27/2017
|
||||
# @package : Pi Admin Package
|
||||
# @description : Got way too many Raspberry Pi's and this package is to
|
||||
# help me with managing them via Home Assistant.
|
||||
#
|
||||
# How Does It Work?
|
||||
#
|
||||
# Each Raspberry Pi runs a service (a python program) locally that listens for
|
||||
# commands via MQTT on a pre-defined topic. This package publishes commands
|
||||
# to MQTT requesting each Raspberry Pi to respond and or return data.
|
||||
# When the responses are received (on a differet topic), the sensors gets
|
||||
# updated automatically and are displayed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
script.restart_all_raspberrypis:
|
||||
friendly_name: Restart All Raspberry Pis
|
||||
script.restart_all_snapclients:
|
||||
friendly_name: Restart All Snapserver Clients
|
||||
script.shutdown_all_raspberrypis:
|
||||
friendly_name: Shutdown All Raspberry Pis
|
||||
script.query_wifi_info:
|
||||
friendly_name: Query WiFi Info
|
||||
script.query_disk_info:
|
||||
friendly_name: Query Disk Info
|
||||
|
||||
input_select:
|
||||
raspberry_pis:
|
||||
name: All Raspberry Pis
|
||||
options:
|
||||
- Select One
|
||||
- pi_basement
|
||||
- pi_theater
|
||||
- pi_kitchen
|
||||
- pi_familyroom
|
||||
- pi_frontroom
|
||||
- pi_garage
|
||||
- pi_guest1
|
||||
- pi_guest2
|
||||
- pi_masterbedroom
|
||||
initial: Select One
|
||||
icon: mdi:pig
|
||||
|
||||
rpi_commands:
|
||||
name: RPi Commands
|
||||
options:
|
||||
- Select One
|
||||
- Restart Server
|
||||
- Shutdown
|
||||
- Restart Snapcast
|
||||
initial: Select One
|
||||
icon: mdi:pig
|
||||
|
||||
sensor:
|
||||
|
||||
## WiFi Information related sensors
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_basement"
|
||||
name: Basement Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_basement"
|
||||
name: Basement Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_theater"
|
||||
name: Theater Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_theater"
|
||||
name: Theater Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_kitchen"
|
||||
name: Kitchen Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_kitchen"
|
||||
name: Kitchen Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_familyroom"
|
||||
name: Family Room Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_familyroom"
|
||||
name: Family Room Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_frontroom"
|
||||
name: Front Room Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_frontroom"
|
||||
name: Front Room Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_garage"
|
||||
name: Garage Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_garage"
|
||||
name: Garage Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_guest1"
|
||||
name: Guest 1 Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_guest1"
|
||||
name: Guest 1 Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_guest2"
|
||||
name: Guest 2 Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_guest2"
|
||||
name: Guest 2 Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_masterbedroom"
|
||||
name: master Bedroom Pi Signal Level
|
||||
value_template: '{{ value_json["Signal Level"]}}'
|
||||
unit_of_measurement: dBm
|
||||
- platform: mqtt
|
||||
state_topic: "/wifi/pi_masterbedroom"
|
||||
name: Master Bedroom Pi Link Quality
|
||||
value_template: '{{ value_json["Link Quality"]}}'
|
||||
|
||||
## Disk Information related Sensors
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_basement"
|
||||
name: Basement Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_basement"
|
||||
name: Basement Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_theater"
|
||||
name: Theater Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_theater"
|
||||
name: Theater Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_kitchen"
|
||||
name: Kitchen Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_kitchen"
|
||||
name: Kitchen Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_familyroom"
|
||||
name: Family Room Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_familyroom"
|
||||
name: Family Room Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_frontroom"
|
||||
name: Front Room Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_frontroom"
|
||||
name: Front Room Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_garage"
|
||||
name: Garage Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_garage"
|
||||
name: Garage Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_guest1"
|
||||
name: Guest 1 Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_guest1"
|
||||
name: Guest 1 Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_guest2"
|
||||
name: Guest 2 Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_guest2"
|
||||
name: Guest 2 Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_masterbedroom"
|
||||
name: Master Bedroom Pi Available Disk
|
||||
value_template: '{{ value_json["Available"]}}'
|
||||
- platform: mqtt
|
||||
state_topic: "/disk/pi_masterbedroom"
|
||||
name: Master Bedroom Pi Disk Used
|
||||
value_template: '{{ value_json["% Used"]}}'
|
||||
|
||||
script:
|
||||
restart_all_raspberrypis:
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_basement'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_theater'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_kitchen'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_familyroom'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_frontroom'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_garage'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_guest1'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_guest2'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_masterbedroom'
|
||||
payload: CMD_REBOOT_PI
|
||||
retain: false
|
||||
|
||||
restart_all_snapclients:
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_basement'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_theater'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_kitchen'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_familyroom'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_frontroom'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_garage'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_guest1'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_guest2'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_masterbedroom'
|
||||
payload: CMD_RESTART_SNAPCLIENT
|
||||
retain: false
|
||||
|
||||
shutdown_all_raspberrypis:
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_basement'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_theater'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_kitchen'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_familyroom'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_frontroom'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_garage'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_guest1'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_guest2'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: '/server/pi_masterbedroom'
|
||||
payload: CMD_SHUTDOWN_PI
|
||||
retain: false
|
||||
|
||||
# Script to Query Disk Information - Publishes message 'CMD_REPORT_WIFI_DETAILS'
|
||||
# to MQTT, so that the message gets received by individual Raspberry Pi
|
||||
###############################################################################
|
||||
query_wifi_info:
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_basement
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_theater
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_kitchen
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_familyroom
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_frontroom
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_garage
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_guest1
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_guest2
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_masterbedroom
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pizero_green
|
||||
payload: 'CMD_REPORT_WIFI_DETAILS'
|
||||
retain: false
|
||||
|
||||
# Script to Query Disk Information - Publishes message 'CMD_REPORT_DISK_DETAILS'
|
||||
# to MQTT, so that the message gets received by individual Raspberry Pi
|
||||
###############################################################################
|
||||
query_disk_info:
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_basement
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_theater
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_kitchen
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_familyroom
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_frontroom
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_garage
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_guest1
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_guest2
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pi_masterbedroom
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /server/pizero_green
|
||||
payload: 'CMD_REPORT_DISK_DETAILS'
|
||||
retain: false
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# Automations: Various automations to query and issue commands to Raspberry Pis
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
# Queries WiFi Signal Level and Link Quality - it loads during startup, and
|
||||
# updates once every 30 minutes
|
||||
###############################################################################
|
||||
- alias: Query RPi Wifi Data
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: '/30'
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- service: script.query_wifi_info
|
||||
|
||||
# Queries Disk Available and % Used - it loads during startup, and
|
||||
# updates once every 30 minutes
|
||||
###############################################################################
|
||||
- alias: Query RPi Disk Data
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: '/30'
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- service: script.query_disk_info
|
||||
|
||||
# Issues commands to Raspberry Pi via MQTT - On Demand
|
||||
###############################################################################
|
||||
- alias: Raspberry Pi Command
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_select.rpi_commands
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_select.raspberry_pis.state | lower != "select one" }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.input_select.rpi_commands.state | lower != "select one" }}'
|
||||
action:
|
||||
service: mqtt.publish
|
||||
data_template:
|
||||
retain: false
|
||||
topic: "{{ '/server/' ~ states.input_select.raspberry_pis.state }}"
|
||||
payload: >-
|
||||
{% if states.input_select.rpi_commands.state | lower == "restart server" %}
|
||||
CMD_REBOOT_PI
|
||||
{% elif states.input_select.rpi_commands.state | lower == "restart snapcast" %}
|
||||
CMD_RESTART_SNAPCLIENT
|
||||
{% else %}
|
||||
CMD_SHUTDOWN_PI
|
||||
{% endif %}
|
175
packages/qnap.yaml
Executable file
175
packages/qnap.yaml
Executable file
@@ -0,0 +1,175 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 07/16/2017
|
||||
# @package : QNAP
|
||||
# @description : QNAP NAS Package
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
sensor.kalavala_nas_cpu_usage:
|
||||
friendly_name: CPU Usage
|
||||
sensor.kalavala_nas_memory_usage:
|
||||
friendly_name: Memory Usage
|
||||
sensor.kalavala_nas_network_up_eth0:
|
||||
friendly_name: Network Speed
|
||||
sensor.kalavala_nas_network_up_eth1:
|
||||
friendly_name: Network Speed
|
||||
sensor.kalavala_nas_status:
|
||||
friendly_name: NAS Status
|
||||
sensor.kalavala_nas_volume_used_datavol1:
|
||||
friendly_name: Percent Disk Used
|
||||
sensor.kalavala_nas_system_temperature:
|
||||
friendly_name: System Temperature
|
||||
sensor.kalavala_nas_cpu_temperature:
|
||||
friendly_name: CPU Temperature
|
||||
sensor.nas_memory_usage_above_80:
|
||||
friendly_name: Is Memory Above 80 Percent?
|
||||
hidden: true
|
||||
sensor.nas_cpu_usage_above_80:
|
||||
friendly_name: Is CPU Above 80 Percent?
|
||||
hidden: true
|
||||
|
||||
sensor.kalavala_nas_smart_status_drive_0_1:
|
||||
friendly_name: Drive 1 Status
|
||||
sensor.kalavala_nas_smart_status_drive_0_2:
|
||||
friendly_name: Drive 2 Status
|
||||
sensor.kalavala_nas_smart_status_drive_0_3:
|
||||
friendly_name: Drive 3 Status
|
||||
sensor.kalavala_nas_smart_status_drive_0_4:
|
||||
friendly_name: Drive 4 Status
|
||||
|
||||
sensor.kalavala_nas_temperature_drive_0_1:
|
||||
friendly_name: Drive 1 Temperature
|
||||
sensor.kalavala_nas_temperature_drive_0_2:
|
||||
friendly_name: Drive 2 Temperature
|
||||
sensor.kalavala_nas_temperature_drive_0_3:
|
||||
friendly_name: Drive 3 Temperature
|
||||
sensor.kalavala_nas_temperature_drive_0_4:
|
||||
friendly_name: Drive 4 Temperature
|
||||
|
||||
sensor:
|
||||
- platform: qnap
|
||||
host: !secret qnap_hostname
|
||||
username: !secret qnap_username
|
||||
password: !secret qnap_password
|
||||
monitored_conditions:
|
||||
- status
|
||||
- cpu_usage
|
||||
- memory_percent_used
|
||||
- network_tx
|
||||
- volume_percentage_used
|
||||
- system_temp
|
||||
- cpu_temp
|
||||
- drive_smart_status
|
||||
- drive_temp
|
||||
|
||||
# The following sensors are required, as the automations with trigger platform `numeric_state`,
|
||||
# above a certain value using `above: x` AND `for: 00:05:00` combination is not supported.
|
||||
#
|
||||
# Apparently `for:` is ONLY supportd for trigger platform 'state'
|
||||
#
|
||||
# By creating the folowing sensor, we can now have an automation with trigger platform as 'state'
|
||||
# with a combination of `to:` and `for:`
|
||||
#
|
||||
# See the automations 'Notify NAS Memory Usage' and 'Notify NAS CPU Usage' that uses these sensor values
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
nas_memory_usage_above_80:
|
||||
value_template: '{{ states.sensor.kalavala_nas_memory_usage.state | int > 80 }}'
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
nas_cpu_usage_above_80:
|
||||
value_template: '{{ states.sensor.kalavala_nas_cpu_usage.state | int > 80 }}'
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
- alias: Notify NAS Status Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- sensor.kalavala_nas_status
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "NAS Status changed to: {{ trigger.to_state.state| upper }}"
|
||||
|
||||
- alias: Notify NAS Drive Status Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id:
|
||||
- sensor.kalavala_nas_smart_status_drive_01
|
||||
- sensor.kalavala_nas_smart_status_drive_02
|
||||
- sensor.kalavala_nas_smart_status_drive_03
|
||||
- sensor.kalavala_nas_smart_status_drive_04
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "NAS Drive state changed to:
|
||||
{{ trigger.to_state.state| upper }} from
|
||||
'{{ trigger.from_state.state| upper }}'"
|
||||
|
||||
- alias: Notify NAS CPU Temperature
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: numeric_state
|
||||
entity_id: sensor.kalavala_nas_cpu_temperature
|
||||
above: 125
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "NAS CPU temperature is going crazy hot, needs your attention!!!
|
||||
The current cpu temp is: {{ trigger.to_state.state }}"
|
||||
|
||||
- alias: Notify NAS Disk Usage
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: numeric_state
|
||||
entity_id: sensor.kalavala_nas_volume_used_datavol1
|
||||
above: 80
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Attention! NAS disk usage is above 80 percent. Time to clean up?"
|
||||
|
||||
- alias: Notify NAS Memory Usage
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.nas_memory_usage_above_80
|
||||
to: 'True'
|
||||
for: '00:05:00'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "FYI - NAS Memory is above 80 percent for more than 5 minutes."
|
||||
|
||||
- alias: Notify NAS CPU Usage
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.nas_cpu_usage_above_80
|
||||
to: 'True'
|
||||
for: '00:05:00'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "FYI - NAS CPU is above 80 percent for more than 5 minutes."
|
32
packages/quotes.yaml
Executable file
32
packages/quotes.yaml
Executable file
@@ -0,0 +1,32 @@
|
||||
# # ##############################################################################
|
||||
# # @author : Mahasri Kalavala
|
||||
# # @date : 01/05/2018
|
||||
# # @package : Random Quote at Startup
|
||||
# # @description : Daily quotes
|
||||
# # ##############################################################################
|
||||
# homeassistant:
|
||||
# customize:
|
||||
# sensor.quote_of_the_day:
|
||||
# hidden: true
|
||||
|
||||
# sensor:
|
||||
# - platform: rest
|
||||
# name: quote_of_the_day
|
||||
# resource: http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en
|
||||
# value_template: '{{ value_json.quoteText }} - By {{ value_json.quoteAuthor }}'
|
||||
# scan_interval: 86400
|
||||
|
||||
# automation:
|
||||
|
||||
# - alias: Quote At Startup
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: homeassistant
|
||||
# event: start
|
||||
# action:
|
||||
# - delay:
|
||||
# seconds: 15
|
||||
# - service: persistent_notification.create
|
||||
# data:
|
||||
# title: 'Quote:'
|
||||
# message: '{{ states.sensor.quote_of_the_day.state }}'
|
390
packages/recycle_trash.yaml
Executable file
390
packages/recycle_trash.yaml
Executable file
@@ -0,0 +1,390 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Trash & Recycle
|
||||
# @description : Trash & Recycle Pickup Scheduler and Reminder
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
sensor.trash_day:
|
||||
friendly_name: Is it Trash Day today?
|
||||
icon: mdi:delete-variant
|
||||
sensor.recycle_day:
|
||||
friendly_name: Is it Recycle Day today?
|
||||
icon: mdi:recycle
|
||||
sensor.trash_pickup_day:
|
||||
friendly_name: Trash Pickup Day
|
||||
icon: mdi:calendar-today
|
||||
hidden: true
|
||||
sensor.recycle_pickup_day:
|
||||
friendly_name: Recycle Pickup Day
|
||||
icon: mdi:calendar-today
|
||||
hidden: true
|
||||
sensor.recycle_pickup_week:
|
||||
friendly_name: Recycle Pickup Week
|
||||
icon: mdi:calendar-today
|
||||
hidden: true
|
||||
sensor.current_week:
|
||||
friendly_name: Current Week is
|
||||
icon: mdi:calendar-question
|
||||
group.trash_schedule:
|
||||
friendly_name: Trash Schedule
|
||||
icon: mdi:delete-variant
|
||||
group.recycle_schedule:
|
||||
friendly_name: Trash Schedule
|
||||
icon: mdi:recycle
|
||||
|
||||
###############################################################################
|
||||
# UI Elements
|
||||
###############################################################################
|
||||
input_select:
|
||||
trash_pickup_day:
|
||||
name: Current Trash Pickup Day (Evey Week)
|
||||
options:
|
||||
- Monday
|
||||
- Tuesday
|
||||
- Wednesday
|
||||
- Thursday
|
||||
- Friday
|
||||
- Saturday
|
||||
- Sunday
|
||||
- unknown
|
||||
icon: mdi:delete-variant
|
||||
recycle_pickup_day:
|
||||
name: Current Recycle Pickup Day (Every Other Week)
|
||||
options:
|
||||
- Monday
|
||||
- Tuesday
|
||||
- Wednesday
|
||||
- Thursday
|
||||
- Friday
|
||||
- Saturday
|
||||
- Sunday
|
||||
- unknown
|
||||
icon: mdi:recycle
|
||||
recycle_pickup_week:
|
||||
name: Select Recycle Pickup Week based on Current Week above
|
||||
options:
|
||||
- Even Weeks
|
||||
- Odd Weeks
|
||||
- unknown
|
||||
icon: mdi:recycle
|
||||
|
||||
###############################################################################
|
||||
# Sensor Definitions
|
||||
###############################################################################
|
||||
sensor:
|
||||
- platform: time_date
|
||||
display_options:
|
||||
- time
|
||||
- date
|
||||
- date_time
|
||||
- time_date
|
||||
- time_utc
|
||||
|
||||
- platform: mqtt
|
||||
state_topic: "/home/trashpickupday"
|
||||
name: "Trash Pickup Day"
|
||||
value_template: "{{ value }}"
|
||||
qos: 1
|
||||
- platform: mqtt
|
||||
state_topic: "/home/recyclepickupday"
|
||||
name: "Recycle Pickup Day"
|
||||
value_template: "{{ value }}"
|
||||
qos: 1
|
||||
- platform: mqtt
|
||||
state_topic: "/home/recyclepickupweek"
|
||||
name: "Recycle Pickup Week"
|
||||
value_template: "{{ value }}"
|
||||
qos: 1
|
||||
|
||||
###############################################################################
|
||||
# Sensor to hold info about current week is an odd week or an even week of the year
|
||||
###############################################################################
|
||||
- platform: template
|
||||
sensors:
|
||||
current_week:
|
||||
value_template: >-
|
||||
{% set year = states.sensor.date_time.state.split(',')[0].split('-')[0] %}
|
||||
{% set month = states.sensor.date_time.state.split(',')[0].split('-')[1] %}
|
||||
{% set date = states.sensor.date_time.state.split(',')[0].split('-')[2] %}
|
||||
{% set today = strptime(year ~ '-' ~ month ~ '-' ~ date , '%Y-%m-%d') %}
|
||||
{%- if (as_timestamp(today) | timestamp_custom('%U', true) | int ) % 2 == 0 -%}
|
||||
Even Week (Week# {{ as_timestamp(today) | timestamp_custom('%U', true) }})
|
||||
{%- else -%}
|
||||
Odd Week (Week# {{ as_timestamp(today) | timestamp_custom('%U', true) }})
|
||||
{%- endif -%}
|
||||
|
||||
###############################################################################
|
||||
# Trash - Pickup schedule is EVERY week.
|
||||
# Set the day to a day before the actual day leaving time for reminders
|
||||
###############################################################################
|
||||
- platform: template
|
||||
sensors:
|
||||
trash_day:
|
||||
value_template: >-
|
||||
{% set year = states.sensor.date_time.state.split(',')[0].split('-')[0] %}
|
||||
{% set month = states.sensor.date_time.state.split(',')[0].split('-')[1] %}
|
||||
{% set date = states.sensor.date_time.state.split(',')[0].split('-')[2] %}
|
||||
{% set today = strptime(year ~ '-' ~ month ~ '-' ~ date , '%Y-%m-%d') %}
|
||||
{%- set pickupDay = states.sensor.trash_pickup_day.state | lower -%}
|
||||
{%- if as_timestamp(today)| timestamp_custom('%A', true) | lower == pickupDay -%}
|
||||
yes
|
||||
{%- else -%}
|
||||
no
|
||||
{%- endif -%}
|
||||
|
||||
###############################################################################
|
||||
# Recycle - Pickup schedule is every other week.
|
||||
# Set the day to a day before the actual day leaving time for reminders
|
||||
###############################################################################
|
||||
- platform: template
|
||||
sensors:
|
||||
recycle_day:
|
||||
value_template: >-
|
||||
{% set year = states.sensor.date_time.state.split(',')[0].split('-')[0] %}
|
||||
{% set month = states.sensor.date_time.state.split(',')[0].split('-')[1] %}
|
||||
{% set date = states.sensor.date_time.state.split(',')[0].split('-')[2] %}
|
||||
{% set today = strptime(year ~ '-' ~ month ~ '-' ~ date , '%Y-%m-%d') %}
|
||||
{%- set pickupDay = states.sensor.recycle_pickup_day.state | lower -%}
|
||||
{% if states.input_select.recycle_pickup_week.state | lower == "even weeks" %}
|
||||
{%- set evenWeekPickup = "true" %}
|
||||
{% else %}
|
||||
{%- set evenWeekPickup = "false" %}
|
||||
{% endif %}
|
||||
{%- macro day_of_week(timestamp) -%}
|
||||
{{ as_timestamp(timestamp)| timestamp_custom('%A', true) | lower }}
|
||||
{%- endmacro %}
|
||||
{%- macro week_number_of_year() -%}
|
||||
{{ as_timestamp(today) | timestamp_custom('%U', true) | int }}
|
||||
{%- endmacro %}
|
||||
{%- macro is_it_this_week() -%}
|
||||
{%- if as_timestamp(today) | timestamp_custom('%U', true) | int % 2 == 0 -%}
|
||||
{%- if evenWeekPickup == "true" -%}
|
||||
true
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- if evenWeekPickup == "true" -%}
|
||||
false
|
||||
{%- else -%}
|
||||
true
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
{%- macro is_it_today() -%}
|
||||
{%- if is_it_this_week() == "true" -%}
|
||||
{%- if day_of_week(today) | lower == pickupDay -%}
|
||||
yes
|
||||
{%- else -%}
|
||||
no
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
no
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
{{- is_it_today() -}}
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
###############################################################################
|
||||
# The schedule can be changed via UI. The updated schedules are saved in MQTT
|
||||
# The input_selects don't maintain state automatically - hence this code
|
||||
# These automations are hidden - no interaction with user is required.
|
||||
# Save & Restore Functionality
|
||||
###############################################################################
|
||||
- alias: Trash Pickup Day Changed
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_select.trash_pickup_day
|
||||
action:
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: "/home/trashpickupday"
|
||||
retain: true
|
||||
payload: '{{ states.input_select.trash_pickup_day.state }}'
|
||||
|
||||
- alias: Recycle Pickup Day Changed
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_select.recycle_pickup_day
|
||||
action:
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: "/home/recyclepickupday"
|
||||
retain: true
|
||||
payload: '{{ states.input_select.recycle_pickup_day.state }}'
|
||||
|
||||
- alias: Recycle Pickup Week Changed
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_select.recycle_pickup_week
|
||||
action:
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: "/home/recyclepickupweek"
|
||||
retain: true
|
||||
payload: '{{ states.input_select.recycle_pickup_week.state }}'
|
||||
|
||||
- alias: Restore Trash Recycle Settings on Startup
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- delay:
|
||||
minutes: 1
|
||||
- service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.trash_pickup_day
|
||||
option: "{{states.sensor.trash_pickup_day.state}}"
|
||||
- service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.recycle_pickup_day
|
||||
option: "{{states.sensor.recycle_pickup_day.state}}"
|
||||
- service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.recycle_pickup_week
|
||||
option: "{{states.sensor.recycle_pickup_week.state}}"
|
||||
|
||||
###############################################################################
|
||||
# Reminder code - Reminds 5 times every hour starting 4 PM
|
||||
# Conditions: Only notifies when someone is at home
|
||||
###############################################################################
|
||||
- alias: Trash and Recycle Pickup Reminder
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '16:00:00'
|
||||
- platform: time
|
||||
at: '17:00:00'
|
||||
- platform: time
|
||||
at: '18:00:00'
|
||||
- platform: time
|
||||
at: '19:00:00'
|
||||
- platform: time
|
||||
at: '20:00:00'
|
||||
- platform: time
|
||||
at: '21:00:00'
|
||||
condition:
|
||||
condition: and
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.trash_reminders.state == "on" }}'
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.trash_day
|
||||
state: 'yes'
|
||||
- condition: state
|
||||
entity_id: sensor.recycle_day
|
||||
state: 'yes'
|
||||
action:
|
||||
- service: notify.ios_suresh
|
||||
data_template:
|
||||
title: >
|
||||
{% if states.sensor.trash_day.state == "yes" and states.sensor.recycle_day.state == "yes" %}
|
||||
Trash and Recycle Pickup Tomorrow!
|
||||
{% elif states.sensor.trash_day.state == "yes" %}
|
||||
Trash Pickup Tomorrow!
|
||||
{% elif states.sensor.recycle_day.state == "yes" %}
|
||||
Recycle Pickup Tomorrow!
|
||||
{% endif %}
|
||||
message: >
|
||||
{% if states.sensor.trash_day.state == "yes" and states.sensor.recycle_day.state == "yes" %}
|
||||
Please leave Trash AND Recycle bins out tonight!
|
||||
{% elif states.sensor.trash_day.state == "yes" %}
|
||||
Please leave Trash bin outside tonight!
|
||||
{% elif states.sensor.recycle_day.state == "yes" %}
|
||||
Please leave Recycle bin outside tonight!
|
||||
{% endif %}
|
||||
data:
|
||||
push:
|
||||
badge: 0
|
||||
category: "trash_recycle"
|
||||
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{% if states.sensor.trash_day.state == "yes" and states.sensor.recycle_day.state == "yes" %}
|
||||
Tomorrow is the Trash AND Recycle Pickup day!
|
||||
{% elif states.sensor.trash_day.state == "yes" %}
|
||||
Attention!: Tomorrow is the Trash Pickup day. Please don't forget to put the Trash bin outside tonight!
|
||||
{% elif states.sensor.recycle_day.state == "yes" %}
|
||||
Attention!: Tomorrow is the Recycle Pickup day. Please don't forget to put the recycle bin outside tonight!
|
||||
{% endif %}
|
||||
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{% if states.sensor.trash_day.state == "yes" and states.sensor.recycle_day.state == "yes" %}
|
||||
Attention!: Tomorrow is the Trash and Recycle Pickup day.
|
||||
Please don't forget to leave Trash bin and recycle bin outside tonight!
|
||||
{% elif states.sensor.trash_day.state == "yes" %}
|
||||
Attention!: Tomorrow is the Trash Pickup day. Please don't forget to put the Trash bin outside tonight!
|
||||
{% elif states.sensor.recycle_day.state == "yes" %}
|
||||
Attention!: Tomorrow is the Recycle Pickup day. Please don't forget to put the recycle bin outside tonight!
|
||||
{% endif %}
|
||||
|
||||
- alias: Trash and Recycle Bin Left Outside Already
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TRASH_LEFT
|
||||
action:
|
||||
- service: notify.ios_suresh
|
||||
data:
|
||||
message: "Great job, Thank you!"
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.trash_reminders
|
||||
|
||||
- alias: Remind later
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TRASH_REMIND_LATER
|
||||
action:
|
||||
- service: notify.ios_suresh
|
||||
data:
|
||||
message: "Will remind you again in an hour!"
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.trash_reminders
|
||||
|
||||
- alias: Reset Trash Reminders
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '09:00:00'
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.trash_reminders
|
||||
- service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.trash_pickup_day
|
||||
option: "{{states.sensor.trash_pickup_day.state}}"
|
||||
- service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.recycle_pickup_day
|
||||
option: "{{states.sensor.recycle_pickup_day.state}}"
|
||||
- service: input_select.select_option
|
||||
data_template:
|
||||
entity_id: input_select.recycle_pickup_week
|
||||
option: "{{states.sensor.recycle_pickup_week.state}}"
|
189
packages/rfswitches.yaml
Executable file
189
packages/rfswitches.yaml
Executable file
@@ -0,0 +1,189 @@
|
||||
# NOTE: THIS CODE WORKS! I NO LONGER USE RPI FOR MY HA ANYMORE. HENCE THE CODE IS COMMENTED.
|
||||
# PLEASE FEEL FREE TO COPY THE CODE AND UNCOMMENT IT, AND SHOULD WORK OUT OF THE BOX
|
||||
|
||||
# ###############################################################################
|
||||
# # @author : Mahasri Kalavala
|
||||
# # @date : 04/15/2017
|
||||
# # @package : RF Outlets
|
||||
# # @description : Etekcity RF Outlet Sensors and Automations
|
||||
# ###############################################################################
|
||||
# homeassistant:
|
||||
# customize:
|
||||
|
||||
# group.etekcity_rf_switches:
|
||||
# order: 13
|
||||
|
||||
# switch.switch_one:
|
||||
# friendly_name: Switch One
|
||||
# switch.switch_two:
|
||||
# friendly_name: Switch Two
|
||||
# switch.switch_three:
|
||||
# friendly_name: Switch Three
|
||||
# switch.switch_four:
|
||||
# friendly_name: Switch Four
|
||||
# switch.switch_five:
|
||||
# friendly_name: Switch Five
|
||||
|
||||
# sensor.rf_switch_one:
|
||||
# hidden: true
|
||||
# sensor.rf_switch_two:
|
||||
# hidden: true
|
||||
# sensor.rf_switch_three:
|
||||
# hidden: true
|
||||
# sensor.rf_switch_four:
|
||||
# hidden: true
|
||||
# sensor.rf_switch_five:
|
||||
# hidden: true
|
||||
|
||||
# ###############################################################################
|
||||
# # RF Switches
|
||||
# ###############################################################################
|
||||
# switch:
|
||||
# - platform: rpi_rf
|
||||
# gpio: 17
|
||||
# switches:
|
||||
# switch_one:
|
||||
# code_on: !secret rf_switch_1_code_on
|
||||
# code_off: !secret rf_switch_1_code_off
|
||||
# pulselength: !secret rf_switch_1_pulselength
|
||||
# switch_two:
|
||||
# code_on: !secret rf_switch_2_code_on
|
||||
# code_off: !secret rf_switch_2_code_off
|
||||
# pulselength: !secret rf_switch_2_pulselength
|
||||
# switch_three:
|
||||
# code_on: !secret rf_switch_3_code_on
|
||||
# code_off: !secret rf_switch_3_code_off
|
||||
# pulselength: !secret rf_switch_3_pulselength
|
||||
# switch_four:
|
||||
# code_on: !secret rf_switch_4_code_on
|
||||
# code_off: !secret rf_switch_4_code_off
|
||||
# pulselength: !secret rf_switch_4_pulselength
|
||||
# switch_five:
|
||||
# code_on: !secret rf_switch_5_code_on
|
||||
# code_off: !secret rf_switch_5_code_off
|
||||
# pulselength: !secret rf_switch_5_pulselength
|
||||
|
||||
# ###############################################################################
|
||||
# # Sensor Definitions
|
||||
# ###############################################################################
|
||||
# sensor:
|
||||
# - platform: mqtt
|
||||
# state_topic: "/home/rfswitches/switch_one"
|
||||
# name: "RF Switch One"
|
||||
# value_template: "{{ value }}"
|
||||
|
||||
# - platform: mqtt
|
||||
# state_topic: "/home/rfswitches/switch_two"
|
||||
# name: "RF Switch Two"
|
||||
# value_template: "{{ value }}"
|
||||
|
||||
# - platform: mqtt
|
||||
# state_topic: "/home/rfswitches/switch_three"
|
||||
# name: "RF Switch Three"
|
||||
# value_template: "{{ value }}"
|
||||
|
||||
# - platform: mqtt
|
||||
# state_topic: "/home/rfswitches/switch_four"
|
||||
# name: "RF Switch Four"
|
||||
# value_template: "{{ value }}"
|
||||
|
||||
# - platform: mqtt
|
||||
# state_topic: "/home/rfswitches/switch_five"
|
||||
# name: "RF Switch Five"
|
||||
# value_template: "{{ value }}"
|
||||
|
||||
# ###############################################################################
|
||||
# # Automation - Saves Switch State to MQTT
|
||||
# ###############################################################################
|
||||
# automation:
|
||||
|
||||
# # When the switch state changes (programatically or by UI), save the state to MQTT
|
||||
# - alias: Save RF Switch State
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# platform: state
|
||||
# entity_id:
|
||||
# - switch.switch_one
|
||||
# - switch.switch_two
|
||||
# - switch.switch_three
|
||||
# - switch.switch_four
|
||||
# - switch.switch_five
|
||||
# action:
|
||||
# service: mqtt.publish
|
||||
# data_template:
|
||||
# topic: "/home/rfswitches/{{ trigger.entity_id.split('.')[1] }}"
|
||||
# retain: true
|
||||
# qos: 1
|
||||
# payload: '{{ trigger.to_state.state }}'
|
||||
|
||||
# # When the switch state is updated in MQTT (for remove integration), reload the Switch to that state
|
||||
# - alias: Sync MQTT and Switch States
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# platform: state
|
||||
# entity_id:
|
||||
# - sensor.rf_switch_one
|
||||
# - sensor.rf_switch_two
|
||||
# - sensor.rf_switch_three
|
||||
# - sensor.rf_switch_four
|
||||
# - sensor.rf_switch_five
|
||||
# action:
|
||||
# - service_template: >
|
||||
# {%- if trigger.to_state.state | lower == "on" -%}
|
||||
# homeassistant.turn_on
|
||||
# {%- else -%}
|
||||
# homeassistant.turn_off
|
||||
# {%- endif -%}
|
||||
# data_template:
|
||||
# entity_id: 'switch.switch_{{ trigger.entity_id.split(".")[1].split("_")[2]}}'
|
||||
|
||||
# ###############################################################################
|
||||
# # Startup event - restores states of dropdowns, and RF Switches...etc
|
||||
# ###############################################################################
|
||||
# - alias: Restore RF Switch Status on Startup
|
||||
# initial_state: true
|
||||
# hide_entity: true
|
||||
# trigger:
|
||||
# platform: homeassistant
|
||||
# event: start
|
||||
# action:
|
||||
# - delay:
|
||||
# minutes: 1
|
||||
# - service_template: >
|
||||
# {%- if states.sensor.rf_switch_one.state | lower == "on" -%}
|
||||
# homeassistant.turn_on
|
||||
# {%- else -%}
|
||||
# homeassistant.turn_off
|
||||
# {%- endif -%}
|
||||
# entity_id: switch.switch_one
|
||||
# - service_template: >
|
||||
# {%- if states.sensor.rf_switch_two.state | lower == "on" -%}
|
||||
# homeassistant.turn_on
|
||||
# {%- else -%}
|
||||
# homeassistant.turn_off
|
||||
# {%- endif -%}
|
||||
# entity_id: switch.switch_two
|
||||
# - service_template: >
|
||||
# {%- if states.sensor.rf_switch_three.state | lower == "on" -%}
|
||||
# homeassistant.turn_on
|
||||
# {%- else -%}
|
||||
# homeassistant.turn_off
|
||||
# {%- endif -%}
|
||||
# entity_id: switch.switch_three
|
||||
# - service_template: >
|
||||
# {%- if states.sensor.rf_switch_four.state | lower == "on" -%}
|
||||
# homeassistant.turn_on
|
||||
# {%- else -%}
|
||||
# homeassistant.turn_off
|
||||
# {%- endif -%}
|
||||
# entity_id: switch.switch_four
|
||||
# - service_template: >
|
||||
# {%- if states.sensor.rf_switch_five.state | lower == "on" -%}
|
||||
# homeassistant.turn_on
|
||||
# {%- else -%}
|
||||
# homeassistant.turn_off
|
||||
# {%- endif -%}
|
||||
# data:
|
||||
# entity_id: switch.switch_five
|
56
packages/season.yaml
Executable file
56
packages/season.yaml
Executable file
@@ -0,0 +1,56 @@
|
||||
#########################################################################################
|
||||
# @Author: Suresh Kalavala
|
||||
# @Date: 09/13/2017
|
||||
# @Description: This Season sensor is used in the voice notifications to notify of Pollen
|
||||
# levels ONLY during Spring - because I am allergic to spring pollen ;)
|
||||
# There you have it!!!
|
||||
#
|
||||
# Possible Season values are: Spring, Summer, Autumn, and Winter
|
||||
#########################################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'season'
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
sensor.season:
|
||||
<<: *hidden
|
||||
|
||||
sensor:
|
||||
- platform: season
|
||||
type: astronomical
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
- alias: Season Change Notification
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.season
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ trigger.from_state.state | lower != "unknown" }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
Good bye {{ trigger.from_state.state }}, and Say Hello to {{ trigger.to_state.state }}!
|
382
packages/settings.yaml
Executable file
382
packages/settings.yaml
Executable file
@@ -0,0 +1,382 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'settings'
|
||||
|
||||
exposed: &exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: true
|
||||
homebridge_hidden: false
|
||||
|
||||
not_exposed: ¬_exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: false
|
||||
homebridge_hidden: true
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
group.control_panel:
|
||||
<<: *not_exposed
|
||||
|
||||
input_boolean.working_in_garage:
|
||||
<<: *exposed
|
||||
friendly_name: Working in Garage
|
||||
icon: mdi:worker
|
||||
input_boolean.working_in_office_room:
|
||||
<<: *exposed
|
||||
friendly_name: Working in Office Room
|
||||
icon: mdi:worker
|
||||
input_boolean.voice_notifications:
|
||||
<<: *exposed
|
||||
icon: mdi:microphone-off
|
||||
emulated_hue_name: Home Assistant Announcements
|
||||
homebridge_name: Home Assistant Announcements
|
||||
input_boolean.do_not_disturb:
|
||||
<<: *exposed
|
||||
homebridge_name: Do Not Disturb
|
||||
input_boolean.alarm_clock:
|
||||
<<: *exposed
|
||||
homebridge_name: Alarm Clock
|
||||
|
||||
input_datetime.summer_bed_time:
|
||||
icon: mdi:beach
|
||||
input_datetime.summer_wakeup_time:
|
||||
icon: mdi:beach
|
||||
|
||||
input_datetime.autumn_bed_time:
|
||||
icon: mdi:leaf
|
||||
input_datetime.autumn_wakeup_time:
|
||||
icon: mdi:leaf
|
||||
|
||||
input_datetime.winter_bed_time:
|
||||
icon: mdi:snowflake
|
||||
input_datetime.winter_wakeup_time:
|
||||
icon: mdi:snowflake
|
||||
|
||||
input_datetime.spring_bed_time:
|
||||
icon: mdi:tree
|
||||
input_datetime.spring_wakeup_time:
|
||||
icon: mdi:tree
|
||||
|
||||
sensor.wakeup_hour:
|
||||
<<: *hidden
|
||||
sensor.wakeup_minute:
|
||||
<<: *hidden
|
||||
sensor.bedtime_hour:
|
||||
<<: *hidden
|
||||
sensor.bedtime_minute:
|
||||
<<: *hidden
|
||||
input_boolean.dummy:
|
||||
<<: *hidden
|
||||
|
||||
# Input DateTime Options:
|
||||
# I set the minutes to something that is divisible by 5, so that the automations
|
||||
# can check once every 5 minutes without any performance penalty
|
||||
###############################################################################
|
||||
|
||||
input_datetime:
|
||||
summer_bed_time:
|
||||
name: Summer Bed Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '23:00:00'
|
||||
summer_wakeup_time:
|
||||
name: Summer Wakeup Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '06:00:00'
|
||||
|
||||
autumn_bed_time:
|
||||
name: Autumn Bed Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '22:00:00'
|
||||
autumn_wakeup_time:
|
||||
name: Autumn Wakeup Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '05:30:00'
|
||||
|
||||
winter_bed_time:
|
||||
name: Winter Bed Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '22:00:00'
|
||||
winter_wakeup_time:
|
||||
name: Winter Wakeup Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '05:30:00'
|
||||
|
||||
spring_bed_time:
|
||||
name: Spring Bed Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '22:00:00'
|
||||
spring_wakeup_time:
|
||||
name: Spring Wakeup Time
|
||||
has_date: false
|
||||
has_time: true
|
||||
initial: '05:30:00'
|
||||
|
||||
input_number:
|
||||
calendar_remind_before_days:
|
||||
name: Calendar Remind Before Days
|
||||
initial: 2
|
||||
min: 1
|
||||
max: 15
|
||||
step: 1
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
wakeup_hour:
|
||||
friendly_name: Wakeup Hour
|
||||
value_template: >
|
||||
{% if states.sensor.season.state | lower == "summer" %}
|
||||
{{ states.input_datetime.summer_wakeup_time.state.split(':')[0] }}
|
||||
{% elif states.sensor.season.state | lower == "autumn" %}
|
||||
{{ states.input_datetime.autumn_wakeup_time.state.split(':')[0] }}
|
||||
{% elif states.sensor.season.state | lower == "winter" %}
|
||||
{{ states.input_datetime.winter_wakeup_time.state.split(':')[0] }}
|
||||
{% elif states.sensor.season.state | lower == "spring" %}
|
||||
{{ states.input_datetime.spring_wakeup_time.state.split(':')[0] }}
|
||||
{% else %}
|
||||
6
|
||||
{% endif %}
|
||||
wakeup_minute:
|
||||
friendly_name: Wakeup Minute
|
||||
value_template: >
|
||||
{% if states.sensor.season.state | lower == "summer" %}
|
||||
{{ states.input_datetime.summer_wakeup_time.state.split(':')[1] }}
|
||||
{% elif states.sensor.season.state | lower == "autumn" %}
|
||||
{{ states.input_datetime.autumn_wakeup_time.state.split(':')[1] }}
|
||||
{% elif states.sensor.season.state | lower == "winter" %}
|
||||
{{ states.input_datetime.winter_wakeup_time.state.split(':')[1] }}
|
||||
{% elif states.sensor.season.state | lower == "spring" %}
|
||||
{{ states.input_datetime.spring_wakeup_time.state.split(':')[1] }}
|
||||
{% else %}
|
||||
0
|
||||
{% endif %}
|
||||
bedtime_hour:
|
||||
friendly_name: Bedtime Hour
|
||||
value_template: >
|
||||
{% if states.sensor.season.state | lower == "summer" %}
|
||||
{{ states.input_datetime.summer_bed_time.state.split(':')[0] }}
|
||||
{% elif states.sensor.season.state | lower == "autumn" %}
|
||||
{{ states.input_datetime.autumn_bed_time.state.split(':')[0] }}
|
||||
{% elif states.sensor.season.state | lower == "winter" %}
|
||||
{{ states.input_datetime.winter_bed_time.state.split(':')[0] }}
|
||||
{% elif states.sensor.season.state | lower == "spring" %}
|
||||
{{ states.input_datetime.spring_bed_time.state.split(':')[0] }}
|
||||
{% else %}
|
||||
0
|
||||
{% endif %}
|
||||
bedtime_minute:
|
||||
friendly_name: Bedtime Minute
|
||||
value_template: >
|
||||
{% if states.sensor.season.state | lower == "summer" %}
|
||||
{{ states.input_datetime.summer_bed_time.state.split(':')[1] }}
|
||||
{% elif states.sensor.season.state | lower == "autumn" %}
|
||||
{{ states.input_datetime.autumn_bed_time.state.split(':')[1] }}
|
||||
{% elif states.sensor.season.state | lower == "winter" %}
|
||||
{{ states.input_datetime.winter_bed_time.state.split(':')[1] }}
|
||||
{% elif states.sensor.season.state | lower == "spring" %}
|
||||
{{ states.input_datetime.spring_bed_time.state.split(':')[1] }}
|
||||
{% else %}
|
||||
0
|
||||
{% endif %}
|
||||
|
||||
# Input Booleans Options
|
||||
###############################################################################
|
||||
|
||||
input_boolean:
|
||||
voice_notifications:
|
||||
name: Home Assistant Announcements
|
||||
initial: on
|
||||
icon: mdi:volume-off
|
||||
|
||||
do_not_disturb:
|
||||
name: Do Not Disturb
|
||||
initial: off
|
||||
icon: mdi:do-not-disturb
|
||||
|
||||
movie_time:
|
||||
name: 'Movie Time'
|
||||
initial: off
|
||||
icon: mdi:movie-roll
|
||||
|
||||
home_security:
|
||||
name: Home Security System
|
||||
initial: off
|
||||
icon: mdi:verified
|
||||
|
||||
home_assistant_status:
|
||||
name: Home Status
|
||||
initial: off
|
||||
icon: mdi:home-assistant
|
||||
|
||||
working_in_garage:
|
||||
name: Working in Garage
|
||||
initial: off
|
||||
icon: mdi:worker
|
||||
|
||||
working_in_office_room:
|
||||
name: Working in Office Room
|
||||
initial: off
|
||||
icon: mdi:worker
|
||||
|
||||
hourly_report:
|
||||
name: Hourly Report
|
||||
initial: on
|
||||
icon: mdi:file-chart
|
||||
|
||||
nightly_report:
|
||||
name: Nightly Report
|
||||
initial: on
|
||||
icon: mdi:file-chart
|
||||
|
||||
notify_camera_alerts:
|
||||
name: Notify Camera Alerts
|
||||
initial: on
|
||||
icon: mdi:camera
|
||||
|
||||
trash_reminders:
|
||||
name: Remind Trash Notifications
|
||||
initial: on
|
||||
icon: mdi:recycle
|
||||
|
||||
enjoyable_weather_reminders:
|
||||
name: Remind me to enjoy Good Weather
|
||||
initial: on
|
||||
icon: mdi:weather-sunny
|
||||
|
||||
security_system_alerts:
|
||||
name: Notify Security System Status Change
|
||||
initial: on
|
||||
icon: mdi:verified
|
||||
|
||||
zone_alerts:
|
||||
name: Zone Alerts
|
||||
initial: on
|
||||
icon: mdi:map-marker
|
||||
|
||||
alarm_clock:
|
||||
name: Alarm Clock
|
||||
initial: on
|
||||
icon: mdi:calendar-check
|
||||
|
||||
battery_notifications:
|
||||
name: Battery Notifications
|
||||
initial: on
|
||||
icon: mdi:battery
|
||||
|
||||
sharp_tv:
|
||||
name: TV
|
||||
initial: on
|
||||
icon: mdi:television-classic
|
||||
|
||||
dummy:
|
||||
name: "Dummy Input Boolean!"
|
||||
icon: mdi:sticker-emoji
|
||||
initial: on
|
||||
|
||||
light_automations:
|
||||
name: Light Automations
|
||||
icon: mdi:lightbulb-on
|
||||
initial: on
|
||||
|
||||
text_alerts:
|
||||
name: Text Alerts
|
||||
initial: on
|
||||
icon: mdi:map-marker
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# Do not disturb for 2 hours
|
||||
# Simply turns ON the Do Not Disturb Flag ad resets
|
||||
# after 2 hours. The Do Not Disturb flag is used in
|
||||
# voice_notify script
|
||||
######################################################
|
||||
- alias: Do Not Disturb For 2 hours
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.do_not_disturb
|
||||
to: 'on'
|
||||
for:
|
||||
hours: 2
|
||||
minutes: 0
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.do_not_disturb
|
||||
|
||||
######################################################
|
||||
# Reset Movie time after 3 hours
|
||||
- alias: Reset Movie Time After 3 Hours
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.movie_time
|
||||
to: 'on'
|
||||
for:
|
||||
hours: 3
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.movie_time
|
||||
|
||||
# Notify me when DO NOT DISTURB mode is changed
|
||||
######################################################
|
||||
- alias: Do Not Disturb State Change
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.do_not_disturb
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "The Do Not Disturb Mode is {{ trigger.to_state.state |upper }}."
|
||||
|
||||
# Hourly Reports
|
||||
######################################################
|
||||
- alias: Hourly Report During Day Time
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
hours: '/01'
|
||||
minutes: 05
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.hourly_report.state == "on" }}'
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set hour = now().hour | int %}
|
||||
{% if hour > 7 and hour < 21 %}
|
||||
true
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
action:
|
||||
- service: script.home_status
|
23
packages/status.yaml
Executable file
23
packages/status.yaml
Executable file
@@ -0,0 +1,23 @@
|
||||
homeassistant:
|
||||
|
||||
automation:
|
||||
# this automation runs every day at 9:00 AM, 12 PM, 5PM, and at 10:00 PM
|
||||
# and sends an email - only when we are away from the house.
|
||||
- alias: Notify Home Status When Away
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '09:00:00'
|
||||
- platform: time
|
||||
at: '12:00:00'
|
||||
- platform: time
|
||||
at: '17:00:00'
|
||||
- platform: time
|
||||
at: '10:00:00'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.home_mode_away') == 'on' }}"
|
||||
action:
|
||||
- service: notify.notify_smtp
|
||||
data_template:
|
||||
title: 'Home Status {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||||
message: !include ../templates/away_status.yaml
|
83
packages/tesla.yaml
Executable file
83
packages/tesla.yaml
Executable file
@@ -0,0 +1,83 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
binary_sensor.tesla_model_3_5yj3e1ea8jf010610_charger_sensor:
|
||||
friendly_name: Charger
|
||||
binary_sensor.tesla_model_3_5yj3e1ea8jf010610_parking_brake_sensor:
|
||||
friendly_name: Parking Break
|
||||
climate.tesla_model_3_5yj3e1ea8jf010610_hvac_climate_system:
|
||||
friendly_name: Tesla Climate
|
||||
device_tracker.tesla_model_3_5yj3e1ea8jf010610_location_tracker:
|
||||
friendly_name: Tesla
|
||||
lock.tesla_model_3_5yj3e1ea8jf010610_door_lock:
|
||||
friendly_name: Tesla Door Lock
|
||||
sensor.tesla_model_3_5yj3e1ea8jf010610_battery_sensor:
|
||||
friendly_name: Battery Percentage
|
||||
icon: mdi:battery
|
||||
sensor.tesla_model_3_5yj3e1ea8jf010610_mileage_sensor:
|
||||
friendly_name: Total Mileage
|
||||
sensor.tesla_model_3_5yj3e1ea8jf010610_range_sensor:
|
||||
friendly_name: Battery Range
|
||||
sensor.tesla_model_3_5yj3e1ea8jf010610_temperature_sensor_inside:
|
||||
friendly_name: Temperature Inside
|
||||
sensor.tesla_model_3_5yj3e1ea8jf010610_temperature_sensor_outside:
|
||||
friendly_name: Temperature Outside
|
||||
switch.tesla_model_3_5yj3e1ea8jf010610_charger_switch:
|
||||
friendly_name: Charger Switch
|
||||
switch.tesla_model_3_5yj3e1ea8jf010610_maxrange_switch:
|
||||
friendly_name: Max Range Switch
|
||||
|
||||
# The scan_interval is now set to 6 hours
|
||||
# Leaving it to the default (which is 5 minutes, or 300 seconds) will drain battery at a rate of
|
||||
# 10 miles per day (or 3% battery use) on an average. Use this setting carefully!
|
||||
|
||||
tesla:
|
||||
username: !secret tesla_username
|
||||
password: !secret tesla_password
|
||||
scan_interval: 21600
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
- alias: Notify Charging Status
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.tesla_model_3_5yj3e1ea8jf010610_charger_sensor
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Tesla Car Charge Status changed to: {{ trigger.to_state.state| upper }}"
|
||||
|
||||
- alias: Notify Door Status
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: lock.tesla_model_3_5yj3e1ea8jf010610_door_lock
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ trigger.from_state.state | lower != "unknown" }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Tesla Door is now: {{ trigger.to_state.state | upper }}"
|
||||
|
||||
- alias: Notify Charger Switch State
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.tesla_model_3_5yj3e1ea8jf010610_charger_switch
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ trigger.from_state.state | lower != "unknown" }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Tesla Door is now: {{ trigger.to_state.state| upper }}"
|
407
packages/test.yaml
Executable file
407
packages/test.yaml
Executable file
@@ -0,0 +1,407 @@
|
||||
#########################################################################################################
|
||||
# Wrote this code for @norien, where he wanted to set specific color to all the bulbs based on holiday
|
||||
#########################################################################################################
|
||||
# homeassistant:
|
||||
# customize:
|
||||
|
||||
# script.set_random_color_2_all_bulbs:
|
||||
# hidden: false
|
||||
# script.light_set_color:
|
||||
# hidden: true
|
||||
|
||||
# input_label:
|
||||
# hue_color_lamp_1_random_color:
|
||||
# value: "no"
|
||||
# hue_color_lamp_2_random_color:
|
||||
# value: "no"
|
||||
# hue_color_lamp_3_random_color:
|
||||
# value: "no"
|
||||
|
||||
# group:
|
||||
# Family Room Hue Bulbs:
|
||||
# entities:
|
||||
# - light.hue_color_lamp_1
|
||||
# - light.hue_color_lamp_2
|
||||
# - light.hue_color_lamp_3
|
||||
# Input Labels:
|
||||
# entities:
|
||||
# - input_label.hue_color_lamp_1_random_color
|
||||
# - input_label.hue_color_lamp_2_random_color
|
||||
# - input_label.hue_color_lamp_3_random_color
|
||||
|
||||
# script:
|
||||
# set_random_color_2_all_bulbs:
|
||||
# sequence:
|
||||
# - condition: template
|
||||
# value_template: >
|
||||
# {%- macro get_next_entity_id() -%}
|
||||
# {%- for item in states.group.input_labels.attributes.entity_id if is_state(item, "no") -%}
|
||||
# {{- "," if not loop.first-}}{{- item -}}{{-endif-}}
|
||||
# {%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {%- set entity_ids = get_next_entity_id() -%}
|
||||
# {% if entity_ids | trim != "" and entity_ids.split(',') | length | int == 0 %}
|
||||
# false
|
||||
# {% else %}
|
||||
# true
|
||||
# {% endif %}
|
||||
# - delay: '00:00:01'
|
||||
# - service: script.light_set_color
|
||||
# data_template:
|
||||
# entity_id: >-
|
||||
# {%- macro get_next_entity_id() -%}
|
||||
# {%- for item in states.group.input_labels.attributes.entity_id if is_state(item, "no") -%}
|
||||
# {{- "," if not loop.first-}}{{- item -}}{{-endif-}}
|
||||
# {%- endfor -%}
|
||||
# {%- endmacro -%}
|
||||
# {%- set entity_ids = get_next_entity_id() -%}
|
||||
# {% if entity_ids | trim != "" %}
|
||||
# {%- if entity_ids.split(',') | length > 0 -%}
|
||||
# {{- 'light.' ~ entity_ids.split(',')[0].split('.')[1].replace('_random_color', '') -}}
|
||||
# {%- endif -%}
|
||||
# {% endif %}
|
||||
# brightness: 254
|
||||
# r: '{{ "{0:d}".format(range(210, 238)|random) }}'
|
||||
# g: '{{ "{0:d}".format(range(100, 132)|random) }}'
|
||||
# b: '{{ "{0:d}".format(range(240, 254)|random) }}'
|
||||
|
||||
# light_set_color:
|
||||
# sequence:
|
||||
# - condition: template
|
||||
# value_template: '{{ entity_id | trim != "" }}'
|
||||
# - condition: template
|
||||
# value_template: '{{ brightness | trim != "" }}'
|
||||
# - service: light.turn_on
|
||||
# data_template:
|
||||
# entity_id: '{{ entity_id }}'
|
||||
# brightness: '{{ brightness }}'
|
||||
# rgb_color: ['{{"{0:d}".format(range(210, 238)|random)|int}}', '{{"{0:d}".format(range(210, 238)|random)|int}}', '{{"{0:d}".format(range(210, 238)|random)|int}}']
|
||||
# - service: input_label.set_value
|
||||
# data_template:
|
||||
# entity_id: "input_label.{{- entity_id.split('.')[1] -}}_random_color"
|
||||
# value: 'yes'
|
||||
# - delay: '00:00:01'
|
||||
# - service: script.set_random_color_2_all_bulbs
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this for @chags, to show how to raise and handle custom events with dynamic data using templates
|
||||
#########################################################################################################
|
||||
# automation:
|
||||
# - alias: Fire Event
|
||||
# trigger:
|
||||
# platform: state
|
||||
# entity_id: switch.kitchen
|
||||
# action:
|
||||
# event: my_test_event
|
||||
# event_data:
|
||||
# foo: "bar"
|
||||
|
||||
# - alias: Capture Event
|
||||
# trigger:
|
||||
# platform: event
|
||||
# event_type: my_test_event
|
||||
# action:
|
||||
# - service: script.notify_me
|
||||
# data_template:
|
||||
# message: "Test Event Captured with data foo: {{ trigger.event.data.foo }}"
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this code for @roystervi, where it turns on a group of media players/speakers based on where
|
||||
# the motion is detected, and when there is no motion, it turns off the speakers
|
||||
#########################################################################################################
|
||||
|
||||
# automation:
|
||||
# - alias: Speakers On During Presence
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id:
|
||||
# - binary_sensor.masterbed_motion
|
||||
# - binary_sensor.masterbath_motion
|
||||
# - binary_sensor.bathroom_motion
|
||||
# - binary_sensor.kitchen_motion
|
||||
# - binary_sensor.den_motion
|
||||
# action:
|
||||
# - service_template: 'switch.turn_{{ trigger.to_state.state }}'
|
||||
# data_template:
|
||||
# entity_id: '{{ trigger.entity_id.replace("binary_sensor", "group") }}'
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this code for someone, to help set scenes based on sun elevation and time combination
|
||||
#########################################################################################################
|
||||
|
||||
#- id: Sunset_if_home
|
||||
# automation:
|
||||
# - alias: 'Hemkomst'
|
||||
# trigger:
|
||||
# platform: state
|
||||
# entity_id: 'group.telefoner'
|
||||
# state: 'home'
|
||||
# condition:
|
||||
# - condition: time
|
||||
# after: '12:00:00'
|
||||
# before: '02:00:00'
|
||||
# action:
|
||||
# - service_template: scene.turn_on
|
||||
# data_template:
|
||||
# entity_id: >-
|
||||
# {%set elevation = states.sun.sun.attributes.elevation | int %}
|
||||
# {% if elevation > -10 and elevation | int < 5 %}
|
||||
# scene.normalvit
|
||||
# {% elif elevation | int > 5 %}
|
||||
# scene.dimmad_vit
|
||||
# {% endif %}
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this code for someone, to show servcie_template example
|
||||
#########################################################################################################
|
||||
|
||||
# automation:
|
||||
# - alias: Run every 15 seconds
|
||||
# hide_entity: false
|
||||
# initial_state: true
|
||||
# trigger:
|
||||
# - platform: time_pattern
|
||||
# seconds: '/15'
|
||||
# action:
|
||||
# - service_template: >-
|
||||
# {% if states.switch.kitchen.state == 'on' %}
|
||||
# switch.turn_off
|
||||
# {% else %}
|
||||
# switch.turn_on
|
||||
# {% endif %}
|
||||
# entity_id: switch.kitchen
|
||||
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this code for someone, where they wanted to drop a message to MQTT with topic name based on sensor
|
||||
#########################################################################################################
|
||||
|
||||
# automation:
|
||||
# - alias: ResetMotionSensors
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: binary_sensor.hallway_motion
|
||||
# to: 'on'
|
||||
# for:
|
||||
# seconds: 30
|
||||
# - platform: state
|
||||
# entity_id: binary_sensor.livingroom_motion
|
||||
# to: 'on'
|
||||
# for:
|
||||
# seconds: 30
|
||||
# - platform: state
|
||||
# entity_id: binary_sensor.kitchen_motion
|
||||
# to: 'on'
|
||||
# for:
|
||||
# seconds: 30
|
||||
# action:
|
||||
# - service: mqtt.publish
|
||||
# data_template:
|
||||
# payload: '{"state": "open"}'
|
||||
# topic: >-
|
||||
# {% set mapping = '{ "hallway": "985335", "livingroom": "854267", "kitchen": "699555" }' %}
|
||||
# {{ 'Hassio/433/Honeywell/Honeywell_Door/Window_Sensor/' ~ mapping[trigger.entity_id.split('.')[1].split('_')[0] ~ ''] }}
|
||||
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote code for @chags - to pass a list of variables from an automation to a script
|
||||
#########################################################################################################
|
||||
|
||||
# automation:
|
||||
# - alias: 'Pass list to script'
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: switch.kitchen
|
||||
# action:
|
||||
# - service: script.test_script
|
||||
# data:
|
||||
# entities_list:
|
||||
# - light.hue_color_lamp_1
|
||||
# - light.hue_color_lamp_2
|
||||
# - light.hue_color_lamp_3
|
||||
# script:
|
||||
# test_script:
|
||||
# sequence:
|
||||
# - service_template: light.turn_on
|
||||
# data_template:
|
||||
# entity_id: >
|
||||
# {% for e in entities_list %}
|
||||
# {%- if loop.first %}{% elif loop.last %}, {% else %}, {% endif -%}
|
||||
# {{ e }}
|
||||
# {%- endfor %}
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote code for @IxsharpxI#4883 - he wanted to call REST api and extract various values for APCUPS!
|
||||
#########################################################################################################
|
||||
|
||||
# https://raw.githubusercontent.com/awesome-automations/home/master/apcups.html
|
||||
|
||||
# sensor:
|
||||
# - platform: rest
|
||||
# resource: https://raw.githubusercontent.com/awesome-automations/home/master/apcups.html
|
||||
# name: BATTERY_MODEL
|
||||
# scan_interval: 60
|
||||
# value_template: >
|
||||
# {%- macro GetValue(str) -%}
|
||||
# {%- if str in value -%}
|
||||
# {%- set index = value.split(str)[0]|length -%}
|
||||
# {{ value[index+str|length:value|length].split('\n')[0] }}
|
||||
# {%- endif -%}
|
||||
# {%- endmacro %}
|
||||
# {{ GetValue('MODEL : ') }}
|
||||
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this code for someone, where they wanted to have an input_boolean that controls effects
|
||||
#########################################################################################################
|
||||
|
||||
# input_boolean:
|
||||
# color_loop:
|
||||
# initial: off
|
||||
|
||||
# automation:
|
||||
# - alias: Colorloop Automation
|
||||
# trigger:
|
||||
# - platform: state
|
||||
# entity_id: input_boolean.color_loop
|
||||
# action:
|
||||
# - service_template: script.color_loop_ "{{- trigger.to_state.state -}}"
|
||||
|
||||
# script:
|
||||
# color_loop_on:
|
||||
# sequence:
|
||||
# - service: light.turn_on
|
||||
# data:
|
||||
# entity_id: light.xxx
|
||||
# effect: colorloop
|
||||
|
||||
# color_loop_off:
|
||||
# sequence:
|
||||
# - service: light.turn_off
|
||||
# entity_id: light.xxx
|
||||
|
||||
#########################################################################################################
|
||||
# @xxKira wanted to call a service in a loop by passing an alphabet each time from a string,
|
||||
# so that the service inserts that alphabet using remote on TV
|
||||
#########################################################################################################
|
||||
|
||||
# homeassistant:
|
||||
|
||||
# input_number:
|
||||
# text_index:
|
||||
# name: "Text Index"
|
||||
# initial: 0
|
||||
# min: 0
|
||||
# max: 255
|
||||
|
||||
# script:
|
||||
# input_text:
|
||||
# alias: Text to Enter on Remote
|
||||
# sequence:
|
||||
# - service_template: script.text_loop
|
||||
# data_template:
|
||||
# text: "Netflix"
|
||||
|
||||
# text_loop:
|
||||
# alias: Loops Text
|
||||
# sequence:
|
||||
# - condition: template
|
||||
# value_template: "{{ 'true' if (states.input_number.text_index.state |int < text|length | int) else 'false' }}"
|
||||
# - service_template: script.key_input
|
||||
# data_template:
|
||||
# command: >-
|
||||
# {%- set index = states.input_number.text_index.state | int -%}
|
||||
# {{ text[index:index+1] }}
|
||||
# text: "{{ text }}"
|
||||
|
||||
# key_input:
|
||||
# alias: Send Key Input
|
||||
# sequence:
|
||||
# - service: media_player.firetv_adb_shell
|
||||
# data_template:
|
||||
# entity_id: media_player.televisione_camera
|
||||
# cmd: "input keyevent {{ command | upper }}"
|
||||
# - delay: '00:00:01'
|
||||
# - service: input_number.set_value
|
||||
# data_template:
|
||||
# entity_id: input_number.text_index
|
||||
# value: "{{ (states.input_number.text_index.state | int + 1) }}"
|
||||
# - service: script.text_loop
|
||||
# data_template:
|
||||
# text: "{{ text }}"
|
||||
|
||||
#########################################################################################################
|
||||
# Wrote this for @quadflight - automation alerts when any of the sensor's battery is less than 25
|
||||
# it announces in the house!
|
||||
#########################################################################################################
|
||||
# automation:
|
||||
# - alias: Alert Low Battery
|
||||
# trigger:
|
||||
# - platform: template
|
||||
# value_template: >
|
||||
# {% set ns = namespace(lowBattery=false) %}
|
||||
# {%- for x in states if x.attributes and x.attributes.battery_level and x.attributes.battery_level |int <= 24 %}
|
||||
# {% set ns.lowBattery = true %}{% endfor %}
|
||||
# {{ ns.lowBattery }}
|
||||
# action:
|
||||
# - service: script.voice_notify
|
||||
# data_template:
|
||||
# message: >
|
||||
# {% set ns = namespace(lowBattery) %}
|
||||
# {%- for x in states if x.attributes and x.attributes.battery_level and x.attributes.battery_level |int <= 24 %}
|
||||
# {% set ns.lowBattery = ns.lowBattery ~ ',' ~ x.name %}
|
||||
# {%- endfor %}
|
||||
# {{ ns.lowBattery -}}
|
||||
# {{- ' battery is ' if ns.lowBattery.split(',')|count == 1 else ' batteries are ' -}} less than 25 percent.
|
||||
|
||||
|
||||
##############################################################################################################################
|
||||
# Wrote this for @marmar63#0271 - he wanted to run a script `x` number of times
|
||||
# - reduce volume, restore volume level...etc
|
||||
#
|
||||
##############################################################################################################################
|
||||
input_number:
|
||||
loop_index:
|
||||
initial: 0
|
||||
min: 0
|
||||
step: 1
|
||||
max: 9999
|
||||
|
||||
script:
|
||||
run_x_times:
|
||||
alias: Run X Times
|
||||
sequence:
|
||||
- service: input_number.set_value
|
||||
data_template:
|
||||
entity_id: input_number.loop_index
|
||||
value: 0
|
||||
- service_template: script.loop_one
|
||||
data_template:
|
||||
count: "{{ count }}"
|
||||
|
||||
loop_one:
|
||||
alias: Loops X times
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: "{{ 'true' if (states.input_number.loop_index.state |int < count | int) else 'false' }}"
|
||||
- service: mqtt.publish
|
||||
data_template:
|
||||
topic: "/loop/test"
|
||||
payload: "{{ states.input_number.loop_index.state | int }}"
|
||||
retain: false
|
||||
- delay: '00:00:00'
|
||||
- service: script.loop_two
|
||||
data_template:
|
||||
count: "{{ count |int}}"
|
||||
|
||||
loop_two:
|
||||
alias: A loop that calls first loop
|
||||
sequence:
|
||||
- delay: '00:00:00'
|
||||
- service: input_number.set_value
|
||||
data_template:
|
||||
entity_id: input_number.loop_index
|
||||
value: "{{ (states.input_number.loop_index.state | int + 1) |int }}"
|
||||
- service: script.loop_one
|
||||
data_template:
|
||||
count: "{{ count|int }}"
|
90
packages/tts.yaml
Executable file
90
packages/tts.yaml
Executable file
@@ -0,0 +1,90 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'tts'
|
||||
|
||||
exposed: &exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: true
|
||||
homebridge_hidden: false
|
||||
|
||||
not_exposed: ¬_exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: false
|
||||
homebridge_hidden: true
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
not_hidden: ¬_hidden
|
||||
<<: *customize
|
||||
hidden: false
|
||||
|
||||
input_text.tts:
|
||||
<<: *not_hidden
|
||||
icon: mdi:speaker
|
||||
input_boolean.greeting:
|
||||
<<: *not_exposed
|
||||
|
||||
group.text_to_speech:
|
||||
name: TTS
|
||||
<<: *not_hidden
|
||||
|
||||
input_text:
|
||||
tts:
|
||||
name: Text To Speech
|
||||
initial: Initial text
|
||||
|
||||
input_boolean:
|
||||
greeting:
|
||||
name: Greeting
|
||||
initial: off
|
||||
|
||||
input_number:
|
||||
tts_volume_level_morning:
|
||||
name: Morning TTS Volume
|
||||
initial: 0.3
|
||||
min: 0
|
||||
max: 1
|
||||
step: 0.1
|
||||
tts_volume_level_afternoon:
|
||||
name: Afternoon TTS Volume
|
||||
initial: 0.5
|
||||
min: 0
|
||||
max: 1
|
||||
step: 0.1
|
||||
tts_volume_level_evening:
|
||||
name: Evening TTS Volume
|
||||
initial: 0.3
|
||||
min: 0
|
||||
max: 1
|
||||
step: 0.1
|
||||
tts_volume_level_alert:
|
||||
name: TTS Volume Alert Mode
|
||||
initial: 1
|
||||
min: 0
|
||||
max: 1
|
||||
step: 0.1
|
||||
|
||||
automation:
|
||||
|
||||
###############################################################################
|
||||
# The text entered in the text box will be announced in the house
|
||||
###############################################################################
|
||||
- alias: Text Changed Event
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_text.tts
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.state }}"
|
||||
greeting: "{{ 'yes' if states.input_boolean.greeting.state == 'on' else 'no' }}"
|
161
packages/tv.yaml
Executable file
161
packages/tv.yaml
Executable file
@@ -0,0 +1,161 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : TV
|
||||
# @description : Tv Automations
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
# Dim Family Room Lights When TV is Turned ON
|
||||
###############################################################################
|
||||
- alias: TV Dim Indoor Lights when TV is ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.sharp_tv
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'below_horizon'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_1
|
||||
brightness: 5
|
||||
color_temp: 154
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_2
|
||||
brightness: 5
|
||||
color_temp: 154
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_3
|
||||
brightness: 5
|
||||
color_temp: 154
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /home/tv/backlight
|
||||
payload: 'on'
|
||||
retain: true
|
||||
|
||||
# Restore Family Room Lights to TV mode
|
||||
###############################################################################
|
||||
- alias: TV Restore Family Room Lights To TV Mode
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: group.family_room_lights
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.sharp_tv
|
||||
state: 'on'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_1
|
||||
brightness: 5
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_2
|
||||
brightness: 5
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_3
|
||||
brightness: 5
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
|
||||
# Turn Backlights Off when TV is turned OFF
|
||||
###############################################################################
|
||||
- alias: TV Backlight OFF when TV is OFF
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.sharp_tv
|
||||
to: 'off'
|
||||
action:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /home/tv/backlight
|
||||
payload: 'off'
|
||||
retain: true
|
||||
|
||||
# Turn TV backlights when TV is turned ON
|
||||
###############################################################################
|
||||
- alias: TV Backlight is ON when TV is ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.sharp_tv
|
||||
to: 'on'
|
||||
action:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /home/tv/backlight
|
||||
payload: 'on'
|
||||
retain: true
|
||||
|
||||
# Turn back Family room lights when TV is switched OFF
|
||||
###############################################################################
|
||||
- alias: TV Turn Lights ON When TV is turned OFF
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.sharp_tv
|
||||
to: 'off'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'below_horizon'
|
||||
- condition: state
|
||||
entity_id: input_boolean.light_automations
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_1
|
||||
brightness: 255
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_2
|
||||
brightness: 255
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
- service: light.turn_on
|
||||
data:
|
||||
entity_id: light.hue_color_lamp_3
|
||||
brightness: 255
|
||||
color_temp: 154
|
||||
transition: 5
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: /home/tv/backlight
|
||||
payload: 'off'
|
||||
retain: true
|
94
packages/usps.yaml
Executable file
94
packages/usps.yaml
Executable file
@@ -0,0 +1,94 @@
|
||||
###############################################################################
|
||||
# @Author : Mahasri Kalavala
|
||||
# @Date : 01/27/2018
|
||||
# @Package : USPS Package - notifies me of mails and packages.
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
sensor.usps_mail:
|
||||
friendly_name: USPS Mail
|
||||
icon: mdi:email-outline
|
||||
sensor.usps_packages:
|
||||
friendly_name: USPS Packages
|
||||
icon: mdi:package-variant
|
||||
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: 'USPS Mail'
|
||||
state_topic: '/usps/mails'
|
||||
value_template: "{{ value }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: USPS Packages
|
||||
state_topic: '/usps/packages'
|
||||
value_template: "{{ value }}"
|
||||
|
||||
camera:
|
||||
- platform: generic
|
||||
name: USPS Mail Pictures
|
||||
still_image_url: !secret usps_camera_url
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
# Notify USPS mails via TTS, and iOS notification with attachment
|
||||
###############################################################################
|
||||
- alias: Notify USPS Mail
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.usps_mail
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.usps_mail.state | int > 0 }}'
|
||||
- condition: template
|
||||
value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}'
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{%- if states.sensor.usps_mail.state | int == 1 -%}
|
||||
Attention: USPS is delivering {{ states.sensor.usps_mail.state }} mail today.
|
||||
{%- else -%}
|
||||
Attention: USPS is delivering {{ states.sensor.usps_mail.state }} mails today.
|
||||
{%- endif -%}
|
||||
- service: notify.ios_devices
|
||||
data_template:
|
||||
message: "USPS will be delivering {{ states.sensor.usps_mail.state }} mail(s) today."
|
||||
data:
|
||||
push:
|
||||
category: camera
|
||||
entity_id: "camera.usps_mail_pictures"
|
||||
attachment:
|
||||
url: "{{ states.camera.usps_mail_pictures.attributes.entity_picture }}"
|
||||
content-type: jpg
|
||||
|
||||
# Notify USPS packages via TTS. Usually there are no pictures for packages
|
||||
###############################################################################
|
||||
- alias: Notify USPS Packages
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.usps_packages
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.usps_packages.state | int > 0 }}'
|
||||
- condition: template
|
||||
value_template: '{{ ((now().hour | int) > 7) and ((now().hour | int) < 16) }}'
|
||||
action:
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{%- if states.sensor.usps_packages.state | int == 1 -%}
|
||||
Attention: USPS is delivering {{ states.sensor.usps_packages.state }} package today.
|
||||
{%- else -%}
|
||||
Attention: USPS is delivering {{ states.sensor.usps_packages.state }} packages today.
|
||||
{%- endif -%}
|
185
packages/watchdog.yaml
Executable file
185
packages/watchdog.yaml
Executable file
@@ -0,0 +1,185 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : WatchDog
|
||||
# @description : Watchdog Automations
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
# Garage:
|
||||
# Working in Garage Mode Watch Dog - Turns off after 2 hours
|
||||
###############################################################################
|
||||
- alias: Working In Garage WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- input_boolean.working_in_garage
|
||||
to: 'on'
|
||||
for:
|
||||
hours: 2
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "It has been two hours, are you still working in the garage? Changing the status to 'Not working'!"
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.working_in_garage
|
||||
|
||||
# Garage:
|
||||
# Keeps and eye on the garage door... reminds me to close after 5 min
|
||||
###############################################################################
|
||||
- alias: Single Car garage Door WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.single_car_garage_door_tilt_sensor_sensor
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.working_in_garage
|
||||
state: 'off'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "Single Car Garage Door is OPEN for more than 5 minutes!"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Attention! Your single car garage door is open for more than 5 minutes."
|
||||
|
||||
# Garage:
|
||||
# Keeps and eye on the garage door... reminds me to close after 5 min
|
||||
###############################################################################
|
||||
- alias: Two Car garage Door WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.two_car_garage_door_tilt_sensor_sensor
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.working_in_garage
|
||||
state: 'off'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data:
|
||||
message: "Your Two Car Garage Door is OPEN for more than 5 minutes!"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "Attention! Your two car garage door is open for more than 5 minutes."
|
||||
|
||||
# Front Yard:
|
||||
# Keeps and eye on the front porch lights...
|
||||
###############################################################################
|
||||
- alias: Frontyard Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.frontyard_light
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.to_state.attributes.friendly_name }} is ON during the day time. Saving power by turning it off!
|
||||
|
||||
# Back Yard:
|
||||
# Keeps and eye on the patio lights...
|
||||
###############################################################################
|
||||
- alias: Backyard Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.wemobackyardlightswitch
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 5
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.to_state.attributes.friendly_name }} is ON during the day time. Saving power by turning it off!
|
||||
|
||||
# Guest Bedroom:
|
||||
# Keeps and eye on the Guest Bedroom 1 lights...
|
||||
###############################################################################
|
||||
- alias: Guest Bedroom 1 Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.guest_bedroom
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 15
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
|
||||
# Guest Bedroom 2:
|
||||
# Keeps and eye on the Guest Bedroom 2 lights...
|
||||
###############################################################################
|
||||
- alias: Guest Bedroom 2 Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.prayer_room
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 10
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
|
||||
# Kids Bedroom:
|
||||
# Keeps and eye on the Kids Bedroom lights...
|
||||
###############################################################################
|
||||
- alias: Kids Bedroom Light WatchDog
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- switch.kids_bedroom
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 10
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
370
packages/weather.yaml
Executable file
370
packages/weather.yaml
Executable file
@@ -0,0 +1,370 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Weather
|
||||
# @description : Nothing But The Weather Stuff!
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
sun.sun:
|
||||
friendly_name: Sun
|
||||
|
||||
sensor.cold_flu:
|
||||
friendly_name: Cold and Flu
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
sensor.cold_flu_risk:
|
||||
friendly_name: Cold and Flu Risk
|
||||
homebridge_hidden: true
|
||||
sensor.pollen:
|
||||
friendly_name: Pollen
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
sensor.pollen_level:
|
||||
friendly_name: Pollen Level
|
||||
homebridge_hidden: true
|
||||
sensor.air_quality:
|
||||
friendly_name: Air Quality
|
||||
homebridge_hidden: true
|
||||
|
||||
input_boolean.rain_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.snow_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.sleet_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.nice_breeze_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.moderate_wind_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.heavy_wind_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.super_heavy_wind_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
input_boolean.hurricane_wind_alert:
|
||||
hidden: true
|
||||
homebridge_hidden: true
|
||||
sensor.wind_direction:
|
||||
icon: mdi:weather-windy-variant
|
||||
homebridge_hidden: true
|
||||
sensor.wind_direction_tts:
|
||||
icon: mdi:weather-windy-variant
|
||||
homebridge_hidden: true
|
||||
|
||||
camera:
|
||||
- platform: generic
|
||||
name: Ohio Doppler Weather
|
||||
still_image_url: !secret ohio_doppler_weather
|
||||
|
||||
input_boolean:
|
||||
nice_breeze_alert:
|
||||
name: Nice Breeze Alert
|
||||
initial: off
|
||||
moderate_wind_alert:
|
||||
name: Moderate Wind Alert
|
||||
initial: off
|
||||
heavy_wind_alert:
|
||||
name: heavy Wind Alert
|
||||
initial: off
|
||||
super_heavy_wind_alert:
|
||||
name: Super Heavy Wind Alert
|
||||
initial: off
|
||||
hurricane_wind_alert:
|
||||
name: Hurricane Winds Alert
|
||||
initial: off
|
||||
rain_alert:
|
||||
name: Rain Alert
|
||||
initial: off
|
||||
snow_alert:
|
||||
name: Snow Alert
|
||||
initial: off
|
||||
sleet_alert:
|
||||
name: Sleet Alert
|
||||
initial: off
|
||||
|
||||
#
|
||||
# Good Weather To Fly Drone?
|
||||
# Criteria:
|
||||
# - Wind Speed must be less than 12 mph
|
||||
# - No Rain, or Snow
|
||||
# - No Thunderstorms, lightning
|
||||
# - Visiblity must be more than 2 miles
|
||||
# - Temperature must be above 32 degrees Fahrenheit - (avoid risk of batteries being dead in extreme cold temperature)
|
||||
# - Cloud coverage must be above than 30% (I prefer good amount of sunlight or clear sky) - may have to tweak during winters :)
|
||||
#
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
good_weather_to_fly_drones:
|
||||
friendly_name: Good Weather To Fly Drone?
|
||||
value_template: >-
|
||||
{% if states.sensor.dark_sky_wind_speed.state | round(0) | int > 12 or
|
||||
states.sensor.dark_sky_precip.state |lower == "rain" or
|
||||
states.sensor.dark_sky_precip.state |lower == "snow" or
|
||||
states.sensor.dark_sky_visibility.state | round(0) | int < 2 or
|
||||
states.sensor.dark_sky_temperature.state | round(0) | int < 32 or
|
||||
states.sensor.dark_sky_cloud_coverage.state | round(0) | int > 30 %}
|
||||
false
|
||||
{% else %}
|
||||
true
|
||||
{% endif %}
|
||||
|
||||
weather:
|
||||
- platform: darksky
|
||||
api_key: !secret darksky_api_key
|
||||
|
||||
sensor:
|
||||
- platform: darksky
|
||||
api_key: !secret darksky_api_key
|
||||
monitored_conditions:
|
||||
- summary
|
||||
- icon
|
||||
- nearest_storm_distance
|
||||
- nearest_storm_bearing
|
||||
- precip_type
|
||||
- precip_intensity
|
||||
- precip_probability
|
||||
- temperature
|
||||
- apparent_temperature
|
||||
- dew_point
|
||||
- wind_speed
|
||||
- wind_bearing
|
||||
- cloud_cover
|
||||
- humidity
|
||||
- pressure
|
||||
- visibility
|
||||
- ozone
|
||||
- minutely_summary
|
||||
- hourly_summary
|
||||
- daily_summary
|
||||
- precip_intensity_max
|
||||
|
||||
- platform: rest
|
||||
name: pollen
|
||||
resource: !secret weather_pollen_url
|
||||
value_template: "{{value_json.Location.periods[1].Index}}"
|
||||
scan_interval: 21600
|
||||
headers:
|
||||
Referer: "https://www.pollen.com"
|
||||
|
||||
- platform: rest
|
||||
name: cold_flu
|
||||
resource: !secret weather_cold_flu_url
|
||||
value_template: "{{value_json.Location.periods[0].Index}}"
|
||||
scan_interval: 21600
|
||||
headers:
|
||||
Referer: "https://www.pollen.com"
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# Script to alert when enjoyable weather is outside
|
||||
# For me, enjoyable is:
|
||||
# 1. Must be above 70 Degrees F
|
||||
# 2. Alert me only during day time
|
||||
#
|
||||
# Only want to be notified every 15 minutes or so. Do not want to be bombarded with updates every minute wind speed changes
|
||||
- alias: Remind me to enjoy warm and windy weather
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.dark_sky_wind_speed
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.enjoyable_weather_reminders.state == "on" }}'
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
- condition: template
|
||||
value_template: '{% if states.sensor.dark_sky_apparent_temperature.state | round > 70 %} true {% else %} false {% endif %}'
|
||||
- condition: template
|
||||
value_template: '{% if states.sensor.dark_sky_wind_speed.state | round < 8 %} false {% else %} true {% endif %}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{% set windspeed = states.sensor.dark_sky_wind_speed.state | round %}
|
||||
{% if ( windspeed > 7 and ( windspeed <= 15 ) and (states.input_boolean.nice_breeze_alert.state == 'off')) %}
|
||||
{{ states.sensor.dark_sky_apparent_temperature.state | round }} degrees, and {{windspeed}} mph winds. You should go out and enjoy weather!
|
||||
{% elif ( windspeed > 15 ) and ( windspeed <= 25 ) and (states.input_boolean.moderate_wind_alert.state == 'off') %}
|
||||
{{ states.sensor.dark_sky_apparent_temperature.state | round }} degrees, and {{windspeed}} mph winds. You should go out and enjoy weather!
|
||||
{% elif ( windspeed > 25 ) and ( windspeed <= 40 ) and (states.input_boolean.heavy_wind_alert.state == 'off') %}
|
||||
HEAVY WINDS!!! Current Wind Speed is : {{windspeed}} mph! Be VERY careful outdoors!
|
||||
{% elif ( windspeed > 40 ) and ( windspeed <= 60 ) and (states.input_boolean.super_heavy_wind_alert.state == 'off') %}
|
||||
Warning! Wind speed is {{windspeed}} MPH. FIND SHELTER IMMEDIATELY!
|
||||
{% elif ( windspeed > 60 ) and (states.input_boolean.hurricane_wind_alert.state == 'off') %}
|
||||
HURRICANE WINDS. FIND SHELTER, AND STAY INDOORS!
|
||||
{% endif %}
|
||||
- service: input_boolean.turn_on
|
||||
data_template:
|
||||
entity_id: >
|
||||
{% set windspeed = states.sensor.dark_sky_wind_speed.state | round %}
|
||||
{%- if ( windspeed > 7 and ( windspeed <= 15 ) ) -%}
|
||||
input_boolean.nice_breeze_alert
|
||||
{%- elif ( windspeed > 15 ) and ( windspeed <= 25 ) %}
|
||||
input_boolean.moderate_wind_alert
|
||||
{%- elif ( windspeed > 25 ) and ( windspeed <= 40 ) %}
|
||||
input_boolean.heavy_wind_alert
|
||||
{%- elif ( windspeed > 40 ) and ( windspeed <= 60 ) %}
|
||||
input_boolean.super_heavy_wind_alert
|
||||
{%- elif ( windspeed > 60 ) %}
|
||||
input_boolean.hurricane_wind_alert
|
||||
{%- endif %}
|
||||
|
||||
# #Turn off those wind speed alert booleans automatically after 15 minutes.
|
||||
- alias: Weather Input Boolean Updates
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- input_boolean.nice_breeze_alert
|
||||
- input_boolean.moderate_wind_alert
|
||||
- input_boolean.heavy_wind_alert
|
||||
- input_boolean.super_heavy_wind_alert
|
||||
- input_boolean.hurricane_wind_alert
|
||||
- input_boolean.rain_alert
|
||||
- input_boolean.snow_alert
|
||||
- input_boolean.sleet_alert
|
||||
to: 'on'
|
||||
for:
|
||||
minutes: 15
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
data_template:
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
|
||||
- alias: Alert Super Heavy Winds
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.dark_sky_wind_speed
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{%- if states.sensor.dark_sky_wind_speed.last_changed -%}
|
||||
{{ (as_timestamp(now()) - as_timestamp(states.sensor.dark_sky_wind_speed.last_changed)) > 120 }}
|
||||
{%- else -%}
|
||||
true
|
||||
{%- endif -%}
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{% set windspeed = states.sensor.dark_sky_wind_speed.state | round %}
|
||||
{% if ( windspeed > 40 ) and ( windspeed <= 60 ) and (states.input_boolean.super_heavy_wind_alert.state == 'off') %}
|
||||
Warning! Wind speed is {{windspeed}} MPH. FIND SHELTER IMMEDIATELY!
|
||||
{% elif ( windspeed > 60 ) and ( windspeed <= 100 ) and (states.input_boolean.hurricane_wind_alert.state == 'off') %}
|
||||
HURRICANE WINDS. FIND SHELTER, AND STAY INDOORS! DO NOT GO OUT AND RISK YOUR LIFE!
|
||||
{% endif %}
|
||||
|
||||
- alias: Rain Alerts
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.dark_sky_precip
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ trigger.to_state.state | lower == "rain" }}'
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
- condition: template
|
||||
value_template: '{% if trigger.to_state.state == "unknown" or trigger.to_state.state == "" %} false {% else %} true {% endif %}'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.dark_sky_precip_probability.state | int == 1 }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.state | title }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float }} inches per hour"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.state }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float}} inches per hour"
|
||||
- service: input_boolean.turn_on
|
||||
data_template:
|
||||
entity_id: >
|
||||
{% set curState = trigger.to_state.state | lower %}
|
||||
{%- if curState == "rain" -%}
|
||||
input_boolean.rain_alert
|
||||
{%- endif %}
|
||||
|
||||
- alias: Snow And Sleet Alerts
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.dark_sky_precip
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.season.state | lower == "winter" }}'
|
||||
- condition: state
|
||||
entity_id: group.all_devices
|
||||
state: 'home'
|
||||
- condition: state
|
||||
entity_id: sun.sun
|
||||
state: 'above_horizon'
|
||||
- condition: template
|
||||
value_template: '{% if trigger.to_state.state == "unknown" or trigger.to_state.state == "" %} false {% else %} true {% endif %}'
|
||||
- condition: template
|
||||
value_template: '{{ states.sensor.dark_sky_precip_probability.state | int == 1 }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.state | title }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float }} inches per hour"
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "{{ trigger.to_state.state }} with intensity {{ states.sensor.dark_sky_precip_intensity.state | float}} inches per hour"
|
||||
- service: input_boolean.turn_on
|
||||
data_template:
|
||||
entity_id: >
|
||||
{% set curState = trigger.to_state.state | lower %}
|
||||
{%- if curState == "snow" %}
|
||||
input_boolean.snow_alert
|
||||
{%- elif curState == "sleet" %}
|
||||
input_boolean.sleet_alert
|
||||
{%- endif %}
|
||||
|
||||
- alias: Update OpenUV every 30 minutes during the daytime
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: "/30"
|
||||
seconds: 00
|
||||
condition:
|
||||
condition: and
|
||||
conditions:
|
||||
- condition: sun
|
||||
after: sunrise
|
||||
- condition: sun
|
||||
before: sunset
|
||||
action:
|
||||
service: openuv.update_data
|
||||
|
||||
# Weather sensors - TBD, too lazy to create them
|
||||
#
|
||||
# {{ states.sun.sun.state }}
|
||||
# {{ states.sun.sun.attributes.azimuth }}
|
||||
# {{ states.sun.sun.attributes.elevation }}
|
||||
# Next Dusk: {{ as_timestamp(strptime(states.sun.sun.attributes.next_dusk, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
||||
# Next Midnight: {{ as_timestamp(strptime(states.sun.sun.attributes.next_midnight, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
||||
# Next Dawn: {{ as_timestamp(strptime(states.sun.sun.attributes.next_dawn, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
||||
# Next Rising: {{ as_timestamp(strptime(states.sun.sun.attributes.next_rising, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
||||
# Next Setting: {{ as_timestamp(strptime(states.sun.sun.attributes.next_setting, '%Y-%m-%d %H:%M:%S')) |timestamp_custom('%I:%M %p', true) }}
|
88
packages/wfh.yaml
Executable file
88
packages/wfh.yaml
Executable file
@@ -0,0 +1,88 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 11/07/2017
|
||||
# @package : Work From Home (wfh)
|
||||
# @description : Reminds me to Get Up and Walk around the house once
|
||||
# every 30 minutes during Work From Home days
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
timer.wfh_timer:
|
||||
hidden: true
|
||||
|
||||
timer:
|
||||
wfh_timer:
|
||||
duration: '00:30:00'
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
|
||||
# Start WFH timer if Suresh is HOME during weekdays between 10 AM and 5 PM
|
||||
###############################################################################
|
||||
- alias: WFH Timer Start
|
||||
initial_state: false
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: '/5'
|
||||
seconds: 00
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.binary_sensor.workday_sensor.state == "on" }}'
|
||||
- condition: template
|
||||
value_template: '{{ now().hour|int >= 10 and now().hour|int < 17 }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.timer.wfh_timer.state == "idle" }}'
|
||||
- condition: template
|
||||
value_template: '{{ states.device_tracker.suresh_suresh.state == "home" }}'
|
||||
action:
|
||||
- service: timer.start
|
||||
entity_id: timer.wfh_timer
|
||||
|
||||
# Timer elapsed... Remind Suresh to take a quick walk
|
||||
# Restart the timer ONLY if the time is betwen office hours (10 AM and 5 PM)
|
||||
###############################################################################
|
||||
- alias: Timer Elapsed - Take a walk
|
||||
initial_state: false
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.wfh_timer
|
||||
action:
|
||||
- service_template: >
|
||||
{% if now().hour | int >= 10 and now().hour | int < 17 %}
|
||||
timer.start
|
||||
{% else %}
|
||||
timer.cancel
|
||||
{% endif %}
|
||||
entity_id: timer.wfh_timer
|
||||
- condition: template
|
||||
value_template: '{{ now().hour|int >= 10 and now().hour|int < 17 }}'
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: "It is time to stand up and walk around!"
|
||||
|
||||
# Cancel timer (if active) When Suresh left home
|
||||
###############################################################################
|
||||
- alias: Cancel WFH Timer When Suresh Leaves Home
|
||||
initial_state: false
|
||||
trigger:
|
||||
- platform: zone
|
||||
entity_id: device_tracker.suresh_suresh
|
||||
zone: zone.home
|
||||
event: leave
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.timer.wfh_timer.state == "active" }}'
|
||||
action:
|
||||
- service: timer.cancel
|
||||
entity_id: timer.wfh_timer
|
103
packages/xiaomi_aqara.yaml
Executable file
103
packages/xiaomi_aqara.yaml
Executable file
@@ -0,0 +1,103 @@
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'xiaomi'
|
||||
|
||||
exposed: &exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: true
|
||||
homebridge_hidden: false
|
||||
|
||||
not_exposed: ¬_exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: false
|
||||
homebridge_hidden: true
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
binary_sensor.motion_sensor_158d0001a662fe:
|
||||
friendly_name: Kitchen Motion Sensor (Xiaomi)
|
||||
sensor.Illumination_158d0001a662fe:
|
||||
friendly_name: Kitchen Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d0001a25041:
|
||||
friendly_name: Family Room Motion Sensor (xiaomi)
|
||||
sensor.Illumination_158d0001a25041:
|
||||
friendly_name: Family Room Luminance (xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d00016db6d2:
|
||||
friendly_name: Study Room Motion Sensor (Xiaomi)
|
||||
sensor.Illumination_158d00016db6d2:
|
||||
friendly_name: Study Room Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d00016c2d0e:
|
||||
friendly_name: Dining Room Motion Sensor (Xiaomi)
|
||||
sensor.Illumination_158d00016c2d0e:
|
||||
friendly_name: Dining Room Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d00024e57d3:
|
||||
friendly_name: Master Bedroom Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d00024e57d3:
|
||||
friendly_name: Master Bedroom Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d00024ee084:
|
||||
friendly_name: Front Door Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d00024ee084:
|
||||
friendly_name: Front Door Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d00024e842c:
|
||||
friendly_name: Backyard Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d00024e842c:
|
||||
friendly_name: Backyard's Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d00024e57fb:
|
||||
friendly_name: Driveway Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d00024e57fb:
|
||||
friendly_name: Driveway's Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d000272bf48:
|
||||
friendly_name: Garage Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d000272bf48:
|
||||
friendly_name: Garage's Luminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d000272bfd7:
|
||||
friendly_name: Office Room Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d000272bfd7:
|
||||
friendly_name: Office Room Liminance (Xiaomi)
|
||||
|
||||
binary_sensor.motion_sensor_158d000272bed1:
|
||||
friendly_name: Srinika's Bedroom Motion Sensor (Xiaomi)
|
||||
sensor.illumination_158d000272bed1:
|
||||
friendly_name: Srinika's Bedroom Liminance (Xiaomi)
|
||||
|
||||
sensor.Illumination_34ce008ad65d:
|
||||
friendly_name: Hallway Luminance (Xiaomi Aqara)
|
||||
|
||||
light.gateway_light_34ce008ad65d:
|
||||
friendly_name: Hallway Light (Xiaomi Aqara Gateway)
|
||||
|
||||
binary_sensor.cube_158d0002794cd6:
|
||||
friendly_name: Family Room Cube (Xiaomi)
|
||||
binary_sensor.cube_158d000278eb6a:
|
||||
friendly_name: Master Bedroom Cube (Xiaomi)
|
||||
binary_sensor.cube_158d000276e3e8:
|
||||
friendly_name: Basement Cube (Xiaomi)
|
||||
binary_sensor.cube_158d00027c0276:
|
||||
friendly_name: Front Room Cube (Xiaomi)
|
||||
binary_sensor.cube_158d00027ce15c:
|
||||
friendly_name: Hasika's Bedroom Cube (Xiaomi)
|
||||
binary_sensor.cube_158d00027cf60d:
|
||||
friendly_name: Srinika's Bedroom Cube (Xiaomi)
|
||||
|
||||
xiaomi_aqara:
|
||||
discovery_retry: 5
|
||||
gateways:
|
||||
- key: !secret xiaomi_key
|
343
packages/xiaomi_magic_cubes.yaml
Executable file
343
packages/xiaomi_magic_cubes.yaml
Executable file
@@ -0,0 +1,343 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 09/20/2018
|
||||
# @package : xiaomi_magic_cubes
|
||||
# @description : Xiaomi Aqara Magic Cube Automations
|
||||
###############################################################################
|
||||
|
||||
################################################################################
|
||||
# COMMON SCRIPTS USED IN THIS PACKAGE #
|
||||
################################################################################
|
||||
script:
|
||||
toggle_do_not_disturb:
|
||||
sequence:
|
||||
- service: input_boolean.toggle
|
||||
entity_id: input_boolean.do_not_disturb
|
||||
|
||||
################################################################################
|
||||
# XIAOMI AQARA MAGIC CUBE AUTOMATIONS #
|
||||
# http://patorjk.com/software/taag/#p=display&h=2&v=2&f=Big&t=Test #
|
||||
################################################################################
|
||||
|
||||
automation:
|
||||
################################################################################
|
||||
# ______ _ _ _____
|
||||
# | ____| (_) | | __ \
|
||||
# | |__ __ _ _ __ ___ _| |_ _ | |__) |___ ___ _ __ ___
|
||||
# | __/ _` | '_ ` _ \| | | | | | | _ // _ \ / _ \| '_ ` _ \
|
||||
# | | | (_| | | | | | | | | |_| | | | \ \ (_) | (_) | | | | | |
|
||||
# |_| \__,_|_| |_| |_|_|_|\__, | |_| \_\___/ \___/|_| |_| |_|
|
||||
# __/ |
|
||||
# |___/
|
||||
|
||||
# Flip 90: Toggle Family Room Lights
|
||||
- alias: Family Room Cube Event flip90
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d0002794cd6
|
||||
action_type: flip90
|
||||
action:
|
||||
- service_template: light.toggle
|
||||
entity_id: light.family_room
|
||||
|
||||
# Flip 180: Lights ON Family Room Lights FULL brightness
|
||||
- alias: Family Room Cube Event flip180
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d0002794cd6
|
||||
action_type: flip180
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id: light.family_room
|
||||
data:
|
||||
rgb_color: [255, 251, 245]
|
||||
brightness: 254
|
||||
color_temp: 162
|
||||
|
||||
# Move: Toggle Kitchen Light
|
||||
- alias: Family Room Cube Event Move
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d0002794cd6
|
||||
action_type: move
|
||||
action:
|
||||
- service: switch.toggle
|
||||
entity_id: switch.kitchen
|
||||
|
||||
# Double Tap: Turn OFF Downstairs Lights
|
||||
- alias: Family Room Cube Event Tap Twice
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d0002794cd6
|
||||
action_type: tap_twice
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id: light.family_room
|
||||
rgb_color:
|
||||
- '{{ range(0,255) |random }}'
|
||||
- '{{ range(0,255) |random }}'
|
||||
- '{{ range(0,255) |random }}'
|
||||
|
||||
# Shake: Toggle Do Not Disturb Mode
|
||||
- alias: Family Room Cube Event Shake
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d0002794cd6
|
||||
action_type: shake_air
|
||||
action:
|
||||
- service: script.toggle_do_not_disturb
|
||||
|
||||
################################################################################
|
||||
# ______ _ _____
|
||||
# | ____| | | | __ \
|
||||
# | |__ _ __ ___ _ __ | |_ | |__) |___ ___ _ __ ___
|
||||
# | __| '__/ _ \| '_ \| __| | _ // _ \ / _ \| '_ ` _ \
|
||||
# | | | | | (_) | | | | |_ | | \ \ (_) | (_) | | | | | |
|
||||
# |_| |_| \___/|_| |_|\__| |_| \_\___/ \___/|_| |_| |_|
|
||||
|
||||
# Flip 90: Toggle Front Room Lights
|
||||
- alias: Front Room Cube Event flip90
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027c0276
|
||||
action_type: flip90
|
||||
action:
|
||||
- service_template: switch.toggle
|
||||
entity_id: switch.rf_switch_four
|
||||
|
||||
# Flip 180: Toggle Office Room Accent Lights
|
||||
- alias: Family Room Cube Event flip180
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027c0276
|
||||
action_type: flip180
|
||||
action:
|
||||
- service: switch.toggle
|
||||
entity_id: switch.zwave_smart_switch_switch
|
||||
|
||||
# Move: Toggle Office Room Light
|
||||
- alias: Family Room Cube Event Move
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027c0276
|
||||
action_type: move
|
||||
action:
|
||||
- service: switch.toggle
|
||||
entity_id: switch.office_room
|
||||
|
||||
# Shake: Toggle Do Not Disturb Mode
|
||||
- alias: Family Room Cube Event Shake
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027c0276
|
||||
action_type: shake_air
|
||||
action:
|
||||
- service: script.toggle_do_not_disturb
|
||||
|
||||
###############################################################################
|
||||
# _____ _ _ _ _ _____
|
||||
# / ____| (_) (_) | ( ) | __ \
|
||||
# | (___ _ __ _ _ __ _| | ____ _|/ ___ | |__) |___ ___ _ __ ___
|
||||
# \___ \| '__| | '_ \| | |/ / _` | / __| | _ // _ \ / _ \| '_ ` _ \
|
||||
# ____) | | | | | | | | < (_| | \__ \ | | \ \ (_) | (_) | | | | | |
|
||||
# |_____/|_| |_|_| |_|_|_|\_\__,_| |___/ |_| \_\___/ \___/|_| |_| |_|
|
||||
|
||||
# Flip 90: Toggle Srinika's Room Lights
|
||||
- alias: Srinika Room Cube Event flip90
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027cf60d
|
||||
action_type: flip90
|
||||
action:
|
||||
- service_template: switch.toggle
|
||||
entity_id: switch.guest_bedroom
|
||||
|
||||
# Shake: Toggle Do Not Disturb Mode
|
||||
- alias: Srinika Room Cube Event Shake
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027cf60d
|
||||
action_type: shake_air
|
||||
action:
|
||||
- service: script.toggle_do_not_disturb
|
||||
|
||||
##############################################################################
|
||||
# _ _ _ _ _ _____
|
||||
# | | | | (_) | ( ) | __ \
|
||||
# | |__| | __ _ ___ _| | ____ _|/ ___ | |__) |___ ___ _ __ ___
|
||||
# | __ |/ _` / __| | |/ / _` | / __| | _ // _ \ / _ \| '_ ` _ \
|
||||
# | | | | (_| \__ \ | < (_| | \__ \ | | \ \ (_) | (_) | | | | | |
|
||||
# |_| |_|\__,_|___/_|_|\_\__,_| |___/ |_| \_\___/ \___/|_| |_| |_|
|
||||
|
||||
# Flip 90: Toggle Hasika's Room Lights
|
||||
- alias: Hasika Room Cube Event flip90
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027ce15c
|
||||
action_type: flip90
|
||||
action:
|
||||
- service_template: switch.toggle
|
||||
entity_id: switch.kids_bedroom
|
||||
|
||||
# Shake: Toggle Do Not Disturb Mode
|
||||
- alias: Hasika Room Cube Event Shake
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d00027ce15c
|
||||
action_type: shake_air
|
||||
action:
|
||||
- service: script.toggle_do_not_disturb
|
||||
|
||||
################################################################################
|
||||
# _____ _ _ _____
|
||||
# / ____| | | | | __ \
|
||||
# | (___ | |_ _ _ __| |_ _ | |__) |___ ___ _ __ ___
|
||||
# \___ \| __| | | |/ _` | | | | | _ // _ \ / _ \| '_ ` _ \
|
||||
# ____) | |_| |_| | (_| | |_| | | | \ \ (_) | (_) | | | | | |
|
||||
# |_____/ \__|\__,_|\__,_|\__, | |_| \_\___/ \___/|_| |_| |_|
|
||||
# __/ |
|
||||
# |___/
|
||||
|
||||
# Flip 90: Toggle Study Room Lights
|
||||
- alias: Study Room Cube Event Flip90
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000276e3e8
|
||||
action_type: flip90
|
||||
action:
|
||||
- service: switch.toggle
|
||||
entity_id: switch.prayer_room
|
||||
|
||||
# Shake: Toggle Do Not Disturb Mode
|
||||
- alias: Study Room Cube Event Shake
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000276e3e8
|
||||
action_type: shake_air
|
||||
action:
|
||||
- service: script.toggle_do_not_disturb
|
||||
|
||||
################################################################################
|
||||
# __ __ _ ____ _
|
||||
# | \/ | | | | _ \ | |
|
||||
# | \ / | __ _ ___| |_ ___ _ __ | |_) | ___ __| |_ __ ___ ___ _ __ ___
|
||||
# | |\/| |/ _` / __| __/ _ \ '__| | _ < / _ \/ _` | '__/ _ \ / _ \| '_ ` _ \
|
||||
# | | | | (_| \__ \ || __/ | | |_) | __/ (_| | | | (_) | (_) | | | | | |
|
||||
# |_| |_|\__,_|___/\__\___|_| |____/ \___|\__,_|_| \___/ \___/|_| |_| |_|
|
||||
|
||||
# Flip 90: All Lights OFF (upstairs and downstairs)
|
||||
- alias: Master Bedroom Cube Event Flip90
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000278eb6a
|
||||
action_type: flip90
|
||||
action:
|
||||
- service: homeassistant.turn_off
|
||||
entity_id: group.downstairs_lights
|
||||
- service: homeassistant.turn_off
|
||||
entity_id: group.upstairs_lights
|
||||
|
||||
# Flip 180: Toggle Lights
|
||||
- alias: Master Bedroom Cube Event Flip180
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000278eb6a
|
||||
action_type: flip180
|
||||
action:
|
||||
- service: light.toggle
|
||||
entity_id: light.master_bedroom
|
||||
|
||||
# Move: Turn ON Master Bedroom Lights
|
||||
- alias: Master Bedroom Cube Event Move
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000278eb6a
|
||||
action_type: move
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id: light.master_bedroom
|
||||
|
||||
# Double Tap: Turn OFF Downstairs Lights
|
||||
- alias: Master Bedroom Cube Event Tap Twice
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000278eb6a
|
||||
action_type: tap_twice
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id: light.master_bedroom
|
||||
rgb_color:
|
||||
- '{{ range(0,255) |random }}'
|
||||
- '{{ range(0,255) |random }}'
|
||||
- '{{ range(0,255) |random }}'
|
||||
|
||||
# Shake: Toggle Do Not Disturb Mode
|
||||
- alias: Master Bedroom Cube Event Shake
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: xiaomi_aqara.cube_action
|
||||
event_data:
|
||||
entity_id: binary_sensor.cube_158d000278eb6a
|
||||
action_type: shake_air
|
||||
action:
|
||||
- service: script.toggle_do_not_disturb
|
217
packages/zones.yaml
Executable file
217
packages/zones.yaml
Executable file
@@ -0,0 +1,217 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/15/2017
|
||||
# @package : Zone
|
||||
# @description : All the zones are defined here
|
||||
###############################################################################
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
input_boolean.home_mode_away:
|
||||
friendly_name: Away Mode
|
||||
zone.home:
|
||||
friendly_name: Home
|
||||
zone.work:
|
||||
friendly_name: Office
|
||||
group.zone_alerts:
|
||||
order: 40
|
||||
|
||||
zone:
|
||||
- name: work
|
||||
latitude: !secret work_latitude
|
||||
longitude: !secret work_longitude
|
||||
radius: 200
|
||||
icon: mdi:briefcase
|
||||
|
||||
input_boolean:
|
||||
home_mode_away:
|
||||
name: Away
|
||||
initial: 'off'
|
||||
|
||||
proximity:
|
||||
home:
|
||||
devices: device_tracker.suresh_suresh
|
||||
tolerance: 50
|
||||
unit_of_measurement: mi
|
||||
work:
|
||||
devices: device_tracker.suresh_suresh
|
||||
tolerance: 50
|
||||
unit_of_measurement: mi
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
###############################################################################
|
||||
# Zone based alerting
|
||||
###############################################################################
|
||||
- alias: Alert When Someone Enters a Zone
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: zone
|
||||
entity_id:
|
||||
- device_tracker.hasika_hasika
|
||||
- device_tracker.mallika_mallika
|
||||
- device_tracker.srinika_srinika
|
||||
- device_tracker.suresh_suresh
|
||||
zone: zone.home
|
||||
event: enter
|
||||
- platform: zone
|
||||
entity_id: device_tracker.suresh_suresh
|
||||
zone: zone.work
|
||||
event: enter
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.zone_alerts') == 'on' }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.entity_id.split('.')[1].split('_')[0] | title}} just entered {{ trigger.zone.attributes.friendly_name }}!
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
{{ trigger.entity_id.split('.')[1].split('_')[0] | title}} just entered {{ trigger.zone.attributes.friendly_name }}!
|
||||
greeting: 'no'
|
||||
|
||||
- alias: Alert When Someone Leaves a Zone
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: zone
|
||||
entity_id:
|
||||
- device_tracker.hasika_hasika
|
||||
- device_tracker.mallika_mallika
|
||||
- device_tracker.srinika_srinika
|
||||
- device_tracker.suresh_suresh
|
||||
zone: zone.home
|
||||
event: leave
|
||||
- platform: zone
|
||||
entity_id: device_tracker.suresh_suresh
|
||||
zone: zone.work
|
||||
event: leave
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_boolean.zone_alerts') == 'on' }}"
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "{{ trigger.entity_id.split('.')[1].split('_')[0] | title}} just left {{ trigger.zone.attributes.friendly_name }}."
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{{ trigger.entity_id.split('.')[1].split('_')[0] | title }} just left {{ trigger.zone.attributes.friendly_name }}.
|
||||
{% if trigger.entity_id.split('.')[1].split('_')[0] == "suresh" and trigger.zone.attributes.friendly_name | lower == "office" %}
|
||||
and will be home in {{ (states.sensor.suresh2home.state | int) + 5 }} minutes.
|
||||
{% endif %}
|
||||
greeting: 'no'
|
||||
|
||||
###############################################################################
|
||||
# Welcome family members when they come home
|
||||
###############################################################################
|
||||
- alias: Welcome Family
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- device_tracker.mallika_mallika
|
||||
- device_tracker.suresh_suresh
|
||||
- device_tracker.srinika_srinika
|
||||
- device_tracker.hasika_hasika
|
||||
from: 'not_home'
|
||||
to: 'home'
|
||||
for: '00:02:00'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.zone_alerts
|
||||
state: 'on'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: >
|
||||
Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[0] | title }}!
|
||||
- service: script.voice_notify
|
||||
data_template:
|
||||
message: >
|
||||
"Welcome home, {{ trigger.entity_id.split('.')[1].split('_')[0] | lower }}!"
|
||||
greeting: 'no'
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.home_mode_away
|
||||
|
||||
##############################################################################
|
||||
# Alert when every one is away
|
||||
##############################################################################
|
||||
- alias: Alert when everyone is AWAY
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: time_pattern
|
||||
minutes: 00
|
||||
seconds: '/30'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.input_boolean.home_mode_away.state == "off" }}'
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set suresh = states.device_tracker.suresh_suresh.state %}
|
||||
{% set mallika = states.device_tracker.mallika_mallika.state %}
|
||||
{% set srinika = states.device_tracker.srinika_srinika.state %}
|
||||
{% set hasika = states.device_tracker.hasika_hasika.state %}
|
||||
{% if suresh != "home" and mallika != "home" and srinika != "home" and hasika != "home" %}
|
||||
True
|
||||
{% else %}
|
||||
False
|
||||
{% endif %}
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.home_mode_away
|
||||
|
||||
- alias: Home Mode Away ON
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.home_mode_away
|
||||
to: 'on'
|
||||
action:
|
||||
- service: script.home_mode_away
|
||||
|
||||
###############################################################################
|
||||
# Proximity - Send an alert when someone is on their way home
|
||||
###############################################################################
|
||||
- alias: Send a message as I get closer to home
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: numeric_state
|
||||
entity_id: proximity.home
|
||||
below: 5
|
||||
above: 1
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ states.proximity.home.attributes.dir_of_travel == "towards" }}'
|
||||
action:
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Suresh is on his way home, he is within the 5 miles range. Should be home soon!"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set suresh = states.device_tracker.suresh_suresh.state %}
|
||||
{% set mallika = states.device_tracker.mallika_mallika.state %}
|
||||
{% set srinika = states.device_tracker.srinika_srinika.state %}
|
||||
{% set hasika = states.device_tracker.hasika_hasika.state %}
|
||||
{% if suresh != "home" and mallika != "home" and srinika != "home" and hasika != "home" %}
|
||||
True
|
||||
{% else %}
|
||||
False
|
||||
{% endif %}
|
||||
- service: climate.set_away_mode
|
||||
data:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: 'false'
|
||||
- service: script.notify_me
|
||||
data_template:
|
||||
message: "Your Nest thermostat is set to HOME mode. Thank you!"
|
134
packages/zwave_batteries.yaml
Executable file
134
packages/zwave_batteries.yaml
Executable file
@@ -0,0 +1,134 @@
|
||||
###############################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 04/20/2018
|
||||
# @package : zwave batteries
|
||||
# @description : Zwave batteries using input_label & MQTT
|
||||
###############################################################################
|
||||
|
||||
input_label:
|
||||
aeotec_water_sensor:
|
||||
audio_detector:
|
||||
back_door_sensor:
|
||||
basement_door_sensor:
|
||||
downstairs_multi_sensor:
|
||||
front_door_sensor:
|
||||
front_room_multi_sensor:
|
||||
garage_door_sensor:
|
||||
guest_bedroom_multi_sensor:
|
||||
kitchen_motion_sensor:
|
||||
single_car_garage_door_tilt_sensor:
|
||||
stairs_motion_sensor:
|
||||
tv_multi_sensor:
|
||||
two_car_garage_door_tilt_sensor:
|
||||
upstairs_multi_sensor:
|
||||
wallmote:
|
||||
|
||||
suresh_battery:
|
||||
mallika_battery:
|
||||
srinika_battery:
|
||||
hasika_battery:
|
||||
suresh_wifi:
|
||||
mallika_wifi:
|
||||
srinika_wifi:
|
||||
hasika_wifi:
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
automation:
|
||||
- alias: Update ZWave Battery Levels
|
||||
initial_state: true
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: state_changed
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.entity_id is not none }}"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'zwave' }}"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.new_state.attributes is not none }}"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.new_state.attributes.battery_level | trim != '' }}"
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.new_state.attributes.battery_level | default(999) | int != 999 }}"
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: "input_label.{{- trigger.event.data.entity_id.split('.')[1] -}}"
|
||||
value: "{{ trigger.event.data.new_state.attributes.battery_level }}"
|
||||
- service: input_label.set_name
|
||||
data_template:
|
||||
entity_id: "input_label.{{- trigger.event.data.entity_id.split('.')[1] -}}"
|
||||
value: "{{ trigger.event.data.new_state.attributes.friendly_name }}'s Battery"
|
||||
- service: input_label.set_icon
|
||||
data_template:
|
||||
entity_id: "input_label.{{- trigger.event.data.entity_id.split('.')[1] -}}"
|
||||
value: >
|
||||
{% set battery_level = trigger.event.data.new_state.attributes.battery_level | int %}
|
||||
{% set battery_round = (battery_level / 10)|int * 10 %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
|
||||
- alias: Update Phone Battery Levels
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "owntracks/+/+"
|
||||
action:
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi"
|
||||
value: "{{ 'Yes' if trigger.payload_json.conn == 'w' else 'No' }}"
|
||||
- service: input_label.set_icon
|
||||
data_template:
|
||||
entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi"
|
||||
value: "{{ 'mdi:wifi' if trigger.payload_json.conn == 'w' else 'mdi:wifi-off' }}"
|
||||
- service: input_label.set_name
|
||||
data_template:
|
||||
entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi"
|
||||
value: "{{trigger.topic.split('/')[-1] | title }}'s phone wifi enabled?"
|
||||
|
||||
- service: input_label.set_value
|
||||
data_template:
|
||||
entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery"
|
||||
value: '{{ trigger.payload_json.batt | int }}'
|
||||
- service: input_label.set_name
|
||||
data_template:
|
||||
entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery"
|
||||
value: "{{trigger.topic.split('/')[-1] | title }}'s Battery"
|
||||
- service: input_label.set_icon
|
||||
data_template:
|
||||
entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery"
|
||||
value: >
|
||||
{% set battery_level = trigger.payload_json.batt | int %}
|
||||
{% set battery_round = (battery_level / 10)|int * 10 %}
|
||||
{% if trigger.payload_json.charging == 1 %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery-charging-100
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-charging-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if battery_round >= 100 %}
|
||||
mdi:battery
|
||||
{% elif battery_round > 0 %}
|
||||
mdi:battery-{{ battery_round }}
|
||||
{% else %}
|
||||
mdi:battery-alert
|
||||
{% endif %}
|
||||
{% endif %}
|
513
packages/zwave_sensors.yaml
Executable file
513
packages/zwave_sensors.yaml
Executable file
@@ -0,0 +1,513 @@
|
||||
#################################################################
|
||||
# @author : Mahasri Kalavala
|
||||
# @date : 09/18/17
|
||||
# @package : Z-Wave package
|
||||
# @description : Z-Wave Still and it's configuration stuff
|
||||
#
|
||||
# This entire page is auto generated by the script (link below):
|
||||
# https://github.com/skalavala/smarthome/blob/master/jinja_helpers/zwave_auto_gen.md
|
||||
#################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
|
||||
################################################
|
||||
## Node Anchors
|
||||
################################################
|
||||
|
||||
package.node_anchors:
|
||||
customize: &customize
|
||||
package: 'zwave_sensors'
|
||||
|
||||
exposed: &exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: true
|
||||
homebridge_hidden: false
|
||||
|
||||
not_exposed: ¬_exposed
|
||||
<<: *customize
|
||||
emulated_hue_hidden: false
|
||||
homebridge_hidden: true
|
||||
|
||||
hidden: &hidden
|
||||
<<: *customize
|
||||
hidden: true
|
||||
|
||||
not_hidden: ¬_hidden
|
||||
<<: *customize
|
||||
hidden: false
|
||||
|
||||
# ZWave Binary Sensors
|
||||
binary_sensor.aeotec_water_sensor_sensor:
|
||||
friendly_name: Aeotec Water Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.audio_detector_sensor:
|
||||
friendly_name: Audio Detector Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.back_door_sensor_sensor:
|
||||
friendly_name: Back Door Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.basement_door_sensor_sensor:
|
||||
friendly_name: Basement Door Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.downstairs_multi_sensor_sensor:
|
||||
friendly_name: Downstairs Multi Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.front_door_sensor_sensor:
|
||||
friendly_name: Front Door Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.front_room_multi_sensor_sensor:
|
||||
friendly_name: Front Room Multi Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.garage_door_sensor_sensor:
|
||||
friendly_name: Garage Door Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.guest_bedroom_multi_sensor_sensor:
|
||||
friendly_name: Guest Bedroom Multi Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.kitchen_motion_sensor_sensor:
|
||||
friendly_name: Kitchen Motion Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.single_car_garage_door_tilt_sensor_sensor:
|
||||
friendly_name: Single Car Garage Door
|
||||
<<: *not_exposed
|
||||
binary_sensor.stairs_motion_sensor_sensor:
|
||||
friendly_name: Stairs Motion Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.tv_multi_sensor_sensor:
|
||||
friendly_name: TV Multi Sensor
|
||||
<<: *not_exposed
|
||||
binary_sensor.two_car_garage_door_tilt_sensor_sensor:
|
||||
friendly_name: Double Car Garage Door
|
||||
<<: *not_exposed
|
||||
binary_sensor.upstairs_multi_sensor_sensor:
|
||||
friendly_name: Upstairs Multi Sensor
|
||||
<<: *not_exposed
|
||||
|
||||
# ZWave Sensors
|
||||
sensor.aeotec_water_sensor_alarm_level:
|
||||
friendly_name: Aeotec Water Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_alarm_level_2:
|
||||
friendly_name: Aeotec Water Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_alarm_level_3:
|
||||
friendly_name: Aeotec Water Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_alarm_type:
|
||||
friendly_name: Aeotec Water Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_alarm_type_2:
|
||||
friendly_name: Aeotec Water Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_alarm_type_3:
|
||||
friendly_name: Aeotec Water Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_burglar:
|
||||
friendly_name: Aeotec Water Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_flood:
|
||||
friendly_name: Aeotec Water Sensor Flood
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_flood_2:
|
||||
friendly_name: Aeotec Water Sensor Flood
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_flood_3:
|
||||
friendly_name: Aeotec Water Sensor Flood
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_heat:
|
||||
friendly_name: Aeotec Water Sensor Heat
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_sourcenodeid:
|
||||
friendly_name: Aeotec Water Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_sourcenodeid_2:
|
||||
friendly_name: Aeotec Water Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_sourcenodeid_3:
|
||||
friendly_name: Aeotec Water Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.aeotec_water_sensor_temperature:
|
||||
friendly_name: Aeotec Water Sensor Temperature
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_alarm_level:
|
||||
friendly_name: Audio Detector Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_alarm_type:
|
||||
friendly_name: Audio Detector Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_burglar:
|
||||
friendly_name: Audio Detector Burglar
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_carbon_monoxide:
|
||||
friendly_name: Audio Detector Carbon Monoxide
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_power_management:
|
||||
friendly_name: Audio Detector Power Management
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_smoke:
|
||||
friendly_name: Audio Detector Smoke
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_sourcenodeid:
|
||||
friendly_name: Audio Detector SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.audio_detector_temperature:
|
||||
friendly_name: Audio Detector Temperature
|
||||
<<: *not_exposed
|
||||
sensor.back_door_sensor_access_control:
|
||||
friendly_name: Back Door Sensor Access Control
|
||||
<<: *not_exposed
|
||||
sensor.back_door_sensor_alarm_level:
|
||||
friendly_name: Back Door Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.back_door_sensor_alarm_type:
|
||||
friendly_name: Back Door Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.back_door_sensor_burglar:
|
||||
friendly_name: Back Door Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.back_door_sensor_power_management:
|
||||
friendly_name: Back Door Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.back_door_sensor_sourcenodeid:
|
||||
friendly_name: Back Door Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.basement_door_sensor_access_control:
|
||||
friendly_name: Basement Door Sensor Access Control
|
||||
<<: *not_exposed
|
||||
sensor.basement_door_sensor_alarm_level:
|
||||
friendly_name: Basement Door Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.basement_door_sensor_alarm_type:
|
||||
friendly_name: Basement Door Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.basement_door_sensor_burglar:
|
||||
friendly_name: Basement Door Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.basement_door_sensor_power_management:
|
||||
friendly_name: Basement Door Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.basement_door_sensor_sourcenodeid:
|
||||
friendly_name: Basement Door Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_alarm_level:
|
||||
friendly_name: Downstairs Multi Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_alarm_type:
|
||||
friendly_name: Downstairs Multi Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_burglar:
|
||||
friendly_name: Downstairs Multi Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_luminance:
|
||||
friendly_name: Downstairs Multi Sensor Luminance
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_power:
|
||||
friendly_name: Downstairs Multi Sensor Power
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_relative_humidity:
|
||||
friendly_name: Downstairs Multi Sensor Relative Humidity
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_sourcenodeid:
|
||||
friendly_name: Downstairs Multi Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.downstairs_multi_sensor_temperature:
|
||||
friendly_name: Downstairs Multi Sensor Temperature
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_alarm_level:
|
||||
friendly_name: Front Room Multi Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_alarm_type:
|
||||
friendly_name: Front Room Multi Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_burglar:
|
||||
friendly_name: Front Room Multi Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_luminance:
|
||||
friendly_name: Front Room Multi Sensor Luminance
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_relative_humidity:
|
||||
friendly_name: Front Room Multi Sensor Relative Humidity
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_sourcenodeid:
|
||||
friendly_name: Front Room Multi Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_temperature:
|
||||
friendly_name: Front Room Multi Sensor Temperature
|
||||
<<: *not_exposed
|
||||
sensor.front_room_multi_sensor_ultraviolet:
|
||||
friendly_name: Front Room Multi Sensor Ultraviolet
|
||||
<<: *not_exposed
|
||||
sensor.garage_door_sensor_access_control:
|
||||
friendly_name: Garage Door Sensor Access Control
|
||||
<<: *not_exposed
|
||||
sensor.garage_door_sensor_alarm_level:
|
||||
friendly_name: Garage Door Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.garage_door_sensor_alarm_type:
|
||||
friendly_name: Garage Door Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.garage_door_sensor_burglar:
|
||||
friendly_name: Garage Door Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.garage_door_sensor_power_management:
|
||||
friendly_name: Garage Door Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.garage_door_sensor_sourcenodeid:
|
||||
friendly_name: Garage Door Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_sensor_status:
|
||||
friendly_name: Single Car Garage Door Sensor Status
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_sensor_status:
|
||||
friendly_name: Double Car Garage Door Sensor Status
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_alarm_level:
|
||||
friendly_name: Guest Bedroom Multi Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_alarm_type:
|
||||
friendly_name: Guest Bedroom Multi Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_burglar:
|
||||
friendly_name: Guest Bedroom Multi Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_luminance:
|
||||
friendly_name: Guest Bedroom Multi Sensor Luminance
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_relative_humidity:
|
||||
friendly_name: Guest Bedroom Multi Sensor Relative Humidity
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_sourcenodeid:
|
||||
friendly_name: Guest Bedroom Multi Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_temperature:
|
||||
friendly_name: Guest Bedroom Multi Sensor Temperature
|
||||
<<: *not_exposed
|
||||
sensor.guest_bedroom_multi_sensor_ultraviolet:
|
||||
friendly_name: Guest Bedroom Multi Sensor Ultraviolet
|
||||
<<: *not_exposed
|
||||
sensor.kitchen_motion_sensor_alarm_level:
|
||||
friendly_name: Kitchen Motion Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.kitchen_motion_sensor_alarm_type:
|
||||
friendly_name: Kitchen Motion Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.kitchen_motion_sensor_burglar:
|
||||
friendly_name: Kitchen Motion Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.kitchen_motion_sensor_power_management:
|
||||
friendly_name: Kitchen Motion Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.kitchen_motion_sensor_sourcenodeid:
|
||||
friendly_name: Kitchen Motion Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_tilt_sensor_access_control:
|
||||
friendly_name: Single Car Garage Door Tilt Sensor Access Control
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_tilt_sensor_alarm_level:
|
||||
friendly_name: Single Car Garage Door Tilt Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_tilt_sensor_alarm_type:
|
||||
friendly_name: Single Car Garage Door Tilt Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_tilt_sensor_burglar:
|
||||
friendly_name: Single Car Garage Door Tilt Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_tilt_sensor_power_management:
|
||||
friendly_name: Single Car Garage Door Tilt Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.single_car_garage_door_tilt_sensor_sourcenodeid:
|
||||
friendly_name: Single Car Garage Door Tilt Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.stairs_motion_sensor_alarm_level:
|
||||
friendly_name: Stairs Motion Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.stairs_motion_sensor_alarm_type:
|
||||
friendly_name: Stairs Motion Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.stairs_motion_sensor_burglar:
|
||||
friendly_name: Stairs Motion Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.stairs_motion_sensor_power_management:
|
||||
friendly_name: Stairs Motion Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.stairs_motion_sensor_sourcenodeid:
|
||||
friendly_name: Stairs Motion Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_alarm_level:
|
||||
friendly_name: TV Multi Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_alarm_type:
|
||||
friendly_name: TV Multi Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_burglar:
|
||||
friendly_name: TV Multi Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_luminance:
|
||||
friendly_name: TV Multi Sensor Luminance
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_relative_humidity:
|
||||
friendly_name: TV Multi Sensor Relative Humidity
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_sourcenodeid:
|
||||
friendly_name: TV Multi Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_temperature:
|
||||
friendly_name: TV Multi Sensor Temperature
|
||||
<<: *not_exposed
|
||||
sensor.tv_multi_sensor_ultraviolet:
|
||||
friendly_name: TV Multi Sensor Ultraviolet
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_tilt_sensor_access_control:
|
||||
friendly_name: Two Car Garage Door Tilt Sensor Access Control
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_tilt_sensor_alarm_level:
|
||||
friendly_name: Two Car Garage Door Tilt Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_tilt_sensor_alarm_type:
|
||||
friendly_name: Two Car Garage Door Tilt Sensor Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_tilt_sensor_burglar:
|
||||
friendly_name: Two Car Garage Door Tilt Sensor Burglar
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_tilt_sensor_power_management:
|
||||
friendly_name: Two Car Garage Door Tilt Sensor Power Management
|
||||
<<: *not_exposed
|
||||
sensor.two_car_garage_door_tilt_sensor_sourcenodeid:
|
||||
friendly_name: Two Car Garage Door Tilt Sensor SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.upstairs_multi_sensor_alarm_level:
|
||||
friendly_name: Upstairs Multi Sensor Alarm Level
|
||||
<<: *not_exposed
|
||||
sensor.upstairs_multi_sensor_alarm_type:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor Alarm Type
|
||||
sensor.upstairs_multi_sensor_burglar:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor Burglar
|
||||
sensor.upstairs_multi_sensor_luminance:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor Luminance
|
||||
sensor.upstairs_multi_sensor_relative_humidity:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor Relative Humidity
|
||||
sensor.upstairs_multi_sensor_sourcenodeid:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor SourceNodeId
|
||||
sensor.upstairs_multi_sensor_temperature:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor Temperature
|
||||
sensor.upstairs_multi_sensor_ultraviolet:
|
||||
<<: *not_exposed
|
||||
friendly_name: Upstairs Multi Sensor Ultraviolet
|
||||
sensor.wallmote_alarm_level:
|
||||
<<: *not_exposed
|
||||
friendly_name: Wallmote Alarm Level
|
||||
sensor.wallmote_alarm_type:
|
||||
friendly_name: Wallmote Alarm Type
|
||||
<<: *not_exposed
|
||||
sensor.wallmote_power_management:
|
||||
friendly_name: Wallmote Power Management
|
||||
<<: *not_exposed
|
||||
sensor.wallmote_sourcenodeid:
|
||||
friendly_name: Wallmote SourceNodeId
|
||||
<<: *not_exposed
|
||||
sensor.zwave_smart_switch_current:
|
||||
friendly_name: ZWave Smart Switch Current
|
||||
<<: *not_exposed
|
||||
sensor.zwave_smart_switch_energy:
|
||||
friendly_name: ZWave Smart Switch Energy
|
||||
<<: *not_exposed
|
||||
sensor.zwave_smart_switch_power:
|
||||
friendly_name: ZWave Smart Switch Power
|
||||
<<: *not_exposed
|
||||
sensor.zwave_smart_switch_previous_reading:
|
||||
friendly_name: ZWave Smart Switch Previous Reading
|
||||
<<: *not_exposed
|
||||
sensor.zwave_smart_switch_voltage:
|
||||
friendly_name: ZWave Smart Switch Voltage
|
||||
<<: *not_exposed
|
||||
|
||||
# ZWave Switches
|
||||
|
||||
switch.kitchen_siren_switch:
|
||||
friendly_name: Kitchen Siren Switch 1
|
||||
<<: *not_exposed
|
||||
switch.kitchen_siren_switch_2:
|
||||
friendly_name: Kitchen Siren Switch 2
|
||||
<<: *not_exposed
|
||||
switch.kitchen_siren_switch_3:
|
||||
friendly_name: Kitchen Siren Switch 3
|
||||
<<: *not_exposed
|
||||
switch.kitchen_siren_switch_4:
|
||||
friendly_name: Kitchen Siren Switch 4
|
||||
<<: *not_exposed
|
||||
switch.kitchen_siren_switch_5:
|
||||
friendly_name: Kitchen Siren Switch 5
|
||||
<<: *not_exposed
|
||||
switch.wallmote_switch:
|
||||
friendly_name: Wallmote Switch
|
||||
<<: *not_exposed
|
||||
|
||||
zwave:
|
||||
usb_path: /dev/ttyACM0
|
||||
network_key: !secret zwave_network_key
|
||||
|
||||
###############################################################################
|
||||
# _ _ _
|
||||
# /\ | | | | (_)
|
||||
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
||||
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
||||
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
||||
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
||||
#
|
||||
###############################################################################
|
||||
automation:
|
||||
|
||||
- alias: WallMote Button 1 Pressed
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zwave.scene_activated
|
||||
event_data:
|
||||
entity_id: zwave.wallmote
|
||||
scene_id: 1
|
||||
action:
|
||||
- service: light.toggle
|
||||
entity_id: light.master_bedroom
|
||||
|
||||
- alias: WallMote Button 2 Pressed
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zwave.scene_activated
|
||||
event_data:
|
||||
entity_id: zwave.wallmote
|
||||
scene_id: 2
|
||||
action:
|
||||
- service: homeassistant.turn_off
|
||||
entity_id: group.upstairs_lights
|
||||
|
||||
- alias: WallMote Button 3 Pressed
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zwave.scene_activated
|
||||
event_data:
|
||||
entity_id: zwave.wallmote
|
||||
scene_id: 3
|
||||
action:
|
||||
- service: climate.set_away_mode
|
||||
data_template:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: 'false'
|
||||
|
||||
- alias: WallMote Button 4 Pressed
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zwave.scene_activated
|
||||
event_data:
|
||||
entity_id: zwave.wallmote
|
||||
scene_id: 4
|
||||
action:
|
||||
- service: climate.set_away_mode
|
||||
data_template:
|
||||
entity_id: climate.dining_room
|
||||
away_mode: 'true'
|
Reference in New Issue
Block a user