Added stop to the container if no device needs frames
This commit is contained in:
+17
-20
@@ -40,10 +40,7 @@ esphome:
|
||||
id(ext_io)->digital_write(7, true);
|
||||
- priority: 600
|
||||
then:
|
||||
- lambda: |-
|
||||
id(touch_state) = 0;
|
||||
id(doorbell_jpg).set_url("${stream_a_url}");
|
||||
id(doorbell_jpg).set_enabled(true);
|
||||
- script.execute: activate_stream_a
|
||||
- light.turn_on:
|
||||
id: backlight
|
||||
brightness: 100%
|
||||
@@ -98,6 +95,19 @@ globals:
|
||||
initial_value: "0"
|
||||
|
||||
script:
|
||||
- id: activate_stream_a
|
||||
then:
|
||||
- lambda: |-
|
||||
id(touch_state) = 0;
|
||||
id(doorbell_jpg).set_url("${stream_a_url}");
|
||||
id(doorbell_jpg).set_enabled(true);
|
||||
|
||||
- id: deactivate_stream
|
||||
then:
|
||||
- lambda: |-
|
||||
id(touch_state) = 2;
|
||||
id(doorbell_jpg).set_enabled(false);
|
||||
|
||||
- id: cycle_stream
|
||||
mode: restart
|
||||
then:
|
||||
@@ -107,9 +117,7 @@ script:
|
||||
condition:
|
||||
lambda: "return id(touch_state) == 0;"
|
||||
then:
|
||||
- lambda: |-
|
||||
id(doorbell_jpg).set_url("${stream_a_url}");
|
||||
id(doorbell_jpg).set_enabled(true);
|
||||
- script.execute: activate_stream_a
|
||||
- light.turn_on:
|
||||
id: backlight
|
||||
brightness: 100%
|
||||
@@ -127,7 +135,6 @@ script:
|
||||
condition:
|
||||
lambda: "return id(touch_state) == 2;"
|
||||
then:
|
||||
- lambda: "id(doorbell_jpg).set_enabled(false);"
|
||||
- light.turn_off: backlight
|
||||
|
||||
spi:
|
||||
@@ -158,12 +165,9 @@ light:
|
||||
restore_mode: ALWAYS_ON
|
||||
default_transition_length: 0s
|
||||
on_turn_on:
|
||||
- lambda: |-
|
||||
if (id(touch_state) != 2) {
|
||||
id(doorbell_jpg).set_enabled(true);
|
||||
}
|
||||
- script.execute: activate_stream_a
|
||||
on_turn_off:
|
||||
- lambda: id(doorbell_jpg).set_enabled(false);
|
||||
- script.execute: deactivate_stream
|
||||
|
||||
# Simple on/off for Home Assistant automations (light still exposes brightness).
|
||||
switch:
|
||||
@@ -174,17 +178,10 @@ switch:
|
||||
lambda: |-
|
||||
return id(backlight).current_values.is_on();
|
||||
turn_on_action:
|
||||
- lambda: |-
|
||||
id(touch_state) = 0;
|
||||
id(doorbell_jpg).set_url("${stream_a_url}");
|
||||
id(doorbell_jpg).set_enabled(true);
|
||||
- light.turn_on:
|
||||
id: backlight
|
||||
brightness: 100%
|
||||
turn_off_action:
|
||||
- lambda: |-
|
||||
id(touch_state) = 2;
|
||||
id(doorbell_jpg).set_enabled(false);
|
||||
- light.turn_off: backlight
|
||||
|
||||
touchscreen:
|
||||
|
||||
Reference in New Issue
Block a user