mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 09:06:52 +01:00
No panel uses common/nspanel.yaml, nspanel_popup.yaml, nspanel_sleep_dim.yaml or the lui.tft secret any more.
45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
---
|
|
# NSPanel sleep dim: the idle (dimmed) brightness drops to 0 at night
|
|
# (sun below -6°), unless the room light is on. Sets the idle_brightness global of panel.yaml (${dim_brightness} or 0).
|
|
# packages:
|
|
# sleep_dim: !include
|
|
# file: common/nspanel_terminal/sleep_dim.yaml
|
|
# vars:
|
|
# sleep_override_entity: light.bedroom_lights
|
|
script:
|
|
- id: apply_sleep_dim
|
|
then:
|
|
- lambda: |-
|
|
bool day = id(sun_id).is_above_horizon(-6);
|
|
id(idle_brightness) = id(sleep_override).state == "on" || day ? ${dim_brightness} : 0;
|
|
if (id(dimmed))
|
|
id(panel).request_brightness(id(idle_brightness));
|
|
|
|
time:
|
|
- id: !extend ha_time
|
|
on_time_sync:
|
|
- script.execute: apply_sleep_dim
|
|
|
|
text_sensor:
|
|
# sleepOverride; text, not binary: a binary sensor drops "unavailable"
|
|
- platform: homeassistant
|
|
id: sleep_override
|
|
entity_id: ${sleep_override_entity}
|
|
internal: true
|
|
on_value:
|
|
- script.execute: apply_sleep_dim
|
|
|
|
sun:
|
|
id: sun_id
|
|
time_id: ha_time
|
|
latitude: 48.15°
|
|
longitude: 17.11°
|
|
on_sunrise:
|
|
- elevation: -6°
|
|
then:
|
|
- script.execute: apply_sleep_dim
|
|
on_sunset:
|
|
- elevation: -6°
|
|
then:
|
|
- script.execute: apply_sleep_dim
|