mirror of
https://github.com/Anonym-tsk/smart-domofon.git
synced 2025-12-06 03:26:58 +03:00
Open / Reject buttons
This commit is contained in:
@@ -59,5 +59,6 @@ packages:
|
||||
script: !include domofon_packages/script.yaml
|
||||
output: !include domofon_packages/output.yaml
|
||||
switch: !include domofon_packages/switch.yaml
|
||||
button: !include domofon_packages/button.yaml
|
||||
light: !include domofon_packages/light.yaml
|
||||
binary_sensor: !include domofon_packages/binary_sensor.yaml
|
||||
|
||||
26
ge1mer/domofon_packages/button.yaml
Normal file
26
ge1mer/domofon_packages/button.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
button:
|
||||
# Accept call
|
||||
- platform: template
|
||||
name: "${board_name} accept call"
|
||||
icon: "mdi:door-open"
|
||||
on_press:
|
||||
if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_accept
|
||||
else:
|
||||
logger.log: "No incoming call"
|
||||
|
||||
# Reject call
|
||||
- platform: template
|
||||
name: "${board_name} reject call"
|
||||
icon: "mdi:door-closed-lock"
|
||||
on_press:
|
||||
if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_reject
|
||||
else:
|
||||
logger.log: "No incoming call"
|
||||
@@ -133,33 +133,3 @@ switch:
|
||||
- output.turn_on: relay_phone
|
||||
- output.turn_off: relay_mute
|
||||
- script.execute: state_no_call
|
||||
|
||||
# Accept call
|
||||
- platform: template
|
||||
name: "${board_name} accept call"
|
||||
icon: "mdi:door-open"
|
||||
lambda: "return false;"
|
||||
optimistic: true
|
||||
turn_on_action:
|
||||
if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_accept
|
||||
else:
|
||||
logger.log: "No incoming call"
|
||||
|
||||
# Reject call
|
||||
- platform: template
|
||||
name: "${board_name} reject call"
|
||||
icon: "mdi:door-closed-lock"
|
||||
lambda: "return false;"
|
||||
optimistic: true
|
||||
turn_on_action:
|
||||
if:
|
||||
condition:
|
||||
binary_sensor.is_on: incoming_call
|
||||
then:
|
||||
script.execute: call_reject
|
||||
else:
|
||||
logger.log: "No incoming call"
|
||||
|
||||
@@ -66,8 +66,8 @@ automation:
|
||||
callback_query_id: "{{ trigger.event.data.id }}"
|
||||
message: "Открываю..."
|
||||
# Открыть
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.domofon_accept_call
|
||||
- service: button.press
|
||||
entity_id: button.domofon_accept_call
|
||||
default:
|
||||
# Отправить ответ, что нету звонка
|
||||
- service: telegram_bot.answer_callback_query
|
||||
@@ -96,9 +96,9 @@ automation:
|
||||
data_template:
|
||||
callback_query_id: "{{ trigger.event.data.id }}"
|
||||
message: "Отклоняю..."
|
||||
# Открыть
|
||||
- service: switch.turn_on
|
||||
entity_id: switch.domofon_reject_call
|
||||
# Отклонить
|
||||
- service: button.press
|
||||
entity_id: button.domofon_reject_call
|
||||
default:
|
||||
# Отправить ответ, что нету звонка
|
||||
- service: telegram_bot.answer_callback_query
|
||||
|
||||
Reference in New Issue
Block a user