reneklootwijk / node-mideahvac

MIT License
82 stars 7 forks source link

OSK103 Discovery fail #16

Closed Fillip38 closed 1 year ago

Fillip38 commented 1 year ago

Hello, After the update, I'm trying to reconnect my Midea air conditioners with the original OSK103 dongle in NodeRed, I've finally managed to get the discovery function to work halfway (it doesn't want to work under Docker) However, when I run it, I get the following message:

root@raspberrypi:~# node_modules/.bin/midea-discover --user=mail@adress.de --password=yyy /root/node_modules/node-mideahvac/discover.js:167 macAddress: ${data[63 + data[40]].toString(16)}:${data[64 + data[40]].toString(16)}:${data[65 + data[40]].toString(16)}:${data[66 + data[40]].toString(16)}:${data[67 + data[40]].toString(16)}:${data[68 + data[40]].toString(16)}, TypeError: Cannot read properties of undefined (reading 'toString') at Socket. (/root/node_modules/node-mideahvac/discover.js:167:42) at Socket.emit (node:events:527:28) at UDP.onMessage [as onmessage] (node:dgram:922:8) Node.js v17.9.0

reneklootwijk commented 1 year ago

Can you. insert the following line on line 156 (just after if (msg[0] === 0x5A && msg.length >= 104) {) and post the log message?

  console.log(`MSG: ${JSON.stringify(msg)}, INFO: ${JSON.stringify(info)}`);

and what was the issue with running in docker?

Fillip38 commented 1 year ago

It works now, it was my fault, I had installed the wrong package, not "your" npm install node-mideahvac

However, after the scan it shows me "Found 0 appliances" although I have three air conditioners in the MSmart app and can also control them...

reneklootwijk commented 1 year ago

I released a new version of the code which fixed a signing issue during discovery and also removed an explicit timeout on the process logging in with Midea to obtain the key and token.

I also added an option you to specify the target address used during discovery. By default the broadcast 255.255.255.255 is used which only will detect appliances on the same subnet as the computer running the discover command. This might the cause it is not working from within Docker. Can you try specifying either the broadcast address of the network your appliances are in or the actual IP address of the appliance?

reneklootwijk commented 1 year ago

Closed because no response