Add backlight idle script
This commit is contained in:
@@ -79,6 +79,34 @@ globals:
|
||||
initial_value: "false"
|
||||
restore_value: no
|
||||
|
||||
script:
|
||||
- id: wake_backlight
|
||||
mode: restart
|
||||
then:
|
||||
- script.stop: backlight_idle
|
||||
- light.turn_on:
|
||||
id: backlight
|
||||
brightness: 100%
|
||||
- id: backlight_idle
|
||||
mode: restart
|
||||
then:
|
||||
- delay: 2min
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
return !owon_meter.connected && !id(atorch_connected);
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: backlight
|
||||
brightness: 50%
|
||||
- delay: 3min
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
return !owon_meter.connected && !id(atorch_connected);
|
||||
then:
|
||||
- light.turn_off: backlight
|
||||
|
||||
interval:
|
||||
- interval: 10s
|
||||
then:
|
||||
@@ -103,6 +131,7 @@ ble_client:
|
||||
id: owon_ble_client
|
||||
on_connect:
|
||||
then:
|
||||
- script.execute: wake_backlight
|
||||
- lambda: |-
|
||||
owon_meter.on_connect();
|
||||
id(display_page) = 0;
|
||||
@@ -115,11 +144,18 @@ ble_client:
|
||||
id(display_page) = 1;
|
||||
}
|
||||
id(lcd).update();
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
return !owon_meter.connected && !id(atorch_connected);
|
||||
then:
|
||||
- script.execute: backlight_idle
|
||||
|
||||
- mac_address: ${dl24_mac_address}
|
||||
id: atorch_ble_client
|
||||
on_connect:
|
||||
then:
|
||||
- script.execute: wake_backlight
|
||||
- lambda: |-
|
||||
id(atorch_connected) = true;
|
||||
id(display_page) = 1;
|
||||
@@ -132,6 +168,12 @@ ble_client:
|
||||
id(display_page) = 0;
|
||||
}
|
||||
id(lcd).update();
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
return !owon_meter.connected && !id(atorch_connected);
|
||||
then:
|
||||
- script.execute: backlight_idle
|
||||
|
||||
atorch_dl24:
|
||||
- id: atorch0
|
||||
@@ -291,6 +333,15 @@ touchscreen:
|
||||
- platform: ft63x6
|
||||
id: touch
|
||||
display: lcd
|
||||
on_touch:
|
||||
then:
|
||||
- script.execute: wake_backlight
|
||||
- if:
|
||||
condition:
|
||||
lambda: |-
|
||||
return !owon_meter.connected && !id(atorch_connected);
|
||||
then:
|
||||
- script.execute: backlight_idle
|
||||
|
||||
binary_sensor:
|
||||
- platform: touchscreen
|
||||
|
||||
Reference in New Issue
Block a user