stas-demydiuk / ewpe-smart-mqtt

MQTT bridge for EWPE Smart powered devices
MIT License
64 stars 26 forks source link

Issue with new ewpe ac devices #23

Open NickB1 opened 3 years ago

NickB1 commented 3 years ago

Hi,

Thanks for the great work on this program. I'm trying to read out two ac units which have been installed today with ewpe wifi modules. Unfortunately I get a cipher error:

> ewpe-smart-mqtt@1.0.4 start
> node index.js

2021-08-16T19:36:47.375Z [info]: Trying to connect to MQTT server mqtt://127.0.0.1 ...
2021-08-16T19:36:48.318Z [info]: Successfully connected to MQTT server
2021-08-16T19:36:48.483Z [info]: Socket server is listening on 0.0.0.0:36315
2021-08-16T19:36:48.489Z [info]: Scanning network 192.168.1.255 for available devices...
node:internal/crypto/cipher:193
  const ret = this[kHandle].final();
                            ^

Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
    at Decipheriv.final (node:internal/crypto/cipher:193:29)
    at decrypt (/opt/ewpe-smart-mqtt/app/encryptor.js:15:48)
    at Connection.handleResponse (/opt/ewpe-smart-mqtt/app/connection.js:110:26)
    at Socket.emit (node:events:394:28)
    at UDP.onMessage [as onmessage] (node:dgram:931:8) {
  library: 'digital envelope routines',
  function: 'EVP_DecryptFinal_ex',
  reason: 'wrong final block length',
  code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH'
}
npm notice
npm notice New minor version of npm available! 7.15.1 -> 7.20.6
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.20.6
npm notice Run npm install -g npm@7.20.6 to update!
npm notice

Any idea what the problem could be? Maybe something changed in the communication protocol of the new devices?

Best regards

jodewee commented 2 years ago

same issue over here

jodewee commented 2 years ago

@NickB1 did you make any progress on thin one?

find-a-good-nickname commented 2 years ago

I got the same error exactly.

npm version: 8.18.0 node version: 16.13.1

`pi@raspberrypi:~/ewpe-smart-mqtt $ npm start

ewpe-smart-mqtt@1.0.5 start node index.js

2022-08-24T04:41:41.770Z [info]: Trying to connect to MQTT server mqtt://localhost ... 2022-08-24T04:41:41.968Z [info]: Successfully connected to MQTT server 2022-08-24T04:41:41.988Z [info]: Socket server is listening on 0.0.0.0:37104 2022-08-24T04:41:41.989Z [info]: Scanning network 192.168.10.71 for available devices... 2022-08-24T04:41:42.030Z [info]: New device found: (mac: 502cc6bc13e0), binding... 2022-08-24T04:41:42.048Z [info]: New device bound: (192.168.10.71:7000) 2022-08-24T04:41:42.052Z [info]: MQTT message received: ewpe-smart/502cc6bc13e0 {cid:,bc:gree,brand:gree,catalog:gree,mac:502cc6bc13e0,mid:10001,model:gree,name:,lock:0,series:gree,vender:1,ver:V3.0.0,address:192.168.10.71,port:7000,key:oxk22YP1uj0S97fd} node:internal/crypto/cipher:193 const ret = this[kHandle].final(); ^

Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt at Decipheriv.final (node:internal/crypto/cipher:193:29) at decrypt (/home/pi/ewpe-smart-mqtt/app/encryptor.js:15:48) at Connection.handleResponse (/home/pi/ewpe-smart-mqtt/app/connection.js:110:26) at Socket.emit (node:events:402:35) at UDP.onMessage [as onmessage] (node:dgram:939:8) { library: 'digital envelope routines', function: 'EVP_DecryptFinal_ex', reason: 'bad decrypt', code: 'ERR_OSSL_EVP_BAD_DECRYPT' }

`

Xenomes commented 1 year ago

I made a patch, hopefully the owner will accept the pull requests.

stas-demydiuk commented 9 months ago

Updated the app, so it will not crash in case of decrypt failure and will just print the error to the console, I hope it will help with the issue