Notification IOS avec réponse

Bonjour,

je suis en train de tester les notification IOS avec possibilité de répondre en fonction de ce que l’on programme, je voulais essayer simple pour débuter … juste un on/off d’une lumière … en partant de l’exemple du site de HA :

https://companion.home-assistant.io/docs/notifications/actionable-notifications

# inside a automation actions or script sequence
- alias: "Set up variables for the actions"
  variables:
    # Including an id in the action allows us to identify this script run
    # and not accidentally trigger for other notification actions
    action_on: "{{ 'ON_' ~ context.id }}"
    action_off: "{{ 'OFF_' ~ context.id }}"
- alias: "Ask to close or open the blinds"
  service: notify.mobile_app_iphone_de_stephane
  data:
    message: "Faut il allumer la lumière ?"
    data:
      actions:
        - action: "{{ action_on }}"
          title: Allumer
        - action: "{{ action_off }}"
          title: Eteindre
- alias: "Wait for a response"
  wait_for_trigger:
    - platform: event
      event_type: mobile_app_notification_action
      event_data:
        # waiting for the specific action avoids accidentally continuing
        # for another script/automation's notification action
        action: "{{ action_on }}"
    - platform: event
      event_type: mobile_app_notification_action
      event_data:
        action: "{{ action_off }}"
- alias: "Perform the action"
  choose:
    - conditions: "{{ wait.trigger.event.data.action == action_on }}"
      sequence:
        - service: light.turn_on
          target:
            entity_id: light.bleu_salle_tele
    - conditions: "{{ wait.trigger.event.data.action == action_off }}"
      sequence:
        - service: light.turn_off
          target:
            entity_id: light.bleu_salle_tele

j’ai mis tout ce code dans un script
et au moment de l’enregistrer j’ai un message d’erreur :
erreur : Message malformed: expected a dictionary

alors j’avoue que je sèche un peu, je ne vois pas trop où j’ai fait un bug !!

une idée ?

bonjour euh il s’agit pas de 3 scripts, plutôt?
je te donne les miens, pour android, et c’est des automations :

la demande automatisé

demande au tel
alias: AL allumer alarme
description: ''
trigger:
  - platform: state
    entity_id: person.xxxxx
    from: home
    to: not_home
  [...]
condition: []
action:
  [...]
  - service: notify.mobile_app_9s_stef
    data:
      message: alarme mis en route par {{ state_attr('person.xxxxxx', 'source') }}
      data:
        actions:
          - action: alarm_on
            title: enclencher alarme sonore?
        color: red
        persistent: true
        tag: tag
  [....}
    mode: single

la réponse du tel

reponse du tel

alias: AL notification alarme sonne
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: alarm_on
action:
- service: input_boolean.turn_on
entity_id: input_boolean.alarm_on
mode: single

Super !

merci j’ai réussi a faire ce que je voulais avec,
juste je ne trouve pas très pratique les réponse d’ios où il faut appuyer sur la notification pour avoir les boutons … mais ça c’est pas HA qui le gère …

:+1:

Le sujet avait été traité ici :