Open jodewee opened 2 years ago
I made a patch, hopefully the owner will accept the pull requests.
Is there a way to get this already working in docker?
I forgot to test it in Docker ... 😱 I am running it as a service. I will check it tonight.
Docker is fixed,
cd ~
git clone https://github.com/Xenomes/ewpe-smart-mqtt.git
cd ewpe-smart-mqtt
git checkout fix
npm install
docker build . -t ewpe-smart-mqtt
docker run -it \
--network="host" \
-e "MQTT_SERVER=mqtt://127.0.0.1" \
-e "MQTT_BASE_TOPIC=ewpe-smart" \
-e "NETWORK=192.168.1.255" \
-e "DEVICE_POLL_INTERVAL=5000" \
--name ewpe-smart-mqtt \
ewpe-smart-mqtt:latest
Get this Which linux distro and version do you use? [image: image.png]
Op wo 19 okt. 2022 om 07:23 schreef Xenomes @.***>:
Docker is fixed,
cd ~ git clone https://github.com/Xenomes/ewpe-smart-mqtt.git cd ewpe-smart-mqtt git checkout fix npm install docker build . -t ewpe-smart-mqtt docker run -it \ --network="host" \ -e "MQTT_SERVER=mqtt://127.0.0.1" \ -e "MQTT_BASE_TOPIC=ewpe-smart" \ -e "NETWORK=192.168.1.255" \ -e "DEVICE_POLL_INTERVAL=5000" \ --name ewpe-smart-mqtt \ ewpe-smart-mqtt:latest
— Reply to this email directly, view it on GitHub https://github.com/stas-demydiuk/ewpe-smart-mqtt/issues/29#issuecomment-1283446996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJSNL5I3OYQSKF46H2MIT53WD6AU7ANCNFSM5WH3K3WQ . You are receiving this because you authored the thread.Message ID: @.***>
-- Jo De Wée
Steystraat 60 3200 Aarschot +32 (0)479 99 01 05 @.***
Hmm, tried in ubuntu, but still the same issue; Is the command to run the docker ok? [image: image.png]
Op wo 19 okt. 2022 om 07:23 schreef Xenomes @.***>:
Docker is fixed,
cd ~ git clone https://github.com/Xenomes/ewpe-smart-mqtt.git cd ewpe-smart-mqtt git checkout fix npm install docker build . -t ewpe-smart-mqtt docker run -it \ --network="host" \ -e "MQTT_SERVER=mqtt://127.0.0.1" \ -e "MQTT_BASE_TOPIC=ewpe-smart" \ -e "NETWORK=192.168.1.255" \ -e "DEVICE_POLL_INTERVAL=5000" \ --name ewpe-smart-mqtt \ ewpe-smart-mqtt:latest
— Reply to this email directly, view it on GitHub https://github.com/stas-demydiuk/ewpe-smart-mqtt/issues/29#issuecomment-1283446996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJSNL5I3OYQSKF46H2MIT53WD6AU7ANCNFSM5WH3K3WQ . You are receiving this because you authored the thread.Message ID: @.***>
-- Jo De Wée
Steystraat 60 3200 Aarschot +32 (0)479 99 01 05 @.***
Got it connected to mqtt, but fails to start;
[image: image.png]
Op wo 19 okt. 2022 om 07:23 schreef Xenomes @.***>:
Docker is fixed,
cd ~ git clone https://github.com/Xenomes/ewpe-smart-mqtt.git cd ewpe-smart-mqtt git checkout fix npm install docker build . -t ewpe-smart-mqtt docker run -it \ --network="host" \ -e "MQTT_SERVER=mqtt://127.0.0.1" \ -e "MQTT_BASE_TOPIC=ewpe-smart" \ -e "NETWORK=192.168.1.255" \ -e "DEVICE_POLL_INTERVAL=5000" \ --name ewpe-smart-mqtt \ ewpe-smart-mqtt:latest
— Reply to this email directly, view it on GitHub https://github.com/stas-demydiuk/ewpe-smart-mqtt/issues/29#issuecomment-1283446996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJSNL5I3OYQSKF46H2MIT53WD6AU7ANCNFSM5WH3K3WQ . You are receiving this because you authored the thread.Message ID: @.***>
-- Jo De Wée
Steystraat 60 3200 Aarschot +32 (0)479 99 01 05 @.***
The images are missing for your posts. I also run Ubuntu, maybe your ewpe-smart-mqtt image in docker is the old one.
docker build . -t ewpe-smart-mqtt-fix
docker run -it \
--network="host" \
-e "MQTT_SERVER=mqtt://127.0.0.1" \
-e "MQTT_BASE_TOPIC=ewpe-smart" \
-e "NETWORK=192.168.1.255" \
-e "DEVICE_POLL_INTERVAL=5000" \
--name ewpe-smart-mqtt-fix \
ewpe-smart-mqtt-fix:latest
Hi all,
I also have the same issue. Here is the message: ` pi@raspberrypi:~/ewpe-smart-mqtt $ npm start
ewpe-smart-mqtt@1.0.5 start node index.js
2023-02-18T10:42:23.800Z [info]: Trying to connect to MQTT server mqtt://127.0.0.1 ... 2023-02-18T10:42:24.365Z [info]: Successfully connected to MQTT server 2023-02-18T10:42:24.445Z [info]: Socket server is listening on 0.0.0.0:46868 2023-02-18T10:42:24.448Z [info]: Scanning network 192.168.1.255 for available devices... a3K8Bx%2r8Y7#xDh internal/crypto/cipher.js:172 const ret = this[kHandle].final(); ^
Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length at Decipheriv.final (internal/crypto/cipher.js:172:29) at decrypt (/home/pi/ewpe-smart-mqtt/app/encryptor.js:18:48) at Connection.handleResponse (/home/pi/ewpe-smart-mqtt/app/connection.js:110:26) at Socket.emit (events.js:314:20) at UDP.onMessage [as onmessage] (dgram.js:921:8) { library: 'digital envelope routines', function: 'EVP_DecryptFinal_ex', reason: 'wrong final block length', code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH' } npm ERR! code 1 npm ERR! path /home/pi/ewpe-smart-mqtt npm ERR! command failed npm ERR! command sh -c node index.js
npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2023-02-18T10_42_24_650Z-debug.log `
And here are the logs: `
pi@raspberrypi:~/ewpe-smart-mqtt $ cat /home/pi/.npm/_logs/2023-02-18T10_42_24_650Z-debug.log
0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
1 info using npm@7.5.2
2 info using node@v12.22.12
3 timing config:load:defaults Completed in 17ms
4 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 18ms
5 timing config:load:builtin Completed in 19ms
6 timing config:load:cli Completed in 21ms
7 timing config:load:env Completed in 3ms
8 timing config:load:file:/home/pi/ewpe-smart-mqtt/.npmrc Completed in 2ms
9 timing config:load:project Completed in 7ms
10 timing config:load:file:/home/pi/.npmrc Completed in 1ms
11 timing config:load:user Completed in 2ms
12 timing config:load:file:/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 2ms
14 timing config:load:cafile Completed in 2ms
15 timing config:load:validate Completed in 2ms
16 timing config:load:setUserAgent Completed in 4ms
17 timing config:load:setEnvs Completed in 10ms
18 timing config:load Completed in 93ms
19 verbose npm-session 9982ce6f6f7a78d3
20 timing npm:load Completed in 184ms
21 timing command:run-script Completed in 3504ms
22 timing command:start Completed in 3526ms
23 verbose stack Error: command failed
23 verbose stack at ChildProcess.
@jodewee Have you been able to fix it? The airco is working fine with Ewpe Smart app on iOS. I can ping the airco. When i turn off wifi on airco i can run npm start without error (but of course without finding anything).
With the patch, i also have an error: pi@raspberrypi:~/ewpe-smart-mqtt2 $ npm start
ewpe-smart-mqtt@1.0.6 start node index.js
2023-02-18T12:34:21.262Z [info]: Trying to connect to MQTT server mqtt://127.0.0.1 ... 2023-02-18T12:34:21.844Z [info]: Successfully connected to MQTT server 2023-02-18T12:34:21.923Z [info]: Socket server is listening on 0.0.0.0:40131 2023-02-18T12:34:21.927Z [info]: Scanning network 192.168.1.255 for available devices... /home/pi/ewpe-smart-mqtt2/app/encryptor.js:27 return result ^
ReferenceError: result is not defined at decrypt (/home/pi/ewpe-smart-mqtt2/app/encryptor.js:27:2) at Connection.handleResponse (/home/pi/ewpe-smart-mqtt2/app/connection.js:110:26) at Socket.emit (events.js:314:20) at UDP.onMessage [as onmessage] (dgram.js:921:8) npm ERR! code 1 npm ERR! path /home/pi/ewpe-smart-mqtt2 npm ERR! command failed npm ERR! command sh -c node index.js
npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2023-02-18T12_34_22_127Z-debug.log
---> result is not defined if the test is true. So i've added a console.log(plaintext) just before the test to see what's the value. Seems to be wrong decryption value.
Could you please help me?
Many thanks :)
I've edited encryptor.js to show variable content in the console. i've clear base-64 value in variable data but not able to decrypt it; i use an online tool with the default key.
Is it possible the airco have a new (and/or other) encryption key? I red somewhere on the web that with android phone it could be possible to get that new/other key. I've iPhone (and no android phone available).
edit: Here is the base64 value.
JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNgdjW+vbhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG95p07va4eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+OxrVwrWa2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4=
The online tools says it has wrong length (should be a 16 multiple) but when using the bridge it is able to uncrypt (with wrong key) then returning unreadable characters.
edit2: it goes wrong when it handle the first response so i changed a bit the connection.js to see what are the results: Here is the end on connection.js:
handleResponse(msg, rinfo) {
console.log("=== HANDLE RESPONSE ===");
console.log("1 " + msg);
console.log("2 " + rinfo);
const message = JSON.parse(msg.toString());
console.log("3 " + message);
const key = this.getEncryptionKey(message.cid);
console.log("4 " + key);
console.log("5 " + message.pack);
const response = decrypt(message.pack, key);
console.log("6 " + response);
this.emit(response.t, response, rinfo);
}
And here are the results:
1 {"t":"pack","i":1,"uid":0,"cid":"502cc66c7f10","tcid":"","tag":"z3cfBBWy+QeZ/h/QoDssaw==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNgdjW+vbhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG95p07va4eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+OxrVwrWa2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}
2 [object Object]
3 [object Object]
4 a3K8Bx%2r8Y7#xDh
5 JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNgdjW+vbhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG95p07va4eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+OxrVwrWa2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4=
I've seen somewhere a way to try to catch the encryption key with an android emulator. The problem is the database used by android app is also encrypted (for the few last releases); the old version using "clear" database cannot be used anymore.
That means at this point we are not able to get that stupid key.
I will try to find a way and let you know
Hello all,
Thanks a lot to the contributors of this repository. Thanks @Xenomes for the first patch. And thanks @lmichaux for the investigation about the key change.
I face exactly the same issues as you do.
I am not an expert, but I have Android phones. Is there anything I can do to help progress on this topic?
Just a silly idea, but could we try to brute force crack the key? I can leave a Raspberry runing continuous attempts to connect with the device. It may take a while, but if it finds the key, it is worth a try, no?
Thanks for your help :)
Hi @bwibwi13
I tried with an android emulator without success.
About cracking the aes encyption it will take ages (2^128 possibilities); you will be dead before, even with the best super calculator.
the best way should be to sniff all communication (from the hvac and the ewpe app with ewpe server when initializing the wifi module) because the wifi module get the new encryption key at this moment. I never did it and as soon i have time to do it i’ll try. (Very very busy at the moment). I’ll come back here when i do it.
so as i understand from previous comments this plugin doesnt work as needs new solution or key to access ewpe servers or something? im getting similar error when running via docker
EDIT: Nevermind at least the HA Gree integration found all my 3 AlpicAir branded AC units...nice
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
i get a cipher error. is there any way to give the encryption key in the properties ?