Open / Reject buttons

This commit is contained in:
Nikolay Vasilchuk
2022-02-15 13:45:44 +03:00
parent 1940d13c34
commit 6aa6848ae4
4 changed files with 32 additions and 35 deletions

View File

@@ -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

View 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"

View File

@@ -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"

View File

@@ -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