Hi all,
trying to get an automation that sends me a telegram message if specific states of the PV is reached and I want to press a button in telegram how long I want that automation to stop.
This is what I got so far: (XXX is where I shortened for this post, am aware of that)
alias: test
description: "ein test"
trigger:
- platform: numeric_state
entity_id: XXX
above: 2000
for:
hours: 0
minutes: 10
seconds: 0
condition:
- type: is_battery_level
condition: device
device_id: XXX
entity_id: sensor.battery_state_of_charge
domain: sensor
above: 95
action:
- service: notify.telegram_XXX
data:
message: "Gute Zeit zum Wäsche waschen. Nachrichten pausieren? Wie lange?"
reply_markup:
inline_keyboard:
- [ {text: "1 Stunde", callback_data: "1_hour_pause"} ]
- [ {text: "2 Stunden", callback_data: "2_hour_pause"} ]
- [ {text: "Stop", callback_data: "stop_automation"} ]
parse_mode: "Markdown"
- wait_for_trigger:
- platform: event
event_type: telegram_callback
timeout: "00:00:30"
continue_on_timeout: true
variables:
pause_duration: "{{ {'1_hour_pause': '01:00:00', '2_hour_pause': '02:00:00'}[trigger.event.data] }}"
stop_automation: "{{ trigger.event.data == 'stop_automation' }}"
data:
pause_duration: "{{ pause_duration }}"
stop_automation: "{{ stop_automation }}"
- choose:
- conditions:
- "{{ stop_automation }}"
sequence:
- wait_template: "{{ states('sensor.time') == '09:00' }}"
- service: automation.turn_on
entity_id: automation.test
- service: notify.telegramXXX
data:
message: "Die Automation ist jetzt wieder aktiv."
parse_mode: "Markdown"
- conditions: []
sequence:
- service: automation.turn_off
entity_id: automation.test
- delay: "{{ pause_duration }}"
- service: automation.turn_on
entity_id: automation.test
- service: notify.telegramXXX
data:
message: "Die Automation ist jetzt wieder aktiv."
parse_mode: "Markdown"
Getting Error: Message malformed: extra keys not allowed @ data[‘action’][1][‘variables’]
I can’t find the error, what am I doing wrong?