esprfid / esp-rfid

ESP8266 RFID (RC522, PN532, Wiegand, RDM6300) Access Control system featuring WebSocket, JSON, NTP Client, Javascript, SPIFFS
MIT License
1.33k stars 417 forks source link

getuserlist mqtt command doesn't return expected list #596

Closed pshotton closed 9 months ago

pshotton commented 1 year ago

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.

matjack1 commented 9 months ago

This is fixed in the dev branch already :)