Hi there,
I have been setting up telegram bot notifications in to my HA configuration. All good and I was happy to see that I could set up automations using the UI to turn on things and send a Telegram notification. However I would like to then delete the notification some few minutes later to reduce the message clutter on my BOT. It is possible to add another action to the established Automation and add a delay of the required time, then add another action to Call service and delete messages, however I have been playing to get this working but no luck yet. To send a message from the Automation I only have to set the message and the title and not worry about the Chat ID. However I do not know what to enter for the deletion of the message. Does anyone have some suggestions?
From my Automations.yaml file, here is the automation including the message bot part to send notification which all works fine, just never deletes the message:
- id: '1614088427892'
alias: Hot Water Heater ON
description: Switch on Contactor if Solar production above 2000w and exporting to
grid
trigger:
- platform: numeric_state
entity_id: sensor.hauxtonenvoy_current_energy_production
above: '1999'
condition:
- condition: numeric_state
entity_id: sensor.inst_energy_difference
above: '0'
- condition: device
type: is_off
device_id: f44ede254035005d7dc09d266aca7bba
entity_id: switch.bf265fb7b0e1bbfdc1rzbg
domain: switch
action:
- type: turn_on
device_id: f44ede254035005d7dc09d266aca7bba
entity_id: switch.bf265fb7b0e1bbfdc1rzbg
domain: switch
- service: telegram_bot.send_message
data:
message: Hotwater Immersion turned ON
title: Home
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: telegram_bot.delete_message
data:
message: last
mode: single