mysmarthome/packages/xiaomi_magic_cubes.yaml

473 lines
15 KiB
YAML
Raw Normal View History

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
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
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
action:
- service: light.turn_on
data_template:
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
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
action:
- service: switch.toggle
entity_id: switch.office_room
# 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
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 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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
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
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
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
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
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
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
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
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
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
condition:
- condition: state
entity_id: input_boolean.light_automations
state: "on"
2019-04-17 22:46:06 +00:00
action:
- service: light.turn_on
data_template:
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
data_template:
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
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 %}
- 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 %}
- 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 %}