Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New encryption from firmware 1.21 #17

Open
nygma2004 opened this issue Jun 29, 2024 · 9 comments
Open

New encryption from firmware 1.21 #17

nygma2004 opened this issue Jun 29, 2024 · 9 comments

Comments

@nygma2004
Copy link

First of all, thanks for this node.
I am using this to control 2 different split units without any issues. But there is a bigger unit which looks more like a commercial unit mounted in the middle of the false ceiling.
When I enter the IP of it's wifi module, it is not able to connect.

I see the following in the debug log.

>>> cid:9424b827fd75: 6/29/2024, 10:55:10 AM
IN.MSG.UNPACK {
  t: 'dev',
  cid: '9424b827fd75',
  bc: 'gree',
  brand: 'gree',
  catalog: 'gree',
  mac: '9424b827fd75',
  mid: '3018',
  hid: '362001067592+U-W06DV4.01.bin',
  model: 'gree',
  name: 'b827fd75',
  series: 'gree',
  vender: '1',
  ver: 'V1.0.0.0',
  lock: 0
}
>>> cid:9424b827fd75: 6/29/2024, 10:55:10 AM
SOCKET.SEND {
  cid: 'app',
  i: 1,
  t: 'pack',
  uid: 0,
  pack: 'xB7ko3kjcYC/suIHqbMy4ERSziOesHf20PnJ7sfj64Oj9mrs/0p7GUTdWxmNaBUt'
}
>>> cid:9424b827fd75: 6/29/2024, 10:55:13 AM
SOCKET Unable to connect. Retrying...
>>> cid:9424b827fd75: 6/29/2024, 10:55:13 AM
SOCKET.SEND { t: 'scan' }

Any recommendation how to get this working?

@nygma2004 nygma2004 changed the title Cannot connect to bigger unit New encryption from firmware 1.21 Jul 16, 2024
@inwaar
Copy link
Owner

inwaar commented Oct 6, 2024

Related inwaar/gree-hvac-client#22

@nygma2004
Copy link
Author

I tested this again using the new 0.2.1 version of the node. And I keep getting the following 3 messages:
Error: Can not decrypt message (Unsupported state or unable to authenticate data)
Error: Connecting to HVAC timed out

@nygma2004
Copy link
Author

Fresh set of dump:

26 Dec 16:45:03 - [error] [gree-hvac:Nappali Legkondi] Error: Can not decrypt message (Unsupported state or unable to authenticate data)
>>> cid:9424b827fd75: 12/26/2024, 4:45:06 PM
SOCKET Reconnecting...
>>> cid:9424b827fd75: 12/26/2024, 4:45:06 PM
SOCKET.SEND { t: 'scan' }
ClientConnectTimeoutError: Connecting to HVAC timed out
    at Client._initialize (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:226:32)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:540:9)
    at process.processTimers (node:internal/timers:514:7) {
  origin: undefined,
  props: undefined
}
26 Dec 16:45:06 - [error] [gree-hvac:Nappali Legkondi] Error: Connecting to HVAC timed out
>>> cid:9424b827fd75: 12/26/2024, 4:45:06 PM
IN.MSG {
  t: 'pack',
  i: 1,
  uid: 0,
  cid: '9424b827fd75',
  tcid: '',
  pack: 'LP24Ek0OaYogxs3iQLjL4CDljya1z9cd4ZotL1aC1IVYT1PXPBDouOPiWHaG4G8lz22fUZtUbkblUYF5BzlKDV9xeQzMlsaP4RKBtrnsDrNSOKkdVnSW1jshbC9Ur0/1gFQsh4lDMRnjzzz9+se+4m/SXMlEF8XZgXr/lVyg/Ya5jMPWkS1W6by8LqVKljSX/VLofOeYjta54xNeZ+9zkcPkIobUcqXOyg5KvWxT2+U/S+oNhNj9iL3Mu+Rd2kvcjrzfQ3ZNNDRVwPVeCtKnokYdEoCAW+VQbH/TRVBwAtSqG5OfzQ1b3pyP2GpHzTTV'
}
ClientMessageUnpackError: Can not decrypt message (Unsupported state or unable to authenticate data)
    at Client._unpack (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:530:19)
    at Client._handleResponse (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:471:27)
    at Socket.<anonymous> (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:203:22)
    at Socket.emit (node:events:519:28)
    at UDP.onMessage [as onmessage] (node:dgram:943:8) {
  origin: Error: Unsupported state or unable to authenticate data
      at Decipheriv.final (node:internal/crypto/cipher:193:29)
      at GcmCipher.decrypt (/home/admin/.node-red/node_modules/gree-hvac-client/src/encryption-service.js:207:42)
      at EncryptionService.decrypt (/home/admin/.node-red/node_modules/gree-hvac-client/src/encryption-service.js:57:44)
      at Client._unpack (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:526:50)
      at Client._handleResponse (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:471:27)
      at Socket.<anonymous> (/home/admin/.node-red/node_modules/gree-hvac-client/src/client.js:203:22)
      at Socket.emit (node:events:519:28)
      at UDP.onMessage [as onmessage] (node:dgram:943:8),
  props: {
    message: {
      t: 'pack',
      i: 1,
      uid: 0,
      cid: '9424b827fd75',
      tcid: '',
      pack: 'LP24Ek0OaYogxs3iQLjL4CDljya1z9cd4ZotL1aC1IVYT1PXPBDouOPiWHaG4G8lz22fUZtUbkblUYF5BzlKDV9xeQzMlsaP4RKBtrnsDrNSOKkdVnSW1jshbC9Ur0/1gFQsh4lDMRnjzzz9+se+4m/SXMlEF8XZgXr/lVyg/Ya5jMPWkS1W6by8LqVKljSX/VLofOeYjta54xNeZ+9zkcPkIobUcqXOyg5KvWxT2+U/S+oNhNj9iL3Mu+Rd2kvcjrzfQ3ZNNDRVwPVeCtKnokYdEoCAW+VQbH/TRVBwAtSqG5OfzQ1b3pyP2GpHzTTV'
    }
  }
}

@inwaar
Copy link
Owner

inwaar commented Dec 28, 2024

@nygma2004 this seems like a network connectivity problem, try v0.3.0, it has more detailed logs which you can enable by selection "Debug" log level in the Gree Node config in NodeRED.

@nygma2004
Copy link
Author

I hope I managed to get the full debug log now. This is with version 0.3.0:

[2024-12-28T18:16:13.054Z +8ms] info CLIENT:2.2.0/00ef85b0> Status request
[2024-12-28T18:16:13.060Z +6ms] info CLIENT:2.2.0/c5a17743> Status request
[2024-12-28T18:16:13.081Z +21ms] info CLIENT:2.2.0/c5a17743> Status response
[2024-12-28T18:16:13.113Z +32ms] info CLIENT:2.2.0/00ef85b0> Status response
[2024-12-28T18:16:13.118Z +6ms] debug CLIENT:2.2.0/6910a815> Handle response
{
  request: {
    t: 'pack',
    i: 1,
    uid: 0,
    cid: '9424b827fd75',
    tcid: '',
    pack: 'LP24Ek0OaYogxs3iQLjL4CDljya1z9cd4ZotL1aC1IVYT1PXPBDouOPiWHaG4G8lz22fUZtUbkblUYF5BzlKDV9xeQzMlsaP4RKBtrnsDrNSOKkdVnSW1jshbC9Ur0/1gFQsh4lDMRnjzzz9+se+4m/SXMlEF8XZgXr/lVyg/Ya5jMPWkS1W6by8LqVKljSX/VLofOeYjta54xNeZ+9zkcPkIobUcqXOyg5KvWxT2+U/S+oNhNj9iL3Mu+Rd2kvcjrzfQ3ZNNDRVwPVeCtKnokYdEoCAW+VQbH/TRVBwAtSqG5OfzQ1b3pyP2GpHzTTV'
  }
}
[2024-12-28T18:16:13.125Z +6ms] debug ENCRYPTOR:2.2.0/6910a815> Decrypt
{
  input: {
    t: 'pack',
    i: 1,
    uid: 0,
    cid: '9424b827fd75',
    tcid: '',
    pack: 'LP24Ek0OaYogxs3iQLjL4CDljya1z9cd4ZotL1aC1IVYT1PXPBDouOPiWHaG4G8lz22fUZtUbkblUYF5BzlKDV9xeQzMlsaP4RKBtrnsDrNSOKkdVnSW1jshbC9Ur0/1gFQsh4lDMRnjzzz9+se+4m/SXMlEF8XZgXr/lVyg/Ya5jMPWkS1W6by8LqVKljSX/VLofOeYjta54xNeZ+9zkcPkIobUcqXOyg5KvWxT2+U/S+oNhNj9iL3Mu+Rd2kvcjrzfQ3ZNNDRVwPVeCtKnokYdEoCAW+VQbH/TRVBwAtSqG5OfzQ1b3pyP2GpHzTTV'
  },
  output: {
    payload: {
      t: 'dev',
      cid: '9424b827fd75',
      bc: 'gree',
      brand: 'gree',
      catalog: 'gree',
      mac: '9424b827fd75',
      mid: '3018',
      hid: '362001067592+U-W06DV4.01.bin',
      model: 'gree',
      name: 'b827fd75',
      series: 'gree',
      vender: '1',
      ver: 'V1.0.0.0',
      lock: 0
    },
    cipher: 'ecb',
    key: 'a3K8Bx%2r8Y7#xDh'
  }
}
[2024-12-28T18:16:13.132Z +7ms] info CLIENT:2.2.0/6910a815> Scan success
[2024-12-28T18:16:13.137Z +5ms] info CLIENT:2.2.0/6910a815> Binding start
{ attempt: 1 }
[2024-12-28T18:16:13.144Z +7ms] debug ENCRYPTOR:2.2.0/6910a815> Encrypt
{
  input: { mac: '9424b827fd75', t: 'bind', uid: 0 },
  output: {
    payload: 'xB7ko3kjcYC/suIHqbMy4ERSziOesHf20PnJ7sfj64Oj9mrs/0p7GUTdWxmNaBUt',
    cipher: 'ecb',
    key: 'a3K8Bx%2r8Y7#xDh'
  }
}
[2024-12-28T18:16:13.148Z +5ms] debug CLIENT:2.2.0/6910a815> Socket send
{
  request: {
    cid: 'app',
    i: 1,
    t: 'pack',
    uid: 0,
    pack: 'xB7ko3kjcYC/suIHqbMy4ERSziOesHf20PnJ7sfj64Oj9mrs/0p7GUTdWxmNaBUt',
    tag: undefined
  }
}
[2024-12-28T18:16:13.654Z +505ms] warn CLIENT:2.2.0/6910a815> Binding attempt timed out
{ timeout: 500 }
[2024-12-28T18:16:13.657Z +3ms] info CLIENT:2.2.0/6910a815> Binding start
{ attempt: 2 }
[2024-12-28T18:16:13.662Z +5ms] debug ENCRYPTOR:2.2.0/6910a815> Encrypt
{
  input: { mac: '9424b827fd75', t: 'bind', uid: 0 },
  output: {
    payload: 'JtoT1XUt89Lqss6DOHFHAMklv9YAzgWyIl52X7OFwurdNHgGiUNkepU=',
    tag: 'xAC+cQVWfdfi2rjQIkGbQA==',
    cipher: 'gcm',
    key: '{yxAHAY_Lm6pbC/<'
  }
}
[2024-12-28T18:16:13.666Z +4ms] debug CLIENT:2.2.0/6910a815> Socket send
{
  request: {
    cid: 'app',
    i: 1,
    t: 'pack',
    uid: 0,
    pack: 'JtoT1XUt89Lqss6DOHFHAMklv9YAzgWyIl52X7OFwurdNHgGiUNkepU=',
    tag: 'xAC+cQVWfdfi2rjQIkGbQA=='
  }
}

@inwaar
Copy link
Owner

inwaar commented Dec 28, 2024

what happened after the last log record (2024-12-28T18:16:13.666Z)?
there should be more logs before and after, would be helpful to see the full logs

@inwaar
Copy link
Owner

inwaar commented Dec 28, 2024

@nygma2004 Btw, can you ping that AC from the NodeRED host to see any packet loss or latency?

@nygma2004
Copy link
Author

packet access does not appear to be a problem:

admin@DUSUN:~$ ping 192.168.0.193
PING 192.168.0.193 (192.168.0.193) 56(84) bytes of data.
64 bytes from 192.168.0.193: icmp_seq=1 ttl=64 time=9.55 ms
64 bytes from 192.168.0.193: icmp_seq=2 ttl=64 time=7.57 ms
64 bytes from 192.168.0.193: icmp_seq=3 ttl=64 time=16.8 ms
64 bytes from 192.168.0.193: icmp_seq=4 ttl=64 time=15.5 ms
64 bytes from 192.168.0.193: icmp_seq=5 ttl=64 time=5.82 ms
64 bytes from 192.168.0.193: icmp_seq=6 ttl=64 time=15.6 ms
^C
--- 192.168.0.193 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5006ms
rtt min/avg/max/mdev = 5.816/11.800/16.775/4.312 ms

@inwaar
Copy link
Owner

inwaar commented Dec 30, 2024

Is there any other software/tool (open source) that correctly works with this AC unit? (Especially one that could provide some logs)

Does the vendor app works without problem with the unit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants