cflurin / xiaomi-mqtt

A Bridge between the Xiaomi Mi Smart Home Gateway and the Mqtt broker.
Apache License 2.0
50 stars 14 forks source link

Crash at : "get_id_list" #17

Open picotouch opened 3 months ago

picotouch commented 3 months ago

Hi, I installed "xiaomi-mqtt" on Proxmox 8.1 and everything works ok (after install chalk 4.1.2), only one command crashes the program. It is about the "get_id_list" command;

(topic: xiaomi/to/get_id_list 
payload: {"sid":"fff..."}

The command is correct, I copied it from Node-RED running on Raspberry Pi3 from 2019... ;)

I assume that it is about some kind of breaking changes/dependencies during this long period... If there is any help, I would appreciate it!

c/p of error:

node:internal/validators:424
    throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);
    ^

RangeError [ERR_SOCKET_BAD_PORT]: Port should be > 0 and < 65536. Received type number (0).
    at validatePort (node:internal/validators:424:11)
    at Socket.send (node:dgram:632:12)
    at get_id_list (/root/xiaomi-mqtt/index.js:180:10)
    at MqttClient.<anonymous> (/root/xiaomi-mqtt/lib/mqtt.js:94:9)
    at MqttClient.emit (node:events:518:28)
    at handlePublish (/root/xiaomi-mqtt/node_modules/mqtt/build/lib/handlers/publish.js:97:20)
    at handle (/root/xiaomi-mqtt/node_modules/mqtt/build/lib/handlers/index.js:28:35)
    at work (/root/xiaomi-mqtt/node_modules/mqtt/build/lib/client.js:225:40)
    at writable._write (/root/xiaomi-mqtt/node_modules/mqtt/build/lib/client.js:250:13)
    at writeOrBuffer (/root/xiaomi-mqtt/node_modules/readable-stream/lib/internal/streams/writable.js:334:12) {
  code: 'ERR_SOCKET_BAD_PORT'
}

Node.js v20.11.1

By the way, I use "xiaomi-mqtt" since 2019, 24/7/365, it just works without error!