esprfid / esp-rfid

ESP8266 RFID (RC522, PN532, Wiegand, RDM6300) Access Control system featuring WebSocket, JSON, NTP Client, Javascript, SPIFFS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getuserlist mqtt command doesn't return expected list

pshotton opened this issue · comments

When I issue the mqtt command getuserlist it doesn't provide the documented response. Instead it provides a steadily growing list of uids as follows:
{"list":[{"uid":"3495223"},{"uid":"3440285"},{"uid":"3216488"},{"uid":"3555367"},{"uid":"3406010"},{"uid":"3330112"},{"uid":"8887412"},{"uid":"9211455"},{"uid":"9205583"},{"uid":"13037518"},{"uid":"8874809"},{"uid":"9230373"}]} {"list":[{"uid":"3495223"},{"uid":"3440285"},{"uid":"3216488"},{"uid":"3555367"},{"uid":"3406010"},{"uid":"3330112"},{"uid":"8887412"},{"uid":"9211455"},{"uid":"9205583"},{"uid":"13037518"},{"uid":"8874809"},{"uid":"9230373"}]} {"list":[{"uid":"3495223"},{"uid":"3440285"},{"uid":"3216488"},{"uid":"3555367"},{"uid":"3406010"},{"uid":"3330112"},{"uid":"8887412"},{"uid":"9211455"},{"uid":"9205583"},{"uid":"13037518"},{"uid":"8874809"},{"uid":"9230373"}]}
Looking at the code it doesn't appear to be doing what I'd expect (but I'm no javascript programmer).
What seems to be happening is that the getUserList method creates a root document, and for each uid, adds the uid to the root document and then publishes it. The full detail is read and decoded but never sent.
I think the
mqttPublishEvent(&root);
should be
mqttPublishEvent(&json);
but I don't want to break my working lock system to try it out. Interested in other's views.

This is fixed in the dev branch already :)