Automation and Alexa ask question to user possible?

yes

read this

I have if no motion in office after 5 mins
alexa: ask is there some in the office
if I dont answer her she turn light off
if I answer yes light stay on and then she tell to stop hearing this turn the light switch ON

  - alias: "Alexa: Is there some in the Office"
    trigger:
      - platform: state
        entity_id: input_boolean.someone_in_room_1
        to: 'off'
        for:
          minutes: 5
    condition:
      - condition: state
        entity_id: sensor.office_switch
        state:  "OFF"
    action:
      - service: script.activate_alexa_actionable_notification
        data_template:
          text: 'Is anyone in the Office ?'
          event_id: alexa_notification_office_occupied
          alexa_device: 'media_player.office_dot'

if I answer YES

  - alias: Yes response for alexa_notification_bedroom_occupied question 
    trigger:
      platform: event
      event_type: alexa_actionable_notification
      event_data:
        event_id: alexa_notification_office_occupied
        event_response_type: ResponseYes
    action:
    - data:
        entity_id: input_boolean.someone_in_room_1
      service:  input_boolean.turn_on
    - delay: 00:00:01 
    - data:
        entity_id: input_boolean.someone_in_room_1
      service: input_boolean.turn_off
    - service: notify.alexa_media
      data_template:
        target: 
          - '{{ states.sensor.last_alexa.state }}'
        message: "If you want to stop hereing this message turn the wall switch on."
        data:
          type: announce
          method: all 

NO one answers

  - alias: None response for alexa_notification_bedroom_occupied question 
    trigger:
      platform: event
      event_type: alexa_actionable_notification
      event_data:
        event_id: alexa_notification_office_occupied
        event_response_type: ResponseNone
    action:
      - data:
          entity_id: light.office
        service: light.turn_off

and heres the script

#=======================================================================
#
#=======================================================================
activate_alexa_actionable_notification:
  description: Activates an actionable notification on a specific echo device
  fields:
    text:
      description: The text you would like alexa to speak.
      example: What would you like the thermostat set to?
    event_id:
      description: Correlation ID for event responses
      example: ask_for_temperature
    alexa_device:
      description: Alexa device you want to trigger
      example: media_player.bedroom_dot
  sequence:
  - service: input_text.set_value
    data_template:
      entity_id: input_text.alexa_actionable_notification
      value: '{"text": "{{ text }}", "event": "{{ event_id }}"}'
  - service: media_player.play_media
    data_template:
      entity_id: '{{ alexa_device }}'
      media_content_type: skill
      media_content_id: bla-bla-bla

I work on the her asking me if she should take control of the gas heater climate control.

3 Likes