arthurkrupa / gree-hvac-mqtt-bridge

MQTT Bridge for controlling Gree smart air conditioners, e.g. with Home Assistant or OpenHAB
GNU General Public License v3.0
130 stars 62 forks source link

Error: "Unknown message of type bindok" #83

Open find-a-good-nickname opened 2 years ago

find-a-good-nickname commented 2 years ago

I get an error when starting this stuff. npm version: 8.18.0 node version: 16.13.0

pi@raspberrypi:~/gree-hvac-mqtt-bridge $ node index.js --hvac-host="192.168.10.71" --mqtt-broker-url="mqtt://192.168.10.2:1883" --mqtt-topic-prefix="domoticz/in" --mqtt-username="" --mqtt-password="" [MQTT] Connecting to mqtt://192.168.10.2:1883... [MQTT] Connected to broker [UDP] Connected to device at 192.168.10.71 [UDP] New device registered: [UDP] Unknown message of type bindok: { t: 'pack', i: 1, uid: 0, cid: '', tcid: 'app', pack: 'FtZAY6UHKBwtaI55He0IneqJYxO3Vlz4+hb0PtbAybYXlqXCgDxwDeT3Y77VfVElYs+kEFxiRgA9LpeTA16TdA==' }, { r: 200, t: 'bindok', mac: '', key: 'oxk22YP1uj0S97fd' }

...and then silence. I think that "bindok" is referring to binding is ok, isn't it?

reformhaz commented 1 year ago

in app/deviceFactory.js this line: this._setDevice(message.cid, pack.name, rinfo.address, rinfo.port) sets the id to cid which is empty, so I hacked it to read: this._setDevice(pack.mac, pack.name, rinfo.address, rinfo.port) that gets over the binding, but I also had to change: // If package type is response, update device properties if (pack.t === 'res' && this.device.bound) { pack.opt.forEach((opt, i) => { this.device.props[opt] = pack.v[i] }) this.options.onUpdate(this.device) return } to // If package type is response, update device properties if (pack.t === 'res' && this.device.bound) { pack.opt.forEach((opt, i) => { this.device.props[opt] = pack.p[i] }) this.options.onUpdate(this.device) return } because pack has no v field, but does have p

Please note I have no idea what and why I'm doing, but using these modifications I can use this.

lelemka0 commented 1 year ago

https://github.com/arthurkrupa/gree-hvac-mqtt-bridge/blob/fb79ae2a1169de560420d5f23e880f6cc9a300e0/app/deviceFactory.js#L157 Because the cid returned by your firmware is empty. Give my fork a try if you like. My fork is mainly dedicated to supporting sub-devices, there may be problems with single-devices, please feel free to let me know.