Hi,
Below you will find my actionable notification automation code and scripts. As a summary; I have an automation to trigger 4 different scripts. These scripts send actionable notification to 2 people (Cenk and Derya)
If Cenk confirms the action a message sent to Derya saying “Cenk confirmed” or If Cenk dismiss the action a message is sent to Derya saying “Cenk dismissed” This logic is also valid for Derya. Here the bug is start.
IF I run the “Scripts” MANUALLY and Cenk confirmed the action a message is sent to Derya saying “Cenk confirmed”. This is ok. BUT If automation is TRIGGERED to call the scripts and Cenk confirmed then a message is sent to Derya saying “Cenk Confirmed” and ANOTHER message sent TO CENK!! saying “Derya Confirmed”
Anyone have thoughts? What can be diffetence between manual triggering a script and automation call. result should be the same at the end of the day. Thank you.
Script:
alias: Confirmable Notification - (Watering Flowers to Cenk)
mode: restart
icon: mdi:flower-poppy
sequence:
- alias: Set up variables for the actions
variables:
action_confirm: "{{ 'CONFIRM_' ~ context.id }}"
action_dismiss: "{{ 'DISMISS_' ~ context.id }}"
- alias: Ask to water flowers
service: notify.mobile_app_cenk
data:
message: Time to give some water to our lovely flowers!
data:
actions:
- action: "{{ action_confirm }}"
title: ✅ Yes, I will
- action: "{{ action_dismiss }}"
title: ❌ No, I can't
- alias: Wait for a response
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_confirm }}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_dismiss }}"
- alias: Perform the action
choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger.event.data.action == action_confirm }}"
sequence:
- service: notify.mobile_app_derya
data:
message: Yes, I will
title: ✅ Cenk Confirmed!
- conditions:
- condition: template
value_template: "{{ wait.trigger.event.data.action == action_dismiss }}"
sequence:
- service: notify.mobile_app_derya
data:
message: No, I can't
title: ❌ Cenk Dismissed!
Automation
alias: Reminder (Watering the Plants)
description: ""
trigger:
- platform: time
at: "22:47:00"
condition: []
action:
- if:
- condition: time
weekday:
- mon
- wed
- sun
then:
- parallel:
- service: script.watering_tree_to_derya
data: {}
- service: script.watering_tree_to_cenk
data: {}
else:
- if:
- condition: time
weekday:
- fri
- sat
then:
- parallel:
- service: script.watering_flowers_to_derya
data: {}
- service: script.watering_flowers_to_cenk
data: {}
else:
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 250
mode: single