From 16ae23c54a12f4c8345f05aaa076450d4df77ba1 Mon Sep 17 00:00:00 2001 From: neri Date: Sat, 2 Mar 2024 02:32:18 +0100 Subject: [PATCH] try the impossible thing --- mlock-common.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mlock-common.yaml b/mlock-common.yaml index 1db4a6b..7bcdda1 100644 --- a/mlock-common.yaml +++ b/mlock-common.yaml @@ -106,13 +106,13 @@ rc522_spi: return ((std::string) "https://vault.ctdo.de/v1/maschinenlock/" + id(my_tag)); headers: X-Vault-Token: !lambda return id(my_token).c_str(); + verify_ssl: false on_response: - # when found, check if machine is allowed, turn on output or blink LED red then: - if: condition: lambda: 'return status_code == 200;' - then: + then: # when found, check if machine is allowed, turn on output or blink LED red - lambda: |- json::parse_json(id(http_request_data).get_string(), [](JsonObject root) { id(may_switch_output) = root["data"]["mlock-$name_of_board"]; @@ -138,7 +138,7 @@ rc522_spi: - delay: 0.5s - light.addressable_set: { id: status_led, red: 0%, green: 0%, blue: 0% } - delay: 0.5s - - if: # return LED to old state before blinking + - if: # return LED to switch state before condition: switch.is_on: mlock_${name_of_board}_switch then: @@ -153,6 +153,10 @@ switch: name: "Relais Output" id: mlock_${name_of_board}_switch internal: true # hide from Homeassistant, so no one can turn it on without Tag-Scanning + on_turn_on: + - light.addressable_set: { id: status_led, red: 0%, green: 100%, blue: 0% } + on_turn_off: + - light.addressable_set: { id: status_led, red: 100%, green: 0%, blue: 0% } binary_sensor: # sensor input for Turning Device off @@ -164,7 +168,7 @@ binary_sensor: id: ${name_of_board}gpio_input_ausschalter on_press: - switch.turn_off: mlock_${name_of_board}_switch - - light.addressable_set: { id: status_led, red: 100%, green: 0%, blue: 0% } + # - light.addressable_set: { id: status_led, red: 100%, green: 0%, blue: 0% } # a template sensor for showing the current switch state (read only) - platform: template @@ -181,7 +185,7 @@ button: id: ${name_of_board}_btn_ausschalter on_press: - switch.turn_off: mlock_${name_of_board}_switch - - light.addressable_set: { id: status_led, red: 100%, green: 0%, blue: 0% } + # - light.addressable_set: { id: status_led, red: 100%, green: 0%, blue: 0% } light: - platform: neopixelbus