inwaar / node-red-contrib-gree-hvac

Provides a node for controlling Gree HVAC (Heating, ventilation, and air conditioning).
14 stars 6 forks source link

Node-RED crash if you try to access second HVAC unit #11

Open soosp opened 1 year ago

soosp commented 1 year ago

At one of my deployment there is two Gree HVAC units. If you try to control firstly configured one, it works well. It you try to control the second one it crashes and kills all Node-RED instance.

soosp commented 1 year ago

Here is the log fragment:

Nov  8 18:20:46 raspberrypi Node-RED[12074]: 8 Nov 18:20:46 - [info] Starting flows
Nov  8 18:20:47 raspberrypi Node-RED[12074]: 8 Nov 18:20:47 - [info] Started flows
Nov  8 18:22:06 raspberrypi Node-RED[12074]: 8 Nov 18:22:06 - [red] Uncaught Exception:
Nov  8 18:22:06 raspberrypi Node-RED[12074]: 8 Nov 18:22:06 - [error] TypeError: Cannot read property '0' of undefined
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at /home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:383:46
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at Array.forEach (<anonymous>)
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at Client._handleUpdateConfirmResponse (/home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:382:18)
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at Client._handleResponse (/home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:312:29)
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at Socket.<anonymous> (/home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:113:52)
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at Socket.emit (events.js:400:28)
Nov  8 18:22:06 raspberrypi Node-RED[12074]:     at UDP.onMessage (dgram.js:931:8)
Nov  8 18:22:06 raspberrypi systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
Nov  8 18:22:06 raspberrypi systemd[1]: nodered.service: Failed with result 'exit-code'.
Nov  8 18:22:06 raspberrypi systemd[1]: nodered.service: Consumed 13.576s CPU time.
soosp commented 1 year ago

The modell number of the first one: GWH12QC-K6DNA1D The second one: GW12AFC-K6DNA2F

Henkkas52 commented 1 year ago

@soosp I have also 2 GREE units, controlled by Node RED, but they run perfectly. The only thing is you have to keep your registration at GREE+ app, because otherwise your wifi will stop after 2 weeks or so. But your situation shouldn't be an issue normally.

sixtybi commented 1 year ago

I have the same problem. Have you found a solution for this? I have two types of AC in my home: Syen SOH09BO-E32DA4A2 (this has the same issue as descibed above) Syen SOH12MU-E32DA1D (this is working fine with this node)

sixtybi commented 1 year ago

I have found a workaround for this, but it's not a solution. I realized that the problem is when the package type is response. In the case of my Syen SOH09BO-E32DA4A2, the value is undefined here. The the status can be read fine, and also the output package is fine, the AC unit is set according to the outut. I have commented this part out in client.js: // If package type is response, update device properties / if (pack.t === 'res') { return this._handleUpdateConfirmResponse(pack); } /

Line 312. This way there is no response to the UI right after the changes has been applied, but only after the status polling, which is set to 1 seconds by default. OK, there is some latency, but it works at least now.

If someone has a better WA/solution, please let us know. Thanks!

bega1986 commented 1 year ago

It is working, thank you! I cant solve the original problem, but this WA is good for me.

ttgabi01 commented 1 year ago

Hi! That's my problem. Exactly where and what should be pasted?

bega1986 commented 1 year ago

Hi! That's my problem. Exactly where and what should be pasted?

Hi.

In this file: .node-red/node_modules/gree-hvac-client/lib/client.js

Original: if (pack.t === 'res') { return this._handleUpdateConfirmResponse(pack); }

Modified: / if (pack.t === 'res') { return this._handleUpdateConfirmResponse(pack); } /

ttgabi01 commented 1 year ago

Thank you! Its work!

soosp commented 11 months ago

Unfortunately this workaround did not solve my problem with GW12AFC-K6DNA2F unit:


Jul 24 20:04:35 raspberrypi Node-RED[6907]: 24 Jul 20:04:35 - [red] Uncaught Exception:
Jul 24 20:04:35 raspberrypi Node-RED[6907]: 24 Jul 20:04:35 - [error] TypeError: Cannot read property '0' of undefined
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at /home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:383:46
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at Array.forEach (<anonymous>)
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at Client._handleUpdateConfirmResponse (/home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:382:18)
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at Client._handleResponse (/home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:312:29)
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at Socket.<anonymous> (/home/pi/.node-red/node_modules/gree-hvac-client/lib/client.js:113:52)
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at Socket.emit (events.js:400:28)
Jul 24 20:04:35 raspberrypi Node-RED[6907]:     at UDP.onMessage (dgram.js:931:8)
Jul 24 20:04:35 raspberrypi systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
Jul 24 20:04:35 raspberrypi systemd[1]: nodered.service: Failed with result 'exit-code'.
Jul 24 20:04:35 raspberrypi systemd[1]: nodered.service: Consumed 45.586s CPU time.
Jul 24 20:04:55 raspberrypi systemd[1]: nodered.service: Scheduled restart job, restart counter is at 2.
Jul 24 20:04:55 raspberrypi systemd[1]: Stopped Node-RED graphical event wiring tool.
Jul 24 20:04:55 raspberrypi systemd[1]: nodered.service: Consumed 45.586s CPU time.
Jul 24 20:04:55 raspberrypi systemd[1]: Started Node-RED graphical event wiring tool.
˛˛˛