Skip to content

Instantly share code, notes, and snippets.

@runningman84
Created July 23, 2017 10:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runningman84/fab56adcc893350e947ff3c7de5fc792 to your computer and use it in GitHub Desktop.
Save runningman84/fab56adcc893350e947ff3c7de5fc792 to your computer and use it in GitHub Desktop.
xiaomi alarm automations
start_flashing_color_light:
alias: "Start color light flashing"
sequence:
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- condition: state
entity_id: input_boolean.block_flashing_color_light
state: 'off'
- service: light.turn_on
entity_id: light.gateway_light_f0b429cc30b1
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
- delay:
milliseconds: 250
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- service: script.repeat_flashing_color_light
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
repeat_flashing_color_light:
alias: "Repeat color light flashing"
sequence:
- delay:
# supports seconds, milliseconds, minutes, hours
milliseconds: 250
- service: script.start_flashing_color_light
data_template:
color_name: >
{% if color_name %}
{{color_name}}
{% else %}
red
{% endif %}
stop_flashing_color_light:
alias: "Stop color light flashing"
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.block_flashing_color_light
- service: script.turn_off
entity_id: script.start_flashing_color_light
- service: script.turn_off
entity_id: script.repeat_flashing_color_light
- service: light.turn_off
entity_id: light.gateway_light_f0b429cc30b1
- delay:
# supports seconds, milliseconds, minutes, hours
seconds: 5
- service: input_boolean.turn_off
entity_id: input_boolean.block_flashing_color_light
start_alarm_siren:
alias: "Start alarm siren"
sequence:
- condition: state
entity_id: input_boolean.block_alarm_siren
state: 'off'
- service: xiaomi.play_ringtone
data:
ringtone_id: 2
ringtone_vol: 1
gw_sid: !secret xiaomi_sid
- delay:
seconds: 5
- service: script.turn_on
data:
entity_id: script.repeat_alarm_siren
repeat_alarm_siren:
alias: "Repeat alarm siren"
sequence:
- delay:
# supports seconds, milliseconds, minutes, hours
milliseconds: 250
- service: script.turn_on
data:
entity_id: script.start_alarm_siren
stop_alarm_siren:
alias: "Stop alarm siren"
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.block_alarm_siren
- service: script.turn_off
data:
entity_id: script.start_alarm_siren
- service: script.turn_off
data:
entity_id: script.repeat_alarm_siren
- delay:
# supports seconds, milliseconds, minutes, hours
seconds: 60
- service: input_boolean.turn_off
entity_id: script.block_alarm_siren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment