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