mirror of
https://github.com/Anonym-tsk/smart-domofon.git
synced 2025-12-06 03:26:58 +03:00
Performance optimizations
This commit is contained in:
@@ -7,12 +7,19 @@ esphome:
|
|||||||
esp8266_restore_from_flash: true
|
esp8266_restore_from_flash: true
|
||||||
project:
|
project:
|
||||||
name: "espdomofon.ru"
|
name: "espdomofon.ru"
|
||||||
version: "1.6.1"
|
version: "1.6.2"
|
||||||
|
platformio_options:
|
||||||
|
build_flags: -DBEARSSL_SSL_BASIC -DMMU_IRAM_SIZE=0xC000 -DMMU_ICACHE_SIZE=0x4000 -DMMU_IRAM_HEAP
|
||||||
on_boot:
|
on_boot:
|
||||||
priority: -100
|
priority: -100
|
||||||
then:
|
then:
|
||||||
- script.execute: state_ready
|
- script.execute: state_ready
|
||||||
- script.execute: state_no_call
|
- light.turn_on:
|
||||||
|
id: rgb_led
|
||||||
|
effect: "Domofon"
|
||||||
|
|
||||||
|
dashboard_import:
|
||||||
|
package_import_url: github://Anonym-tsk/smart-domofon/blob/master/ge1mer/domofon.yaml
|
||||||
|
|
||||||
wifi:
|
wifi:
|
||||||
ssid: $wifi_ssid
|
ssid: $wifi_ssid
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ binary_sensor:
|
|||||||
on_press:
|
on_press:
|
||||||
then:
|
then:
|
||||||
script.execute: state_call
|
script.execute: state_call
|
||||||
on_release:
|
|
||||||
then:
|
|
||||||
script.execute: state_no_call
|
|
||||||
|
|
||||||
# Accept HW button
|
# Accept HW button
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
@@ -35,62 +32,56 @@ binary_sensor:
|
|||||||
- ON for $short_click_time_from to $short_click_time_to
|
- ON for $short_click_time_from to $short_click_time_to
|
||||||
- OFF for at least 200ms
|
- OFF for at least 200ms
|
||||||
then:
|
then:
|
||||||
- logger.log: "Double Click"
|
lambda: |-
|
||||||
- if:
|
ESP_LOGD("main", "Double Click");
|
||||||
condition:
|
if (!id(incoming_call).state) {
|
||||||
binary_sensor.is_off: incoming_call
|
if (id(mode_mute_once)) {
|
||||||
then:
|
id(mode_mute) = true;
|
||||||
lambda: |-
|
id(mode_mute_once) = false;
|
||||||
if (id(mode_mute_once)) {
|
} else {
|
||||||
id(mode_mute) = true;
|
id(mode_mute) = false;
|
||||||
id(mode_mute_once) = false;
|
id(mode_mute_once) = true;
|
||||||
} else {
|
}
|
||||||
id(mode_mute) = false;
|
}
|
||||||
id(mode_mute_once) = true;
|
|
||||||
}
|
|
||||||
# Long click - disable auto opening and mute
|
# Long click - disable auto opening and mute
|
||||||
- timing:
|
- timing:
|
||||||
- ON for at least $short_click_time_to
|
- ON for at least $short_click_time_to
|
||||||
then:
|
then:
|
||||||
- logger.log: "Single Long Click"
|
lambda: |-
|
||||||
- if:
|
ESP_LOGD("main", "Single Long Click");
|
||||||
condition:
|
if (id(incoming_call).state) {
|
||||||
binary_sensor.is_on: incoming_call
|
id(call_reject).execute();
|
||||||
then:
|
} else {
|
||||||
script.execute: call_reject
|
id(mode_auto_open) = false;
|
||||||
else:
|
id(mode_auto_open_once) = false;
|
||||||
- lambda: |-
|
id(mode_auto_reject) = false;
|
||||||
id(mode_auto_open) = false;
|
id(mode_mute) = false;
|
||||||
id(mode_auto_open_once) = false;
|
id(mode_mute_once) = false;
|
||||||
id(mode_auto_reject) = false;
|
}
|
||||||
id(mode_mute) = false;
|
|
||||||
id(mode_mute_once) = false;
|
|
||||||
- delay: 10ms
|
|
||||||
- script.execute: led_blink_blue_once
|
|
||||||
# Short click - open door or enable once auto opening
|
# Short click - open door or enable once auto opening
|
||||||
- timing:
|
- timing:
|
||||||
- ON for at most $short_click_time_to
|
- ON for at most $short_click_time_to
|
||||||
- OFF for at least 500ms
|
- OFF for at least 500ms
|
||||||
then:
|
then:
|
||||||
- logger.log: "Single Short Click"
|
lambda: |-
|
||||||
- if:
|
ESP_LOGD("main", "Single Short Click");
|
||||||
condition:
|
if (id(incoming_call).state) {
|
||||||
binary_sensor.is_on: incoming_call
|
id(call_accept).execute();
|
||||||
then:
|
} else {
|
||||||
script.execute: call_accept
|
if (id(mode_auto_open_once)) {
|
||||||
else:
|
id(mode_auto_open) = true;
|
||||||
lambda: |-
|
id(mode_auto_open_once) = false;
|
||||||
if (id(mode_auto_open_once)) {
|
id(mode_auto_reject) = false;
|
||||||
id(mode_auto_open) = true;
|
} else if (id(mode_auto_open)) {
|
||||||
id(mode_auto_open_once) = false;
|
id(mode_auto_open) = false;
|
||||||
id(mode_auto_reject) = false;
|
id(mode_auto_open_once) = false;
|
||||||
} else if (id(mode_auto_open)) {
|
id(mode_auto_reject) = true;
|
||||||
id(mode_auto_open) = false;
|
} else {
|
||||||
id(mode_auto_open_once) = false;
|
id(mode_auto_open) = false;
|
||||||
id(mode_auto_reject) = true;
|
id(mode_auto_open_once) = true;
|
||||||
} else {
|
id(mode_auto_reject) = false;
|
||||||
id(mode_auto_open) = false;
|
}
|
||||||
id(mode_auto_open_once) = true;
|
}
|
||||||
id(mode_auto_reject) = false;
|
|
||||||
}
|
|
||||||
# - <<: !include includes/binary_sensor.captive.yaml
|
# - <<: !include includes/binary_sensor.captive.yaml
|
||||||
|
|||||||
@@ -7,23 +7,23 @@ button:
|
|||||||
name: "${board_name} accept call"
|
name: "${board_name} accept call"
|
||||||
icon: "mdi:door-open"
|
icon: "mdi:door-open"
|
||||||
on_press:
|
on_press:
|
||||||
if:
|
then:
|
||||||
condition:
|
lambda: |-
|
||||||
binary_sensor.is_on: incoming_call
|
if (id(incoming_call).state) {
|
||||||
then:
|
id(call_accept).execute();
|
||||||
script.execute: call_accept
|
} else {
|
||||||
else:
|
ESP_LOGD("main", "No incoming call");
|
||||||
logger.log: "No incoming call"
|
}
|
||||||
|
|
||||||
# Reject call
|
# Reject call
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${board_name} reject call"
|
name: "${board_name} reject call"
|
||||||
icon: "mdi:door-closed-lock"
|
icon: "mdi:door-closed-lock"
|
||||||
on_press:
|
on_press:
|
||||||
if:
|
then:
|
||||||
condition:
|
lambda: |-
|
||||||
binary_sensor.is_on: incoming_call
|
if (id(incoming_call).state) {
|
||||||
then:
|
id(call_reject).execute();
|
||||||
script.execute: call_reject
|
} else {
|
||||||
else:
|
ESP_LOGD("main", "No incoming call");
|
||||||
logger.log: "No incoming call"
|
}
|
||||||
|
|||||||
@@ -9,118 +9,116 @@ light:
|
|||||||
id: rgb_led
|
id: rgb_led
|
||||||
name: "${board_name} led"
|
name: "${board_name} led"
|
||||||
internal: true
|
internal: true
|
||||||
restore_mode: ALWAYS_OFF
|
restore_mode: ALWAYS_ON
|
||||||
default_transition_length: 0ms
|
default_transition_length: 0ms
|
||||||
red: led_red
|
red: led_red
|
||||||
green: led_green
|
green: led_green
|
||||||
blue: led_blue
|
blue: led_blue
|
||||||
effects:
|
effects:
|
||||||
- automation:
|
- lambda:
|
||||||
name: "Blink Blue"
|
name: "Domofon"
|
||||||
sequence:
|
update_interval: 200ms
|
||||||
- light.turn_on:
|
lambda: |-
|
||||||
id: rgb_led
|
static int tick = 0;
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
static bool old_incoming = false;
|
||||||
red: 0%
|
static bool old_mute = false;
|
||||||
green: 40%
|
static bool old_mute_once = false;
|
||||||
blue: 100%
|
static bool old_auto_open = false;
|
||||||
- delay: 200ms
|
static bool old_auto_open_once = false;
|
||||||
- light.turn_on:
|
static bool old_auto_reject = false;
|
||||||
id: rgb_led
|
|
||||||
brightness: 1%
|
float brigtness = id(led_brightness).state / 10;
|
||||||
red: 0%
|
|
||||||
green: 40%
|
bool incoming = id(incoming_call).state;
|
||||||
blue: 100%
|
bool mute = id(mode_mute);
|
||||||
- delay: 2800ms
|
bool mute_once = id(mode_mute_once);
|
||||||
- automation:
|
bool auto_open = id(mode_auto_open);
|
||||||
name: "Blink Green"
|
bool auto_open_once = id(mode_auto_open_once);
|
||||||
sequence:
|
bool auto_reject = id(mode_auto_reject);
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
const bool state_updated = incoming != old_incoming
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
|| mute != old_mute
|
||||||
red: 0%
|
|| mute_once != old_mute_once
|
||||||
green: 100%
|
|| auto_open != old_auto_open
|
||||||
blue: 0%
|
|| auto_open_once != old_auto_open_once
|
||||||
- delay: 200ms
|
|| auto_reject != old_auto_reject;
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
auto call = id(rgb_led).turn_on();
|
||||||
brightness: 1%
|
|
||||||
red: 0%
|
if (initial_run || state_updated) {
|
||||||
green: 100%
|
tick = 0;
|
||||||
blue: 0%
|
}
|
||||||
- delay: 2800ms
|
|
||||||
- automation:
|
if (tick == 0) {
|
||||||
name: "Blink Red"
|
if (incoming || auto_reject) {
|
||||||
sequence:
|
call.set_rgb(1.0, 0.0, 0.0); // red
|
||||||
- light.turn_on:
|
call.set_brightness(brigtness);
|
||||||
id: rgb_led
|
} else if (mute && auto_open_once) {
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
call.set_rgb(0.0, 0.4, 1.0); // blue
|
||||||
red: 100%
|
call.set_brightness(brigtness);
|
||||||
green: 0%
|
} else if (auto_open || auto_open_once) {
|
||||||
blue: 0%
|
call.set_rgb(0.0, 1.0, 0.0); // green
|
||||||
- delay: 200ms
|
call.set_brightness(brigtness);
|
||||||
- light.turn_on:
|
} else if (mute || mute_once) {
|
||||||
id: rgb_led
|
call.set_rgb(0.0, 0.4, 1.0); // blue
|
||||||
brightness: 1%
|
call.set_brightness(brigtness);
|
||||||
red: 100%
|
} else {
|
||||||
green: 0%
|
call.set_brightness(0.01);
|
||||||
blue: 0%
|
}
|
||||||
- delay: 2800ms
|
} else if (tick == 1) {
|
||||||
- automation:
|
if (incoming) {
|
||||||
name: "Red Blink Blue"
|
call.set_brightness(0.01);
|
||||||
sequence:
|
} else if (mute && auto_open_once) {
|
||||||
- light.turn_on:
|
call.set_rgb(0.0, 1.0, 0.0); // green
|
||||||
id: rgb_led
|
call.set_brightness(brigtness);
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
} else if (mute || mute_once) {
|
||||||
red: 100%
|
if (auto_open || auto_open_once || auto_reject) {
|
||||||
green: 0%
|
call.set_rgb(0.0, 0.4, 1.0); // blue
|
||||||
blue: 0%
|
call.set_brightness(brigtness);
|
||||||
- delay: 2800ms
|
} else if (mute_once) {
|
||||||
- light.turn_on:
|
call.set_brightness(0.01);
|
||||||
id: rgb_led
|
}
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
} else if (auto_open) {
|
||||||
red: 0%
|
call.set_rgb(0.0, 1.0, 0.0); // green
|
||||||
green: 40%
|
call.set_brightness(brigtness);
|
||||||
blue: 100%
|
} else if (auto_open_once) {
|
||||||
- delay: 200ms
|
call.set_brightness(0.01);
|
||||||
- automation:
|
} else if (auto_reject) {
|
||||||
name: "Green Blink Blue"
|
call.set_rgb(1.0, 0.0, 0.0); // red
|
||||||
sequence:
|
call.set_brightness(brigtness);
|
||||||
- light.turn_on:
|
} else {
|
||||||
id: rgb_led
|
call.set_brightness(0.01);
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
}
|
||||||
red: 0%
|
} else if (tick == 2) {
|
||||||
green: 100%
|
if (incoming) {
|
||||||
blue: 0%
|
call.set_brightness(0.01);
|
||||||
- delay: 2800ms
|
} else if (auto_reject) {
|
||||||
- light.turn_on:
|
call.set_rgb(1.0, 0.0, 0.0); // red
|
||||||
id: rgb_led
|
call.set_brightness(brigtness);
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
} else if (auto_open) {
|
||||||
red: 0%
|
call.set_rgb(0.0, 1.0, 0.0); // green
|
||||||
green: 40%
|
call.set_brightness(brigtness);
|
||||||
blue: 100%
|
} else if (mute) {
|
||||||
- delay: 200ms
|
call.set_rgb(0.0, 0.4, 1.0); // blue
|
||||||
- automation:
|
call.set_brightness(brigtness);
|
||||||
name: "Blink Green Blue"
|
} else {
|
||||||
sequence:
|
call.set_brightness(0.01);
|
||||||
- light.turn_on:
|
}
|
||||||
id: rgb_led
|
} else if (tick == 7 && incoming) {
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
call.set_rgb(1.0, 0.0, 0.0); // red
|
||||||
red: 0%
|
call.set_brightness(brigtness);
|
||||||
green: 100%
|
} else if (tick == 8 && incoming) {
|
||||||
blue: 0%
|
call.set_brightness(0.01);
|
||||||
- delay: 200ms
|
}
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
call.perform();
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
if (++tick == 14) {
|
||||||
red: 0%
|
tick = 0;
|
||||||
green: 40%
|
}
|
||||||
blue: 100%
|
|
||||||
- delay: 200ms
|
old_incoming = incoming;
|
||||||
- light.turn_on:
|
old_mute = mute;
|
||||||
id: rgb_led
|
old_mute_once = mute_once;
|
||||||
brightness: 1%
|
old_auto_open = auto_open;
|
||||||
red: 0%
|
old_auto_open_once = auto_open_once;
|
||||||
green: 100%
|
old_auto_reject = auto_reject;
|
||||||
blue: 0%
|
|
||||||
- delay: 2600ms
|
|
||||||
|
|||||||
@@ -10,15 +10,6 @@ number:
|
|||||||
min_value: 0
|
min_value: 0
|
||||||
max_value: 10
|
max_value: 10
|
||||||
step: 1
|
step: 1
|
||||||
on_value:
|
|
||||||
then:
|
|
||||||
if:
|
|
||||||
condition:
|
|
||||||
light.is_on: rgb_led
|
|
||||||
then:
|
|
||||||
light.control:
|
|
||||||
id: rgb_led
|
|
||||||
brightness: !lambda "return x > 0 ? x / 10 : 0.01;"
|
|
||||||
|
|
||||||
# Delay before answer call
|
# Delay before answer call
|
||||||
- platform: template
|
- platform: template
|
||||||
|
|||||||
@@ -10,27 +10,28 @@ script:
|
|||||||
id(relay_phone).turn_on();
|
id(relay_phone).turn_on();
|
||||||
id(relay_mute).turn_off();
|
id(relay_mute).turn_off();
|
||||||
}
|
}
|
||||||
- output.turn_off: relay_answer
|
id(relay_answer).turn_off();
|
||||||
|
|
||||||
# Connected answer resistor
|
# Connected answer resistor
|
||||||
- id: state_answer
|
- id: state_answer
|
||||||
then:
|
then:
|
||||||
- output.turn_on: relay_answer
|
- lambda: |-
|
||||||
- output.turn_off: relay_phone
|
id(relay_answer).turn_on();
|
||||||
- output.turn_off: relay_mute
|
id(relay_phone).turn_off();
|
||||||
|
id(relay_mute).turn_off();
|
||||||
|
|
||||||
# Disconnected all
|
# Disconnected all
|
||||||
- id: state_open
|
- id: state_open
|
||||||
then:
|
then:
|
||||||
- output.turn_off: relay_answer
|
- lambda: |-
|
||||||
- output.turn_off: relay_phone
|
id(relay_answer).turn_off();
|
||||||
- output.turn_off: relay_mute
|
id(relay_phone).turn_off();
|
||||||
|
id(relay_mute).turn_off();
|
||||||
|
|
||||||
# Accept incoming call
|
# Accept incoming call
|
||||||
- id: call_accept
|
- id: call_accept
|
||||||
then:
|
then:
|
||||||
- logger.log: "Accept call"
|
- logger.log: "Accept call"
|
||||||
- script.execute: state_no_call
|
|
||||||
- delay: !lambda "return id(relay_before_answer_delay).state;"
|
- delay: !lambda "return id(relay_before_answer_delay).state;"
|
||||||
- script.execute: state_answer
|
- script.execute: state_answer
|
||||||
- delay: !lambda "return id(relay_answer_on_time).state;"
|
- delay: !lambda "return id(relay_answer_on_time).state;"
|
||||||
@@ -51,7 +52,6 @@ script:
|
|||||||
- id: call_reject
|
- id: call_reject
|
||||||
then:
|
then:
|
||||||
- logger.log: "Reject call"
|
- logger.log: "Reject call"
|
||||||
- script.execute: state_no_call
|
|
||||||
- delay: !lambda "return id(relay_before_answer_delay).state;"
|
- delay: !lambda "return id(relay_before_answer_delay).state;"
|
||||||
- script.execute: state_answer
|
- script.execute: state_answer
|
||||||
- delay: !lambda "return id(relay_answer_on_time).state;"
|
- delay: !lambda "return id(relay_answer_on_time).state;"
|
||||||
@@ -64,164 +64,16 @@ script:
|
|||||||
# data:
|
# data:
|
||||||
# entity_uid: $mdns_name
|
# entity_uid: $mdns_name
|
||||||
|
|
||||||
# No call state
|
|
||||||
- id: state_no_call
|
|
||||||
then:
|
|
||||||
- logger.log: "Set state 'No call'"
|
|
||||||
- lambda: |-
|
|
||||||
if (id(mode_auto_open_once)) {
|
|
||||||
if (id(mode_mute) || id(mode_mute_once)) {
|
|
||||||
id(led_green_and_blue_blink).execute();
|
|
||||||
} else {
|
|
||||||
id(led_blink_green_on).execute();
|
|
||||||
}
|
|
||||||
} else if (id(mode_auto_open)) {
|
|
||||||
if (id(mode_mute) || id(mode_mute_once)) {
|
|
||||||
id(led_green_on_blue_blink).execute();
|
|
||||||
} else {
|
|
||||||
id(led_green_on).execute();
|
|
||||||
}
|
|
||||||
} else if (id(mode_auto_reject)) {
|
|
||||||
if (id(mode_mute) || id(mode_mute_once)) {
|
|
||||||
id(led_red_on_blue_blink).execute();
|
|
||||||
} else {
|
|
||||||
id(led_red_on).execute();
|
|
||||||
}
|
|
||||||
} else if (id(mode_mute)) {
|
|
||||||
id(led_blue_on).execute();
|
|
||||||
} else if (id(mode_mute_once)) {
|
|
||||||
id(led_blink_blue_on).execute();
|
|
||||||
} else {
|
|
||||||
id(led_off).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Call state
|
# Call state
|
||||||
- id: state_call
|
- id: state_call
|
||||||
then:
|
then:
|
||||||
- logger.log: "Set state 'Incoming call'"
|
- lambda: |-
|
||||||
- lambda: |-
|
ESP_LOGD("main", "Incoming call");
|
||||||
if (id(mode_auto_reject)) {
|
if (id(mode_auto_reject)) {
|
||||||
id(call_reject).execute();
|
id(call_reject).execute();
|
||||||
} else if (id(mode_auto_open)) {
|
} else if (id(mode_auto_open)) {
|
||||||
id(call_accept).execute();
|
id(call_accept).execute();
|
||||||
} else if (id(mode_auto_open_once)) {
|
} else if (id(mode_auto_open_once)) {
|
||||||
id(call_accept).execute();
|
id(call_accept).execute();
|
||||||
id(mode_auto_open_once) = false;
|
id(mode_auto_open_once) = false;
|
||||||
} else {
|
}
|
||||||
id(led_blink_red_on).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Permanent blink green led
|
|
||||||
- id: led_blink_green_on
|
|
||||||
then:
|
|
||||||
- logger.log: "Led green blink"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
effect: "Blink Green"
|
|
||||||
|
|
||||||
# Permanent blink blue led
|
|
||||||
- id: led_blink_blue_on
|
|
||||||
then:
|
|
||||||
- logger.log: "Led blue blink"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
effect: "Blink Blue"
|
|
||||||
|
|
||||||
# Once blink blue led
|
|
||||||
- id: led_blink_blue_once
|
|
||||||
then:
|
|
||||||
- logger.log: "Led blue once"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
|
||||||
red: 0%
|
|
||||||
green: 0%
|
|
||||||
blue: 100%
|
|
||||||
transition_length: 100ms
|
|
||||||
- delay: 200ms
|
|
||||||
- script.execute: led_off
|
|
||||||
|
|
||||||
# Permanent on green led
|
|
||||||
- id: led_green_on
|
|
||||||
then:
|
|
||||||
- logger.log: "Led green on"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
|
||||||
red: 0%
|
|
||||||
green: 100%
|
|
||||||
blue: 0%
|
|
||||||
transition_length: 100ms
|
|
||||||
|
|
||||||
# Permanent blink red led
|
|
||||||
- id: led_blink_red_on
|
|
||||||
then:
|
|
||||||
- logger.log: "Led red blink"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
effect: "Blink Red"
|
|
||||||
|
|
||||||
# Permanent on red led with
|
|
||||||
- id: led_red_on
|
|
||||||
then:
|
|
||||||
- logger.log: "Led red on"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
|
||||||
red: 100%
|
|
||||||
green: 0%
|
|
||||||
blue: 0%
|
|
||||||
transition_length: 100ms
|
|
||||||
|
|
||||||
# Permanent on blue led
|
|
||||||
- id: led_blue_on
|
|
||||||
then:
|
|
||||||
- logger.log: "Led blue on"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
brightness: !lambda "return id(led_brightness).state / 10;"
|
|
||||||
red: 0%
|
|
||||||
green: 40%
|
|
||||||
blue: 100%
|
|
||||||
transition_length: 100ms
|
|
||||||
|
|
||||||
# Permanent on red led and blink blue led
|
|
||||||
- id: led_red_on_blue_blink
|
|
||||||
then:
|
|
||||||
- logger.log: "Led red on blue blink"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
effect: "Red Blink Blue"
|
|
||||||
|
|
||||||
# Permanent on green led and blink blue led
|
|
||||||
- id: led_green_on_blue_blink
|
|
||||||
then:
|
|
||||||
- logger.log: "Led green on blue blink"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
effect: "Green Blink Blue"
|
|
||||||
|
|
||||||
# Blink green and blue leds
|
|
||||||
- id: led_green_and_blue_blink
|
|
||||||
then:
|
|
||||||
- logger.log: "Led green and blue blink"
|
|
||||||
- script.execute: led_off
|
|
||||||
- light.turn_on:
|
|
||||||
id: rgb_led
|
|
||||||
effect: "Blink Green Blue"
|
|
||||||
|
|
||||||
# Turn off leds
|
|
||||||
- id: led_off
|
|
||||||
then:
|
|
||||||
- light.turn_off:
|
|
||||||
id: rgb_led
|
|
||||||
transition_length: 0ms
|
|
||||||
|
|||||||
@@ -15,15 +15,9 @@ switch:
|
|||||||
id: mode_auto_open
|
id: mode_auto_open
|
||||||
value: 'false'
|
value: 'false'
|
||||||
on_turn_on:
|
on_turn_on:
|
||||||
- globals.set:
|
- lambda: |-
|
||||||
id: mode_auto_open_once
|
id(mode_auto_open_once) = false;
|
||||||
value: 'false'
|
id(mode_auto_reject) = false;
|
||||||
- globals.set:
|
|
||||||
id: mode_auto_reject
|
|
||||||
value: 'false'
|
|
||||||
- script.execute: state_no_call
|
|
||||||
on_turn_off:
|
|
||||||
- script.execute: state_no_call
|
|
||||||
|
|
||||||
# Automatically open door once switch
|
# Automatically open door once switch
|
||||||
- platform: template
|
- platform: template
|
||||||
@@ -41,15 +35,9 @@ switch:
|
|||||||
id: mode_auto_open_once
|
id: mode_auto_open_once
|
||||||
value: 'false'
|
value: 'false'
|
||||||
on_turn_on:
|
on_turn_on:
|
||||||
- globals.set:
|
- lambda: |-
|
||||||
id: mode_auto_open
|
id(mode_auto_open) = false;
|
||||||
value: 'false'
|
id(mode_auto_reject) = false;
|
||||||
- globals.set:
|
|
||||||
id: mode_auto_reject
|
|
||||||
value: 'false'
|
|
||||||
- script.execute: state_no_call
|
|
||||||
on_turn_off:
|
|
||||||
script.execute: state_no_call
|
|
||||||
|
|
||||||
# Automatically reject call switch
|
# Automatically reject call switch
|
||||||
- platform: template
|
- platform: template
|
||||||
@@ -67,15 +55,9 @@ switch:
|
|||||||
id: mode_auto_reject
|
id: mode_auto_reject
|
||||||
value: 'false'
|
value: 'false'
|
||||||
on_turn_on:
|
on_turn_on:
|
||||||
- globals.set:
|
- lambda: |-
|
||||||
id: mode_auto_open
|
id(mode_auto_open) = false;
|
||||||
value: 'false'
|
id(mode_auto_open_once) = false;
|
||||||
- globals.set:
|
|
||||||
id: mode_auto_open_once
|
|
||||||
value: 'false'
|
|
||||||
- script.execute: state_no_call
|
|
||||||
on_turn_off:
|
|
||||||
script.execute: state_no_call
|
|
||||||
|
|
||||||
# Mute sound switch
|
# Mute sound switch
|
||||||
- platform: template
|
- platform: template
|
||||||
@@ -93,16 +75,14 @@ switch:
|
|||||||
id: mode_mute
|
id: mode_mute
|
||||||
value: 'false'
|
value: 'false'
|
||||||
on_turn_on:
|
on_turn_on:
|
||||||
- globals.set:
|
- lambda: |-
|
||||||
id: mode_mute_once
|
id(mode_mute_once) = false;
|
||||||
value: 'false'
|
id(relay_mute).turn_on();
|
||||||
- output.turn_on: relay_mute
|
id(relay_phone).turn_off();
|
||||||
- output.turn_off: relay_phone
|
|
||||||
- script.execute: state_no_call
|
|
||||||
on_turn_off:
|
on_turn_off:
|
||||||
- output.turn_on: relay_phone
|
- lambda: |-
|
||||||
- output.turn_off: relay_mute
|
id(relay_phone).turn_on();
|
||||||
- script.execute: state_no_call
|
id(relay_mute).turn_off();
|
||||||
|
|
||||||
# Mute sound once switch
|
# Mute sound once switch
|
||||||
- platform: template
|
- platform: template
|
||||||
@@ -120,13 +100,11 @@ switch:
|
|||||||
id: mode_mute_once
|
id: mode_mute_once
|
||||||
value: 'false'
|
value: 'false'
|
||||||
on_turn_on:
|
on_turn_on:
|
||||||
- globals.set:
|
- lambda: |-
|
||||||
id: mode_mute
|
id(mode_mute) = false;
|
||||||
value: 'false'
|
id(relay_mute).turn_on();
|
||||||
- output.turn_on: relay_mute
|
id(relay_phone).turn_off();
|
||||||
- output.turn_off: relay_phone
|
|
||||||
- script.execute: state_no_call
|
|
||||||
on_turn_off:
|
on_turn_off:
|
||||||
- output.turn_on: relay_phone
|
- lambda: |-
|
||||||
- output.turn_off: relay_mute
|
id(relay_phone).turn_on();
|
||||||
- script.execute: state_no_call
|
id(relay_mute).turn_off();
|
||||||
|
|||||||
Reference in New Issue
Block a user