Re-enable old "on before off" code
This commit is contained in:
parent
76d8721a7c
commit
9daf98c604
@ -138,22 +138,22 @@ blueprint:
|
||||
mode: box
|
||||
|
||||
|
||||
# on_just_before_off_seconds:
|
||||
# name: "\"On\" just before \"Off\""
|
||||
# description: >
|
||||
# When the "Off" scene is about to be shown, you may wish to quickly show the "On" scene for a number of seconds just before.
|
||||
# This is sometimes helpful to mitigate an issue where the "On" scene doesn't apply all colors and settings correctly from an "Off" state.
|
||||
# Set this to a value greater than 0 to enable.
|
||||
# A value of 0 will disable this feature.
|
||||
# Note that sometimes, a value that is too short (e.g., 1) may also cause issues.
|
||||
#
|
||||
# default: 1
|
||||
# selector:
|
||||
# number:
|
||||
# min: 1
|
||||
# max: 86400
|
||||
# step: 1
|
||||
# mode: box
|
||||
on_just_before_off_seconds:
|
||||
name: "\"On\" just before \"Off\""
|
||||
description: >
|
||||
When the "Off" scene is about to be shown, you may wish to quickly show the "On" scene for a number of seconds just before.
|
||||
This is sometimes helpful to mitigate an issue where the "On" scene doesn't apply all colors and settings correctly from an "Off" state.
|
||||
Set this to a value greater than 0 to enable.
|
||||
A value of 0 will disable this feature.
|
||||
Note that sometimes, a value that is too short (e.g., 1) may also cause issues.
|
||||
|
||||
default: 1
|
||||
selector:
|
||||
number:
|
||||
min: 1
|
||||
max: 86400
|
||||
step: 0.1
|
||||
mode: box
|
||||
|
||||
|
||||
enabled_helper:
|
||||
@ -204,7 +204,7 @@ variables:
|
||||
delay_seconds_max: !input delay_seconds_max
|
||||
notice_seconds: !input notice_seconds
|
||||
warning_seconds: !input warning_seconds
|
||||
# on_just_before_off_seconds: !input on_just_before_off_seconds
|
||||
on_just_before_off_seconds: !input on_just_before_off_seconds
|
||||
enabled_helper: !input enabled_helper
|
||||
disabled_scene: !input disabled_scene
|
||||
debug_mode: !input debug_mode
|
||||
@ -278,11 +278,11 @@ action:
|
||||
name: "Delay seconds"
|
||||
message: "Delay seconds is: {{ states[delay_seconds_helper].state }}"
|
||||
|
||||
# - alias: "Debug log the on_just_before_off_seconds value"
|
||||
# service: logbook.log
|
||||
# data:
|
||||
# name: "Debug: On just before off seconds"
|
||||
# message: "On just before off is: {{ on_just_before_off_seconds }} "
|
||||
- alias: "Debug log the on_just_before_off_seconds value"
|
||||
service: logbook.log
|
||||
data:
|
||||
name: "Debug: On just before off seconds"
|
||||
message: "On just before off is: {{ on_just_before_off_seconds }} "
|
||||
|
||||
# Take actions based on whether the "Enabled helper" was just toggled on or off
|
||||
# Action #1
|
||||
@ -682,34 +682,34 @@ action:
|
||||
# Finally, we decide to actually turn off the lights with the "Off" scene.
|
||||
|
||||
# Maybe turn on the "On" scene just before the "Off" scene, if the user enabled this option
|
||||
# - if:
|
||||
# - condition: template
|
||||
# value_template: "{{ on_just_before_off_seconds > 0 }}"
|
||||
# then:
|
||||
# - alias: "Log the number of on-before-off seconds"
|
||||
# if:
|
||||
# - condition: template
|
||||
# value_template: "{{ debug_mode == true }}"
|
||||
# then:
|
||||
# service: logbook.log
|
||||
# data:
|
||||
# name: "On-Before-Off seconds"
|
||||
# message: "Will turn on for {{ on_just_before_off_seconds }} seconds before off."
|
||||
# - service: scene.turn_on
|
||||
# target:
|
||||
# entity_id: !input scene_on
|
||||
# - alias: "Wait a second to set the \"On\" scene."
|
||||
# delay:
|
||||
# seconds: "{{ on_just_before_off_seconds }}"
|
||||
# else:
|
||||
# - if:
|
||||
# - condition: template
|
||||
# value_template: "{{ debug_mode == true }}"
|
||||
# then:
|
||||
# - service: logbook.log
|
||||
# data:
|
||||
# name: "Won't run on-before-off"
|
||||
# message: "Won't run on-before-off because seconds was less than 1"
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ on_just_before_off_seconds > 0 }}"
|
||||
then:
|
||||
- alias: "Log the number of on-before-off seconds"
|
||||
if:
|
||||
- condition: template
|
||||
value_template: "{{ debug_mode == true }}"
|
||||
then:
|
||||
service: logbook.log
|
||||
data:
|
||||
name: "On-Before-Off seconds"
|
||||
message: "Will turn on for {{ on_just_before_off_seconds }} seconds before off."
|
||||
- service: scene.turn_on
|
||||
target:
|
||||
entity_id: !input scene_on
|
||||
- alias: "Wait a second to set the \"On\" scene."
|
||||
delay:
|
||||
seconds: "{{ on_just_before_off_seconds }}"
|
||||
else:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ debug_mode == true }}"
|
||||
then:
|
||||
- service: logbook.log
|
||||
data:
|
||||
name: "Won't run on-before-off"
|
||||
message: "Won't run on-before-off because seconds was less than 1"
|
||||
|
||||
- alias: "Activate Scene: Off (Done)"
|
||||
repeat:
|
||||
|
Loading…
Reference in New Issue
Block a user