Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore light state on boot #61

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ substitutions:
LIGHT_TRANSITION_TURN_OFF: '0' # Transition time in msec
LIGHT_BRIGHTNESS_TURN_ON: '0' # Brightness (1 to 100%, 0 to not set it)

LIGHT_FULL_RESTORE_MODE: RESTORE_DEFAULT_OFF
LIGHT_SIDES_RESTORE_MODE: RESTORE_DEFAULT_OFF
LIGHT_INDIVIDUAL_RESTORE_MODE: RESTORE_DEFAULT_OFF
LIGHT_RELAYS_RESTORE_MODE: RESTORE_DEFAULT_OFF

globals:
- id: gb_lights_1
type: std::vector<light::LightState*>
Expand All @@ -44,6 +49,7 @@ light:
# method: esp32_rmt
num_leds: 32
pin: GPIO13
restore_mode: ${LIGHT_FULL_RESTORE_MODE}

# Those lights are available based on the model selections
- &light_partition_with_effects
Expand All @@ -52,6 +58,7 @@ light:
platform: partition
default_transition_length: ${default_transition_length}
internal: true
restore_mode: ${LIGHT_SIDES_RESTORE_MODE}
effects:
- addressable_rainbow:
name: "Rainbow"
Expand Down Expand Up @@ -184,6 +191,7 @@ light:
platform: partition
disabled_by_default: true
default_transition_length: ${default_transition_length}
restore_mode: ${LIGHT_INDIVIDUAL_RESTORE_MODE}
segments:
- id: light_full
from: 0
Expand Down Expand Up @@ -417,6 +425,7 @@ light:
platform: partition
internal: true
default_transition_length: ${default_transition_length}
restore_mode: ${LIGHT_RELAYS_RESTORE_MODE}
segments:
- id: light_full
from: 9
Expand Down
10 changes: 6 additions & 4 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ substitutions:
RELAY_MODE_TEXT_SWITCH: "Switch"
RELAY_MODE_TEXT_LIGHT: "Light"
RELAY_MODE_TEXT_NOT_USED: "Not in use"
RELAY_RESTORE_MODE: RESTORE_DEFAULT_OFF

globals:
- id: boot_initialization_relays
Expand All @@ -29,6 +30,7 @@ light:
output: output_relay_1
platform: binary
internal: true
restore_mode: ${RELAY_RESTORE_MODE}
on_turn_on:
then:
- if:
Expand Down Expand Up @@ -349,7 +351,7 @@ switch:
name: Relay 1
output: output_relay_1
platform: output
restore_mode: RESTORE_DEFAULT_OFF
restore_mode: ${RELAY_RESTORE_MODE}
internal: true
on_turn_on:
then:
Expand All @@ -372,7 +374,7 @@ switch:
name: Relay 2
output: output_relay_2
platform: output
restore_mode: RESTORE_DEFAULT_OFF
restore_mode: ${RELAY_RESTORE_MODE}
internal: true
on_turn_on:
then:
Expand All @@ -395,7 +397,7 @@ switch:
name: Relay 3
output: output_relay_3
platform: output
restore_mode: RESTORE_DEFAULT_OFF
restore_mode: ${RELAY_RESTORE_MODE}
internal: true
on_turn_on:
then:
Expand All @@ -418,7 +420,7 @@ switch:
name: Relay 4
output: output_relay_4
platform: output
restore_mode: RESTORE_DEFAULT_OFF
restore_mode: ${RELAY_RESTORE_MODE}
internal: true
on_turn_on:
then:
Expand Down
Loading