ESPRFID - Issue - Automation question

Hi,

I think you alle may know or not know the esprfid mqtt https://github.com/esprfid/esp-rfid software. Nice piece of work

First of all, I got it running, kind of.
The payload it sends over the mqtt is quite a lot like the following:

{"type":"access","time":1567704115,"isKnown":"true","access":"Admin","username":"user1","uid":"693cdb39"}

**qos**  : 0,  **retain**  : false,  **cmd**  : publish,  **dup**  : false,  **topic**  : esprfid,  **messageId**  : ,  **length**  : 115,  **Raw payload** : 123341161211121013458349799991011151153444341161051091013458495354555548524949534434105115751101111191103458341161141171013444349799991011151153458346510010910511034443411711510111411097109101345834116104111109971153444341171051003458345457519910098515734125

So I created a mqtt sensor like this:

- platform: mqtt
  name: "rfid_reading"
  state_topic: "esprfid"
  value_template: "{{ value_json.uid }}"

This gives me the uid of the card I scan.
Than i do an automation:

- alias: RFID desktoplight
  trigger:
  - platform: state
    entity_id: sensor.rfid_lesen
    to: "693cdb39"
  action:
  - service: light.toggle
    data:
      entity_id:  light.buro

As you can see I want to google the light, but as the value of the sensor already changes to 693cdb39, I have to scan first another rfid card and then the card with the uid to toogle the light.

Now I am thinking of making an automation to change the every 10 second oder after any change, if this is possible.
But I have the feeling that there is a better way and I am just not seeing it, does anyone have another idea how to do this better ?

I have to push it sorry, no one does have an idea ?

Thanks in advance

So, in case anyone ever has the same issue, thanks to Underknowledge from the chat… it is as simple as that…
Using the Expire after option.
Works fine !

Thanks

Did you get the MQTT fixed though? It keeps getting disconnected from the HA broker and never reconnects again unless I reboot esprfid

Hi,

yes, I used an older version and only configure it with chrome.

I read about an issue, with some other browser that I can happen that I will get into trouble

Which version are you using?