mirror of
https://github.com/Anonym-tsk/smart-domofon.git
synced 2026-01-04 15:48:58 +03:00
ESPHome version
This commit is contained in:
63
esphome/homeassistant/domofon.yaml
Normal file
63
esphome/homeassistant/domofon.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
# Domofon
|
||||
|
||||
automation:
|
||||
- alias: Domofon incoming call notification
|
||||
hide_entity: true
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.domofon_incoming_call
|
||||
to: 'on'
|
||||
action:
|
||||
service: notify.telegram
|
||||
data_template:
|
||||
message: "Звонок в домофон {% if is_state('switch.domofon_automatically_open', 'on') or is_state('switch.domofon_automatically_open_once', 'on') %}(откроется автоматически){% endif %}"
|
||||
data:
|
||||
inline_keyboard:
|
||||
- "{{ '0' if is_state('switch.domofon_automatically_open', 'on') or is_state('switch.domofon_automatically_open_once', 'on') else 'Открыть:/domofon_open, Отклонить:/domofon_reject' }}"
|
||||
|
||||
- alias: Telegram /domofon_open callback
|
||||
hide_entity: true
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: telegram_callback
|
||||
event_data:
|
||||
data: '/domofon_open'
|
||||
action:
|
||||
- service: telegram_bot.answer_callback_query
|
||||
data_template:
|
||||
callback_query_id: "{{ trigger.event.data.id }}"
|
||||
message: "{{ 'Открываю...' if is_state('binary_sensor.domofon_incoming_call', 'on') else 'Нет входящего звонка' }}"
|
||||
- service: esphome.domofon_accept_call
|
||||
|
||||
- alias: Telegram /domofon_reject callback
|
||||
hide_entity: true
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: telegram_callback
|
||||
event_data:
|
||||
data: '/domofon_reject'
|
||||
action:
|
||||
- service: telegram_bot.answer_callback_query
|
||||
data_template:
|
||||
callback_query_id: "{{ trigger.event.data.id }}"
|
||||
message: "{{ 'Отклоняю...' if is_state('binary_sensor.domofon_incoming_call', 'on') else 'Нет входящего звонка' }}"
|
||||
- service: esphome.domofon_reject_call
|
||||
|
||||
- alias: Domofon opened by button notification
|
||||
hide_entity: true
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.domofon_button_accept
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.domofon_incoming_call
|
||||
state: 'on'
|
||||
action:
|
||||
service: notify.telegram
|
||||
data:
|
||||
message: "Домофон открыт кнопкой"
|
||||
Reference in New Issue
Block a user