ESP-RFID MQTT do not work

Hi, I have a working setup with ESP-RFID, and also working MQTT (Mosquitto broker), but the RFID does not publish any message, so I can’t use it with my homeassistant. I am using the same ip, password, and others as on my working sonoff MQTT
I have read some posts about it, year old posts, so I hope someone has a solution now.
I have version 1.0.2 of RFID
Does anyone have the same problem?

The latest version of ESP-RFID has an option in the web interface to set the MQTT logging. You want this. If you don’t, it logs everything to the board and doesn’t send it to your MQTT broker.

Yes I know, I added the MQTT to my ESPRFID but it does not work, and many people argued about the not working MQTT year ago so I hoped it would work now, but it does not for me I have the same problem like the did, but they did not find any solution.

203	WARN	mqtt	Disconnected from MQTT server	TCP_DISCONNECTED	2019-07-11-15:07:43
202	WARN	mqtt	Disconnected from MQTT server	MQTT_NOT_AUTHORIZED	2019-07-11-15:07:43
201	WARN	mqtt	Disconnected from MQTT server	TCP_DISCONNECTED	2019-07-11-15:06:43
200	WARN	mqtt	Disconnected from MQTT server	MQTT_NOT_AUTHORIZED	2019-07-11-15:06:43

Are you able to connect to the broker with a 3rd party tool like MQTT.fx?

Yes, I use also MQTT Rxplorer, everything works.

Did you happen to implement the NodeRED flow that marelab created when he updated the latest firmware when it was recently merged with the original repo? There’s an awesome flow that works with MQTT and MySQL to manage your tags, users, and readers.

Yes I do use NoreRED I use it for my ESPHome and it works. But the ESPRFID does not connect to MQTT

It’s got to be user permissions or firewall. I can’t think of anything else. Which broker are you using?

Mosquitto broker

Make sure that when you add the credentials in the ESP-RFID web-interface that it’s not re-writing them when you submit (like it’s using saved information). That’s all I can think of at this point.

:confused: I checked it, and it is correct. It is soo weird. Do you have the same version as me 1.0.2 ?

ESP-RFID?

Nope. I jumped up to 1.3.3 Hot Fix, which incidentally still reports as 1.3.1 when it’s loaded (as of a few weeks ago when I flashed), but in fact works. Download the latest release and re-flash.

After upgrading to 1.3.3 mqtt works for me too but had to use a different topic e.g. esprfid/send instead of just esprfid.

My problem though is that I can’t get the payload to work for my automations.

According to Dr.Zzs video you can just add your tag’s user name to the payload but I don’t think that works anymore.

Hallo,

could´ anyone tell how to set the automation now? MQTT works fine got:
{
“type”: “access”,
“time”: 1572542188,
“isKnown”: “true”,
“access”: “Admin”,
“username”: “Karte”,
“uid”: “2ab99216”,
“door”: “esp-rfid”
}

But…how to generate the Payload? Cause time ist different every time. The automation should only be triggered whenn username=Karte

Best regards

Hi
I have the same problem
Do you have solution ?
The payload is different (esprfid/send) and not only esprfid.
I can’t call my automation .
Regards

Hi
I have the same problem, topic genered to mqtt is esprfid/send. My payload dont work !
Can you have a solution ?
Regards

Hello,

it´s quite simple:

  1. Build a sensor like:
   - platform: mqtt
     name: "rfid_reading2"
     state_topic: "rfid/send"
     value_template: "{{ value_json.access }}"
     expire_after: 2

The expire is needed to clear the value of the sensor. Otherwise you can´t toogle (or you need a card with no access)

  1. Automation:
#Test RFID
- id: 'testfrid1'
  alias: testrfid
  trigger:
  - entity_id: sensor.rfid_reading2
    platform: state
    to: 'Always'
  condition: []
  action:
  - entity_id: switch.sampleswitch
    service: switch.toggle

Now every card which has always access will toogle the switch.

Sorry for my poor english…still workin on
BG,

Hi
My automation work very well if i cancel (payload :slight_smile: every users can change switch
but if i use payload with “name” , switch state don’t change.
Request on mqtt broker are OK.
I need chose autorized users only (ex: “georges”, “isabelle”…)

  alias: RFID V2
  description: ''
  trigger:
  - payload: "georges"
    platform: mqtt
    topic: esprfid/send
  condition: []
  action:
  - data:
      entity_id: switch.sonoff
    service: switch.toggle
  hide_entity: true
  initial_state: 'on'
Thank you for your help

ON MQTT
Message 210 reçu sur esprfid/send à 21:39 :
{
    "cmd": "log",
    "type": "access",
    "time": 1573591165,
    "isKnown": "true",
    "access": "Admin",
    "username": "georges",
    "uid": "89b12b9",
    "door": "esp-rfid"
}

Regards

Problem is :

your mqtt payload :

{
    "cmd": "log",
    "type": "access",
    "time": 1573591165,
    "isKnown": "true",
    "access": "Admin",
    "username": "georges",
    "uid": "89b12b9",
    "door": "esp-rfid"
}

and your trigger checks for payload : “georges”

These don’t match.

You need something as

alias: RFID V2
  description: ''
  trigger:
  - platform: mqtt
    topic: esprfid/send
  condition:
  - condition: template
    value_template: '{{trigger.value_json.username ==  "georges" }}'
  action:
  - data:
      entity_id: switch.sonoff
    service: switch.toggle
  hide_entity: true
  initial_state: 'on'

Hi Francis
Thank you for your help. I tested this solution on automation.yaml but didn’t work, switch state don’t change.
What need i change ?

  alias: RFID V3
  description: ''
  trigger:
  - platform: mqtt
    topic: esprfid/send
  condition:
  - condition: template
    value_template: '{{trigger.value_json.username ==  "georges" }}'
  action:
  - data:
      entity_id: switch.sonoff
    service: switch.toggle
  hide_entity: true
  initial_state: 'on'

Can you help me please ?
Regards