Skip to content

Instantly share code, notes, and snippets.

@kai-zer-ru
Created April 29, 2026 13:20
Show Gist options
  • Select an option

  • Save kai-zer-ru/7c82abe1fcbee4f87df78b7745913e96 to your computer and use it in GitHub Desktop.

Select an option

Save kai-zer-ru/7c82abe1fcbee4f87df78b7745913e96 to your computer and use it in GitHub Desktop.
Отправка сообщения в МАКС с сохранением идентификатора для последующего удаления из любого тригера
- id: 'tabletki_notify'
alias: Таблетки — отправить напоминание
mode: single
trigger:
- platform: time
at: "09:00:00" # поставьте свое время
action:
- alias: "Отправляем напоминание в Max"
service: max_notify.send_message
data:
entity_id:
- notify.maxnotify_webhook_chat_73199518591043
message: "Пора принять таблетки"
send_keyboard: true
buttons:
- - text: "Я принял таблетки"
payload: "tablet_taken"
- alias: "Ждем обновление сенсора с ID исходящего сообщения"
wait_for_trigger:
- platform: state
entity_id: sensor.maxnotify_webhook_identifikator_poslednego_iskhodiashchego_soobshcheniia_chat_73199518591043
for:
seconds: 1
timeout: "00:00:10"
continue_on_timeout: false
- alias: "Сохраняем ID сообщения в input_text"
service: input_text.set_value
target:
entity_id: input_text.tabletki_msg_id
data:
value: "{{ wait.trigger.to_state.state }}"
- id: 'tabletka_prinyata'
alias: Таблетки — подтверждение и очистка
mode: single
trigger:
- alias: "Max-кнопка"
platform: event
event_type: max_notify_callback # проверьте точный event_type вашей интеграции
event_data:
payload: tablet_taken
- alias: "Алиса"
platform: event
event_type: yandex_intent
event_data:
text: "я принял таблетки"
- alias: "Часы"
platform: event
event_type: ulanzi_button_pressed # замените на ваше событие
event_data:
button: tablet_taken
condition: []
action:
- alias: "Если есть сохраненный message_id — удаляем сообщение в Max"
if:
- condition: template
value_template: >
{{ states('input_text.tabletki_msg_id') not in ['unknown', 'unavailable', 'none', 'None', ''] }}
then:
- service: max_notify.delete_message
data:
entity_id:
- notify.maxnotify_webhook_chat_73199518591043
message_id: "{{ states('input_text.tabletki_msg_id') }}"
- service: input_text.set_value
target:
entity_id: input_text.tabletki_msg_id
data:
value: ""
tabletki_msg_id:
name: ID сообщения таблеток (Max)
max: 64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment