2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
# @author : Mahasri Kalavala
|
|
|
|
# @date : 09/20/2018
|
|
|
|
# @package : xiaomi_magic_cubes
|
|
|
|
# @description : Xiaomi Aqara Magic Cube Automations
|
|
|
|
###############################################################################
|
|
|
|
|
2020-03-15 23:42:44 +00:00
|
|
|
###############################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
# XIAOMI AQARA MAGIC CUBE AUTOMATIONS #
|
|
|
|
# http://patorjk.com/software/taag/#p=display&h=2&v=2&f=Big&t=Test #
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
automation:
|
2020-02-05 23:28:38 +00:00
|
|
|
################################################################################
|
|
|
|
# ______ _ _ _____
|
|
|
|
# | ____| (_) | | __ \
|
|
|
|
# | |__ __ _ _ __ ___ _| |_ _ | |__) |___ ___ _ __ ___
|
|
|
|
# | __/ _` | '_ ` _ \| | | | | | | _ // _ \ / _ \| '_ ` _ \
|
|
|
|
# | | | (_| | | | | | | | | |_| | | | \ \ (_) | (_) | | | | | |
|
|
|
|
# |_| \__,_|_| |_| |_|_|_|\__, | |_| \_\___/ \___/|_| |_| |_|
|
|
|
|
# __/ |
|
|
|
|
# |___/
|
2020-03-15 23:42:44 +00:00
|
|
|
################################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service_template: light.toggle
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.hue_color_lamp_1, light.hue_color_lamp_2, light.hue_color_lamp_3
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.hue_color_lamp_1, light.hue_color_lamp_2, light.hue_color_lamp_3
|
2019-04-17 22:46:06 +00:00
|
|
|
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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: switch.toggle
|
2022-11-30 00:50:52 +00:00
|
|
|
entity_id: switch.kitchen_switch
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.hue_color_lamp_1, light.hue_color_lamp_2, light.hue_color_lamp_3
|
2019-04-17 22:46:06 +00:00
|
|
|
rgb_color:
|
2020-02-05 23:28:38 +00:00
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- "{{ range(0,255) |random }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: script.toggle_do_not_disturb
|
|
|
|
|
2020-02-05 23:28:38 +00:00
|
|
|
################################################################################
|
|
|
|
# ______ _ _____
|
|
|
|
# | ____| | | | __ \
|
|
|
|
# | |__ _ __ ___ _ __ | |_ | |__) |___ ___ _ __ ___
|
|
|
|
# | __| '__/ _ \| '_ \| __| | _ // _ \ / _ \| '_ ` _ \
|
|
|
|
# | | | | | (_) | | | | |_ | | \ \ (_) | (_) | | | | | |
|
|
|
|
# |_| |_| \___/|_| |_|\__| |_| \_\___/ \___/|_| |_| |_|
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2020-02-05 23:28:38 +00:00
|
|
|
entity_id: switch.front_room
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# Move: Toggle Office Room Light
|
2020-09-05 02:12:14 +00:00
|
|
|
- alias: Front Room Cube Event Move
|
2019-04-17 22:46:06 +00:00
|
|
|
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
|
2021-03-22 01:56:34 +00:00
|
|
|
- service: switch.toggle
|
|
|
|
entity_id: switch.left
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# Shake: Toggle Do Not Disturb Mode
|
2020-09-05 02:12:14 +00:00
|
|
|
- alias: Front Room Cube Event Shake
|
2019-04-17 22:46:06 +00:00
|
|
|
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
|
|
|
|
|
2020-02-05 23:28:38 +00:00
|
|
|
###############################################################################
|
|
|
|
# _____ _ _ _ _ _____
|
|
|
|
# / ____| (_) (_) | ( ) | __ \
|
|
|
|
# | (___ _ __ _ _ __ _| | ____ _|/ ___ | |__) |___ ___ _ __ ___
|
|
|
|
# \___ \| '__| | '_ \| | |/ / _` | / __| | _ // _ \ / _ \| '_ ` _ \
|
|
|
|
# ____) | | | | | | | | < (_| | \__ \ | | \ \ (_) | (_) | | | | | |
|
|
|
|
# |_____/|_| |_|_| |_|_|_|\_\__,_| |___/ |_| \_\___/ \___/|_| |_| |_|
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service_template: switch.toggle
|
2022-11-30 00:50:52 +00:00
|
|
|
entity_id: switch.srinika_bedroom
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: script.toggle_do_not_disturb
|
|
|
|
|
2020-02-05 23:28:38 +00:00
|
|
|
##############################################################################
|
|
|
|
# _ _ _ _ _ _____
|
|
|
|
# | | | | (_) | ( ) | __ \
|
|
|
|
# | |__| | __ _ ___ _| | ____ _|/ ___ | |__) |___ ___ _ __ ___
|
|
|
|
# | __ |/ _` / __| | |/ / _` | / __| | _ // _ \ / _ \| '_ ` _ \
|
|
|
|
# | | | | (_| \__ \ | < (_| | \__ \ | | \ \ (_) | (_) | | | | | |
|
|
|
|
# |_| |_|\__,_|___/_|_|\_\__,_| |___/ |_| \_\___/ \___/|_| |_| |_|
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service_template: switch.toggle
|
2022-11-30 00:50:52 +00:00
|
|
|
entity_id: switch.hasika_bedroom
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: script.toggle_do_not_disturb
|
|
|
|
|
2020-02-05 23:28:38 +00:00
|
|
|
################################################################################
|
|
|
|
# _____ _ _ _____
|
|
|
|
# / ____| | | | | __ \
|
|
|
|
# | (___ | |_ _ _ __| |_ _ | |__) |___ ___ _ __ ___
|
|
|
|
# \___ \| __| | | |/ _` | | | | | _ // _ \ / _ \| '_ ` _ \
|
|
|
|
# ____) | |_| |_| | (_| | |_| | | | \ \ (_) | (_) | | | | | |
|
|
|
|
# |_____/ \__|\__,_|\__,_|\__, | |_| \_\___/ \___/|_| |_| |_|
|
|
|
|
# __/ |
|
|
|
|
# |___/
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: switch.toggle
|
2022-11-30 00:50:52 +00:00
|
|
|
entity_id: switch.study_room
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: script.toggle_do_not_disturb
|
|
|
|
|
2020-02-05 23:28:38 +00:00
|
|
|
################################################################################
|
|
|
|
# __ __ _ ____ _
|
|
|
|
# | \/ | | | | _ \ | |
|
|
|
|
# | \ / | __ _ ___| |_ ___ _ __ | |_) | ___ __| |_ __ ___ ___ _ __ ___
|
|
|
|
# | |\/| |/ _` / __| __/ _ \ '__| | _ < / _ \/ _` | '__/ _ \ / _ \| '_ ` _ \
|
|
|
|
# | | | | (_| \__ \ || __/ | | |_) | __/ (_| | | | (_) | (_) | | | | | |
|
|
|
|
# |_| |_|\__,_|___/\__\___|_| |____/ \___|\__,_|_| \___/ \___/|_| |_| |_|
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: homeassistant.turn_off
|
2022-11-30 00:50:52 +00:00
|
|
|
data:
|
|
|
|
entity_id: group.downstairs_lights
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: homeassistant.turn_off
|
2022-11-30 00:50:52 +00:00
|
|
|
data:
|
|
|
|
entity_id: group.upstairs_lights
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.toggle
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.master_bedroom_1
|
|
|
|
- service: light.toggle
|
|
|
|
entity_id: light.master_bedroom_2
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.master_bedroom_1
|
|
|
|
- service: light.turn_on
|
|
|
|
entity_id: light.master_bedroom_2
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.master_bedroom_1
|
|
|
|
rgb_color:
|
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- service: light.turn_on
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2020-09-05 02:12:14 +00:00
|
|
|
entity_id: light.master_bedroom_2
|
2019-04-17 22:46:06 +00:00
|
|
|
rgb_color:
|
2020-02-05 23:28:38 +00:00
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- "{{ range(0,255) |random }}"
|
|
|
|
- "{{ range(0,255) |random }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
# 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
|
2021-01-10 20:03:52 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: script.toggle_do_not_disturb
|
2020-03-15 15:54:29 +00:00
|
|
|
|
2020-03-15 23:42:44 +00:00
|
|
|
################################################################################
|
|
|
|
# _____ _ _ _
|
|
|
|
# | __ \ | | | | |
|
|
|
|
# | | | | ___ ___ _ __| |__ ___| | |
|
|
|
|
# | | | |/ _ \ / _ \| '__| '_ \ / _ \ | |
|
|
|
|
# | |__| | (_) | (_) | | | |_) | __/ | |
|
|
|
|
# |_____/ \___/ \___/|_| |_.__/ \___|_|_|
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2020-03-15 15:54:29 +00:00
|
|
|
################################################################################
|
|
|
|
# Doorbell Automations -
|
|
|
|
# When we are home, play the door bell
|
|
|
|
# When we are not home, play dog sounds
|
|
|
|
################################################################################
|
|
|
|
- alias: Doorbell Single Press
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: event
|
|
|
|
event_type: xiaomi_aqara.click
|
|
|
|
event_data:
|
|
|
|
entity_id: binary_sensor.wall_switch_158d00045622d9
|
2020-03-15 23:42:44 +00:00
|
|
|
click_type: "single"
|
|
|
|
action:
|
|
|
|
- service_template: >
|
|
|
|
{% if states('input_boolean.home_mode_away') == 'off' %}
|
|
|
|
script.play_ringtone
|
|
|
|
{% else %}
|
|
|
|
script.play_dog_sounds
|
|
|
|
{% endif %}
|
2022-11-30 00:50:52 +00:00
|
|
|
- service: script.doorbell_camera_pics
|
2020-03-15 23:42:44 +00:00
|
|
|
|
|
|
|
- alias: Doorbell Double Press
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: event
|
|
|
|
event_type: xiaomi_aqara.click
|
|
|
|
event_data:
|
|
|
|
entity_id: binary_sensor.wall_switch_158d00045622d9
|
|
|
|
click_type: "double"
|
|
|
|
action:
|
|
|
|
- service_template: >
|
|
|
|
{% if states('input_boolean.home_mode_away') == 'off' %}
|
|
|
|
script.play_ringtone
|
|
|
|
{% else %}
|
|
|
|
script.play_dog_sounds
|
|
|
|
{% endif %}
|
2022-11-30 00:50:52 +00:00
|
|
|
- service: script.doorbell_camera_pics
|
2020-03-15 23:42:44 +00:00
|
|
|
|
|
|
|
- alias: Doorbell Long Press
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: event
|
|
|
|
event_type: xiaomi_aqara.click
|
|
|
|
event_data:
|
|
|
|
entity_id: binary_sensor.wall_switch_158d00045622d9
|
|
|
|
click_type: "long"
|
2020-03-15 15:54:29 +00:00
|
|
|
action:
|
|
|
|
- service_template: >
|
|
|
|
{% if states('input_boolean.home_mode_away') == 'off' %}
|
2020-04-12 17:48:04 +00:00
|
|
|
script.play_fav_song
|
2020-03-15 15:54:29 +00:00
|
|
|
{% else %}
|
|
|
|
script.play_dog_sounds
|
|
|
|
{% endif %}
|
2022-11-30 00:50:52 +00:00
|
|
|
- service: script.doorbell_camera_pics
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Script for sending camera snapshots when doorbell is pressed
|
|
|
|
################################################################################
|
|
|
|
script:
|
|
|
|
|
|
|
|
doorbell_camera_pics:
|
|
|
|
sequence:
|
2022-12-03 16:28:12 +00:00
|
|
|
- service: script.notify_family
|
2022-11-30 00:50:52 +00:00
|
|
|
data:
|
|
|
|
message: "ALERT! Someone is at the front door!"
|
2022-12-03 16:28:12 +00:00
|
|
|
notify_options:
|
|
|
|
- telegram
|
|
|
|
- voice
|
|
|
|
- tv
|
|
|
|
- led
|
2022-11-30 00:50:52 +00:00
|
|
|
- service: camera.snapshot
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2022-11-30 00:50:52 +00:00
|
|
|
entity_id: "camera.frontdoor_camera"
|
|
|
|
filename:
|
|
|
|
"{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
|
|
|
(state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
- service: camera.snapshot
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2022-11-30 00:50:52 +00:00
|
|
|
entity_id: "camera.driveway_camera"
|
|
|
|
filename:
|
|
|
|
"{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
|
|
|
(state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_')
|
2022-12-03 16:28:12 +00:00
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2022-11-30 00:50:52 +00:00
|
|
|
- service: notify.telegram
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2022-11-30 00:50:52 +00:00
|
|
|
title: "Door Bell"
|
|
|
|
message: "Someone rang door bell!"
|
|
|
|
data:
|
|
|
|
photo:
|
|
|
|
- file: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
|
|
|
(state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Someone rang door bell!"
|
|
|
|
- file: "{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
|
|
|
(state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2022-12-03 16:28:12 +00:00
|
|
|
caption: "Someone rang door bell!"
|
|
|
|
- service: script.notify_family
|
2022-12-05 00:02:34 +00:00
|
|
|
data:
|
2022-12-03 16:28:12 +00:00
|
|
|
message: Someone rang door bell!
|
|
|
|
url: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
|
|
|
(state_attr('script.doorbell_camera_pics', 'last_triggered') ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
notify_options:
|
|
|
|
- tv
|
|
|
|
- led
|