Actionable Notification Help with number reply

Hello all. I am working through actionable notifications, and I have gotten simple ones to work to trigger automations, but I want to create one that asks for a number (temperature value), and then that number gets passed to a thermostat as the set temperature. I cannot figure out how to get the value into an automation. I tried the action: reply command, but then I dont know where to go from there. I cannot seem to find any documentation to help me through this.

Thanks for any help!

When you complete your reply it will be included in the event data in the variable reply_text. So you would set up your wait trigger to catch specific values on that variable or to respond to all events then process the reply in your Choose action and/or templating.

Here’s an example setting the temperature with a Reply:

...
action:
  - alias: "Set up variables for the actions"
    variables:
      action_ignore: "{{ 'IGNORE_' ~ context.id }}"
  - alias: Ask to change temperature
    service: notify.mobile_app_<your_device_id_here>
    data:
      message: What should I set the thermostat to?
      data:
        tag: "thermostat"
        actions:
          - action: REPLY
            title: New Temperature
          - action: "{{ action_ignore }}"
            title: Keep Current
  - alias: Wait for a response
    wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: REPLY
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: "{{ action_ignore }}"
    timeout: "00:05:00"
    continue_on_timeout: false
  - choose:
    - conditions: "{{ wait.trigger.event.data.action == action_ignore or wait.trigger == none }}"
      sequence:
        - service: notify.mobile_app_<your_device_id_here>
          data:
            message: "clear_notification"
            data:
              tag: "thermostat"
    - conditions: "{{ wait.trigger.event.data.action == 'REPLY' }}"
      sequence:
        - service: climate.set_temperature
          data:
            temperature: "{{ wait.trigger.event.data.reply_text }}"
          target:
            entity_id: climate.example_thermostat
mode: single
1 Like

Thank you so much for getting back to me about this. I will give it a try and let you know if I can get it to work!

This is amazing! Much appreciated. This works perfectly from my iPhone, but does not work from my Apple Watch. I get the notification, can post a reply, but the temperature does not change. Any idea why that may be?