From f7d503418d23c4df920ded7be12c226da0b74e16 Mon Sep 17 00:00:00 2001 From: neri Date: Sat, 2 Mar 2024 02:57:28 +0100 Subject: [PATCH] green blink --- mlock-common.yaml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mlock-common.yaml b/mlock-common.yaml index 0ceb6d8..bd1f9aa 100644 --- a/mlock-common.yaml +++ b/mlock-common.yaml @@ -16,12 +16,12 @@ esphome: platform: ESP8266 board: d1_mini on_boot: - - priority: 600 - then: - - light.addressable_set: { id: status_led, red: 0%, green: 0%, blue: 50% } - priority: -100 then: - light.addressable_set: { id: status_led, red: 0%, green: 0%, blue: 100% } + # - priority: 600 + # then: + # - light.addressable_set: { id: status_led, red: 0%, green: 0%, blue: 50% } # Enable logging logger: @@ -75,11 +75,7 @@ rc522_spi: cs_pin: GPIO15 on_tag: then: - - light.addressable_set: - id: status_led - red: 100% - green: 100% - blue: 0% + - light.addressable_set: { id: status_led, red: 100%, green: 100%, blue: 0% } # store the tag id into global variable - lambda: |- id(my_tag) = x; @@ -121,8 +117,15 @@ rc522_spi: condition: lambda: 'return id(may_switch_output);' then: - - switch.turn_on: mlock_${name_of_board}_switch - else: + - if: + condition: + switch.is_on: mlock_${name_of_board}_switch + then: # allowed, but already on, blink once + - light.addressable_set: { id: status_led, red: 0%, green: 0%, blue: 0% } + - delay: 0.5s + else: + - switch.turn_on: mlock_${name_of_board}_switch + else: # not allowed, blink quickly - repeat: count: 3 then: