Hallo zusammen,
Ich habe in ESPHome einen RFID Reader laufen.
Nun möchte ich beim Lesen eines bestimmten TAGs eine Aktion ausführen.
Ich habe an einem ESP8266 am GPIO4 eine LED angeschlossen.
Beim Lesen des Tags soll die LED toggeln
- mal lesen → LED ein
- mal lesen → LED aus
- mal lesen → LED ein
unten ist mein Code. Das Problem ist nur, dass die Lampe bei jedem Tag bzw uid toggelt.
Wie kann ich es realisieren, dass der Code immer nur bei einem bestimmten Tag ausgeführt wird?
rc522_spi: # or rc522_i2c
cs_pin: GPIO15
update_interval: 1s
on_tag:
then:
if:
condition:
or:
- binary_sensor.is_on: Tag1
- binary_sensor.is_off: Tag1
then:
if:
condition:
and:
- light.is_off: light_1
then:
- homeassistant.tag_scanned: !lambda 'return x;'
- light.turn_on: light_1
else:
- light.turn_off: light_1
light:
- platform: status_led
name: "StatusLED"
pin: GPIO4
id: light_1
binary_sensor:
- platform: rc522
uid: 33-64-F2-1A
name: "TAG 1"
id: Tag1