From 914b9f7449f144a81ef281211502d4f797c83977 Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 27 Dec 2023 21:09:03 -0800 Subject: [PATCH] Refactor initial debug logging to one action --- mikes-motion-activated-scenes.yaml | 50 ++++++++++-------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/mikes-motion-activated-scenes.yaml b/mikes-motion-activated-scenes.yaml index be21537..38cdfc7 100644 --- a/mikes-motion-activated-scenes.yaml +++ b/mikes-motion-activated-scenes.yaml @@ -229,14 +229,16 @@ 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: - - condition: template - value_template: "{{ not enabled_helper == None }}" + + - alias: "Debug log whether the enabled_helper was set" + if: + - condition: template + value_template: "{{ not enabled_helper == None }}" then: - service: logbook.log data: @@ -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 + - alias: "Debug log the enabled_helper name" + 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 + - alias: "Debug log the current delay_seconds value" + 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 }} " - + - 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 #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