Alexa timer flashes lights wherever you are!

Dawned on me the other day that you can do this! So here it is in case anyone will facepalm realizing it like I did.
This uses IFTTT, an input Boolean, input_ select, and a couple automations keeping track of the last motion scene and matching that to the Boolean that IFTTT triggers. This was thrown together in about a half hour so I’m sure it could be improved a little, I’d like to prevent the input select from updating every time I pass a sensor for example.

First you need to make an IFTTT skill:
IF an alexa timer goes off, THEN (webhooks)

URL: http://IPADDRESS/api/services/input_boolean/turn_on?api_password=PASSWORD
Method: POST
Content Type: application/json
Body: {“entity_id”:“input_boolean.alexa_alarm”}

Input Boolean:

alexa_alarm:
name: Alexa Alarm
initial: off

Input Select:

last_room_with_motion:
  name: Last Room With Motion
  options:
    - Livingroom
    - Kitchen
    - Master Bedroom
    - Master Bathroom
    - Unknown
  initial: Unknown

Automation - Last Room With Motion:

- alias: Last Room With Motion - Livingroom
  trigger:
    - platform: state
      entity_id: sensor.sn2_livingroom_bar_pir
      to: 'motion detected'
    - platform: state
      entity_id: sensor.sn5_livingroom_couch_pir
      to: 'motion detected'
  condition:
    - condition: template
      value_template: '{{ states.input_select.last_room_with_motion.state != "Livingroom" }}'
  action:
    - service: input_select.select_option
      entity_id: input_select.last_room_with_motion
      data:
        option: 'Livingroom'

- alias: Last Room With Motion - Kitchen
  trigger:
    - platform: state
      entity_id: sensor.sn3_kitchen_pir
      to: 'motion detected'
  condition:
    - condition: template
      value_template: '{{ states.input_select.last_room_with_motion.state != "Kitchen" }}'
  action:
    - service: input_select.select_option
      entity_id: input_select.last_room_with_motion
      data:
        option: 'Kitchen'

- alias: Last Room With Motion - Master Bedroom
  trigger:
    - platform: state
      entity_id: sensor.sn1_bedroom_pir
      to: 'motion detected'
  condition:
    - condition: template
      value_template: '{{ states.input_select.last_room_with_motion.state != "Master Bedroom" }}'
  action:
    - service: input_select.select_option
      entity_id: input_select.last_room_with_motion
      data:
        option: 'Master Bedroom'

- alias: Last Room With Motion - Master Bathroom
  trigger:
    - platform: state
      entity_id: sensor.sn4_master_bathroom_pir
      to: 'motion detected'
  condition:
    - condition: template
      value_template: '{{ states.input_select.last_room_with_motion.state != "Master Bathroom" }}'
  action:
    - service: input_select.select_option
      entity_id: input_select.last_room_with_motion
      data:
        option: 'Master Bathroom'

Automation - Alexa Alarm:

- alias: Alexa Alarm - Livingroom
  trigger:
    - platform: state
      entity_id: input_boolean.alexa_alarm
      to: 'on'
  condition:
    - condition: state
      entity_id: input_select.last_room_with_motion
      state: 'Livingroom'
  action:
    - service: light.turn_on
      entity_id: light.bar_light
      data:
        transition: 1
        flash: long
    - service: input_boolean.turn_off
      entity_id: input_boolean.alexa_alarm

- alias: Alexa Alarm - Kitchen
  trigger:
    - platform: state
      entity_id: input_boolean.alexa_alarm
      to: 'on'
  condition:
    - condition: state
      entity_id: input_select.last_room_with_motion
      state: 'Kitchen'
  action:
    - service: light.turn_on
      entity_id: light.sink_light
      data:
        transition: 1
        flash: long
    - service: input_boolean.turn_off
      entity_id: input_boolean.alexa_alarm

- alias: Alexa Alarm - Master Bedroom
  trigger:
    - platform: state
      entity_id: input_boolean.alexa_alarm
      to: 'on'
  condition:
    - condition: state
      entity_id: input_select.last_room_with_motion
      state: 'Master Bedroom'
  action:
    - service: light.turn_on
      entity_id: light.bedroom_lamps
      data:
        transition: 1
        flash: long
    - service: input_boolean.turn_off
      entity_id: input_boolean.alexa_alarm

- alias: Alexa Alarm - Master Bathroom
  trigger:
    - platform: state
      entity_id: input_boolean.alexa_alarm
      to: 'on'
  condition:
    - condition: state
      entity_id: input_select.last_room_with_motion
      state: 'Master Bathroom'
  action:
    - service: light.turn_on
      entity_id: light.bathroom_light
      data:
        transition: 1
        flash: long
    - service: input_boolean.turn_off
      entity_id: input_boolean.alexa_alarm

It’s been working great so far! Sometimes IFTTT can be a little buggy or slow but it’s not like we have much choice right now.

5 Likes

Love this! Perfect timing as well with the release of all the new Amazon Echo products… :slight_smile:

I know just saw those! Like the idea of the alarm clock though $130 is a little high for me right now.