Closed NickB1 closed 6 months ago
Did some testing in Python with data from the discovery packet in the app log together with the generic key. Also tried a different key that can be seen further down the log with a corresponding packet. No luck, I'm getting "ValueError: Data must be aligned to block boundary in ECB mode" for all combinations. Seems like they are using a different encryption scheme?
import base64
from Crypto.Cipher import AES
key1 = "a3K8Bx%2r8Y7#xDh"
data1 = "JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDL/YhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1" \
"+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5s6a0eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgt" \
"/Wq2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="
key2 = "LtBiQw0l5a18Y4N9"
data2 = "TiRJsT03aGlrnAgapwAFH4ayuMMDjkuODOnlBlMvUjs9wmonNw5ne6/1lichjsv6GEXlg8D9NP79zhrg5F2lhcnAP6H2pOcFgKFZplcM5c" \
"+yACBFhMoSVvUm/2ydVPhRqGTle2CbVZ2YHKvFpKkffrHVH6tIestUerqhj243i1+obqIATrwGNwqRb5V/nC+uhf+F31hmNxV8NF0XgNu" \
"/ZA3NfbQK68cA7BC5WbKOcDQ1ugfXnbefRiwEvIldDfjZcVOypVNODwpGplg8ytBj1VHs"
if __name__ == '__main__':
data = base64.b64decode(data1 )
cipher = AES.new(key1 .encode("utf8"), AES.MODE_ECB)
plaintext = cipher.decrypt(data)
print(plaintext.decode("utf-8", 'ignore'))
Possibly yes. They use a different implementation apparently. Im afraid I can't help here.
Feel free to make a PR with support for your model if you do find it out.
Not sure if it is due to the ac being a different model. You can see "model":"gree" coming back a lot in the app log. The ac units also work fine using the gree app. So it might be an update to their protocol? These are the wifi modules used: https://www.airco-shop.be/a-64517282/bulex-airco/bulex-wifi-module/
Maybe yes. I haven't encountered this on my devices. Maybe someone else encountered this as well.
I have the same wifi module (but with the vaillant brand, same webshop though), and although it works with the gree+ app and the ewpe app I can't add them either, same error as @NickB1 . gree.py gives the following output:
Traceback (most recent call last): File "gree.py", line 190, in <module> search_devices() File "gree.py", line 95, in search_devices pack = json.loads(decrypt_generic(resp['pack'])) File "gree.py", line 61, in decrypt_generic return decrypt(pack_encoded, GENERIC_KEY) File "gree.py", line 55, in decrypt pack_decrypted = decryptor.update(pack_decoded) + decryptor.finalize() File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 159, in finalize data = self._ctx.finalize() File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 179, in finalize "The length of the provided data is not a multiple of " ValueError: The length of the provided data is not a multiple of the block length.
If there's anything I can do to help please shout :)
The decoded pack also shows "ver":"V2.0.0", all older examples I have seen have V1.x.x so I suspect they made some changes. The app will probably need to be disassembled to look into the new protocol? Have given up and made an MQTT to Ir bridge using the IRremoteESP8266 library for now to be able to control the AC. Let me know if I can be of any help.
Hi, i have exact the same issue using the same model of wifi and airco. Did you make any progress? i'm trying to get the encryption key from the android package
The decoded pack also shows "ver":"V2.0.0", all older examples I have seen have V1.x.x so I suspect they made some changes. The app will probably need to be disassembled to look into the new protocol? Have given up and made an MQTT to Ir bridge using the IRremoteESP8266 library for now to be able to control the AC. Let me know if I can be of any help.
Hi Nick, I have the same AC's. I was looking into this integration, to bad it doesnt work, so I am not going to try. Any documentation on the IR integration? I'm quite the noob...
Hi Nick, I have the same AC's. I was looking into this integration, to bad it doesnt work, so I am not going to try. Any documentation on the IR integration? I'm quite the noob...
I used an ESP32 board with Tasmota (https://tasmota.github.io/docs/Tasmota-IR/#sending-ir-commands, GREE as vendor). For use in home assistant I would recommend using ESPHome (https://esphome.io/components/climate/climate_ir.html?highlight=ir). The boards are connected to the power connector that's used for the original modules, it has 5V on it. A 4pin 2.54mm JST connector fits. I taped the boards in the bottom of the compartment to the right of the ac unit, the IR led pointing straight upwards seems to work best.
@NickB1 i had it solved with this new build of the integration, the new encryption method is supported now
Hi, I recently installed two "Saunier Duval" AC's which contain ewpe wifi modules that can be controlled using the ewpe-smart app. When trying to add one off the two AC units I'm getting the following error:
My config:
I also tried other tools (https://github.com/arthurkrupa/gree-hvac-mqtt-bridge, https://github.com/tomikaa87/gree-remote). Both give an error stating the final block length is incorrect when trying to decode the pack response on the discovery broadcast.
Also used adb for checking debug output of the ewpe-smart app, this is the output when starting the app.
Both devices seem to respond with the same data to the discovery broadcast, so I assume they use the same encryption key at this stage. Any idea what could be happening? Maybe the protocol changed for newer devices? The firmware version on the wifi module is V1.08.