Refactor initial debug logging to one action

This commit is contained in:
mike 2023-12-27 21:09:03 -08:00
parent 467fcd30e3
commit 914b9f7449

View File

@ -229,12 +229,14 @@ trigger:
action:
# Action #0
- alias: "Debug log whether the enabled_helper was set"
- alias: "Initial debug logging"
if:
- condition: template
value_template: "{{ debug_mode == true }}"
then:
- if:
- alias: "Debug log whether the enabled_helper was set"
if:
- condition: template
value_template: "{{ not enabled_helper == None }}"
then:
@ -248,45 +250,26 @@ action:
name: "Enabled helper"
message: "Enabled helper is not set."
# Action #1
- alias: "Debug log the enabled_helper name"
if:
- condition: template
value_template: "{{ debug_mode == true }}"
then:
- service: logbook.log
service: logbook.log
data:
name: "Enabled helper"
message: "Enabled helper name is: {{ enabled_helper }}"
# Action #2
- alias: "Debug log the current delay_seconds value"
if:
- condition: template
value_template: "{{ debug_mode == true }}"
then:
- service: logbook.log
service: logbook.log
data:
name: "Delay seconds"
message: "Delay seconds is: {{ states[delay_seconds_helper].state }}"
# Action #3
- alias: "Debug log the on_just_before_off_seconds value"
if:
- condition: template
value_template: "{{ debug_mode == true }}"
then:
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 #4
# Action #1
- if:
- condition: trigger
id:
@ -389,6 +372,7 @@ action:
# Take actions based on whether Motion is detected
# Action #2
- alias: "Refuse to do anything if the enabled-helper says we're OFF."
if:
- condition: template