Closed nbaglietto closed 6 years ago
You need a MQTT broker first, like http://mosquitto.org My system run on Raspberry Pi
than you can publish the UID to the broker and subscribe it with another application like NodeRed
I have installed mosquito in win 7 what I understand is that I can do with it, just install node network in win and I will try but I would like some help Thank you P.S (I do not speak English )
sorry with win 7 I'm out -I use Raspberri Pi -NodeRed -FHEM
ok entonces supongamos que instalo mosquito y node-js en una vm con ubuntu 16 como se comunica con wemos d1 mini?
@SamNitro Did you have a chance to test 0.7's MQTT functionality ?
@omersiar Yes I have ;) and it works :)
@nbaglietto yes it should be work! If you have a MQTT Broker on ubuntu 16, you can read the Topic (message / UID) on win 7 (if win7 have a MQTT client) The broker have to run 24/7 Hours, that the message can be receive.
Yea! Now my esp-rfid works and I wonder what messages are published via MQTT?
Is there any overview somewhere? I have a home-assistant with mosqitto running and wonder what nice thinks I could do now with esp-rfid...
Thinking about putting a nfc-tag on my LP-cover and instead of playing the LP with the player I could just take the cover and touch the esp-rfid. It triggers the mqtt and home assistant knows to trigger mpd which takes the right album (from the uid) and just play's it...
Everybody tested MQTT with CloudMQTT online? I did not get any message there. Everytime I reboot the ESP the option for MQTT is disabled. Version is 0.7 on NodeMCU with RC522 (works correct) Best regards
@rradar if enabled esp-rfid only publishes scanned rfid tag's uid on given topic. MQTT support is newly changed and we need testers. Feedbacks are welcome.
@thifi Does CloudMQTT supports unencrypted connections? It was working before?
CloudMQTT support 3 different cennections like: Port | 19977 SSL Port | 29977 Websockets Port (TLS only) | 39977 I used the "normal" port, I think this is unencrypted. I used it before with ESP-Easy and MQTT with success.
@thifi I do not know how to debug MQTT issues. I do not have MQTT testing environment yet.
Hello, what I do not get is that esp-rfid is connected to my mosquito broker that I have in an ubuntu 16 in esp-rfid fill the subject field I put username and password and the ip address of the broque check the enable button but it does not connect and every time I renicio appears me the disabled mqtt.
(I do not speak English )
@omersiar I get this message in the log-file of CloudMQTT if I try to connect from the esp-rfid: 2018-03-28 07:13:08: New client connected from 178.0.8.10 as ws0.8792021369477999 (c1, k60, u'pkvaifbf'). 2018-03-28 07:14:57: Socket error on client ws0.8792021369477999, disconnecting. I hope you can use it for the search of the problem...
I get feedback!
Settings in esp-rfid:
And a local mosquitto server esp-rfid connects to (without user & password for testing)
To check my success I use mqttbox which looks like this:
@thifi
maybe it's a problem with websocket? I tested with mqtt/tcp (without websocket/without encryption/without user+password) and it worked right away...
Can you flash this and look for event log? https://github.com/omersiar/esp-rfid/blob/dev/bin/firmware.bin
Hi, restart after flash ok, when I use MQTT data and restart: Exception (29) like on the picture
This is a serial copy, I could not get a webpage after restart with MQTT data.
firmware.zip Try this one please.
DHCP works fix IP works ntp works MQTT don't work with CloudMQTT I can't acess Event Log, there are only "Please wait while fetching data..." for a long time but this was with the last version too.
Clear event log and restart.
Clear is ok, after restart the same problem with Please wait while fetching data... After clear event log and access log there is no RFID Tag readable, no reaction, after reboot also.
firmware2.zip :) Can you test this one, this should create a event log with a reason
No eventlog at all, I don't whats wrong. The RFID-Reading doesn't work.
I think I have a hardware problem with 522, with original firmware 0.7 no RFID-reading :-)
ok, no hardware problem, software. I flashed esp-easy, this formated the memory, then I flashed firmware2, the esp started but no event-log. The other points works, ntp, rfid, dhcp, user and access-log ok. no mqtt
@thifi I couldn't reproduce this issue. I do not understand why your MQTT service complains about websocket. MQTT simply tries to connect given port via TCP socket.
@SamNitro Hello,
Can you please test latest dev branch MQTT functionality. To see if events correctly populated? Thank you.
Hello, I was able to test MQTT successfully on the fast, but the event log does not show any data
"Please wait while fetching data..."
I tried to establish MQTT connection in local host, as well as in cloud broker. None of them worked. I have checked the code where it was publishing and have serial printed something to see if the code is reaching there, I found that the code was actually reaching there. I think, the problem could be in the library. If you know some work around or need some help, please do tell. Can you please comment which mqtt broker you are using ? BTW this is a wonderful work you are doing here. EDIT : And also the event log is not working. EDIT 2 : MQTT working in local machine but when www.cloudmqtt.com is used , it is initially connecting but is disconnecting when something is published.
@blmhemu Thank you,
I built my MQTT test environment with mosquito. I am using RC522 reader. UID is publishing and event log works. Cloudmqtt somehow thinks esp tries to connect its Websocket and fails, sometimes Event log mentions MQTT_NOT_AUTHORIZED with cloudmqtt. I do not know why cloudmqtt is failing but esp definitely can not connect to it. Also on mosquito _sub command lists publishes as like this /esprfid/ 81a5428
there is a space between / and uid, I do not know if this is normal behaviour.
Also it seems onMqttPublish does not work. maybe mosquito does not ack the pusblish.
Hey omersiar. THX you do a great job! Today I flashed the dev firmware.
EDIT: when I enable user/pw i n my mosquitto setup, I get this error in mosquitto.log
1522598691:` Socket error on client <unknown>, disconnecting. 1522598830: New connection from 192.168.1.234 on port 1883.
when I disable user/pw in mymosquitto setup it looks like follow:
1522532621: New client connected from 192.168.1.234 as esp8266cd1d0c (c1, k15, u'ings-regular.woff').
'ings-regular.woff'
<--this should be my mosquitto user, but it isn`t. Looks like part of the code.
EDIT2:
I added my mqtt user/pw directly to th code on line 1035, then the connection works. Tested also with CloudMqtt.
Looks like here goes something wrong with getting the values from the JSON config?
const char * muser = mqtt["user"];
muser = "MyMqttUser";
const char * mpas = mqtt["pswd"];
mpas = "MyMqttPw";
Something fishy is going on between Async Web Server and Async MQTT. Both depends on Async TCP and i believe there is a TCP client collusion somehow.
@magic-tune I can confirm this. When I enter usr / pswd from web ui , it doesn't work. But I did not try doing it from code.
@omersiar I put the muser and mpas outside the scope. This works for me. If somebody wants to test. Here is the 0.7.3 dev with working mqtt user/pw authification. firmware_dev_0.7.3_mqtt_user_pw.zip
code changed from:
const char * muser = mqtt["user"];
const char * mpas = mqtt["pswd"];
to:
const char * muser;
const char * mpas;
String muserString = mqtt["user"];
muser = strdup(muserString.c_str());
String mpasString = mqtt["pswd"];
mpas = strdup(mpasString.c_str());
EDIT seems nothing todo with the scope.
@magic-tune thanks for the bug hunt. I will make changes accordingly.
How could MQTT be used? Is there an example?
Thank you (I do not speak English)