arthurkrupa / gree-hvac-mqtt-bridge

MQTT Bridge for controlling Gree smart air conditioners, e.g. with Home Assistant or OpenHAB
GNU General Public License v3.0
130 stars 62 forks source link

Installation help needed - Can't communicate with Gree #50

Open DaveDaveDaveDave opened 4 years ago

DaveDaveDaveDave commented 4 years ago

Hello, Not an issue, but can't get it to work despite days of trying, reading all the issues in hopes for some clues. Everything seems to run fine, but no communication to the Gree/Crown unit. It seems that the bridge is communicating with the MQTT broker. The bridge also confirms it is connected to the GREE hvac host, but it seems to say that regardless of what IP address it is configured for.

Gree-MQTT Bridge Console:

pi@RPI:~/gree-hvac-mqtt-bridge $ node index.js \
>     --hvac-host="192.168.10.74" \
>     --mqtt-broker-url="mqtt://192.168.10.50" \
>     --mqtt-topic-prefix="home/greehvac" \
>     --mqtt-username="" \
>     --mqtt-password=""
[MQTT] Connecting to mqtt://192.168.10.50...
[MQTT] Connected to broker
[UDP] Connected to device at 192.168.10.74

The above is the only messages from the console, no error or progress, so I'm not sure if it's working.

I'm running Gree-MQTT bridge on a RPI with Node.js version 10.17.0 to a MQTT mosquito broker 1.5.8 on windows. All devices are on the same network and the older Gree G-Life app 1.1.0 for IOS works fine.

Mosquitto Console:

1573863194: New connection from 192.168.10.162 on port 1883.
1573863194: New client connected from 192.168.10.162 as mqttjs_f22da782 (c1, k60).
1573863194: No will message specified.
1573863194: Sending CONNACK to mqttjs_f22da782 (0, 0)
1573863226: Received PINGREQ from mosqsub|6872-CONTROL
1573863226: Sending PINGRESP to mosqsub|6872-CONTROL
1573863232: New connection from ::1 on port 1883.
1573863232: New client connected from ::1 as mosqpub|3800-CONTROL (c1, k60).
1573863232: No will message specified.
1573863232: Sending CONNACK to mosqpub|3800-CONTROL (0, 0)
1573863232: Received PUBLISH from mosqpub|3800-CONTROL (d0, q0, r0, m0, 'home/greehvac/mode/set', ... (3 bytes))
1573863232: Sending PUBLISH to mosqsub|6872-CONTROL (d0, q0, r0, m0, 'home/greehvac/mode/set', ... (3 bytes))
1573863232: Received DISCONNECT from mosqpub|3800-CONTROL
1573863232: Client mosqpub|3800-CONTROL disconnected.
1573863251: New connection from ::1 on port 1883.
1573863251: New client connected from ::1 as mosqpub|13948-CONTROL (c1, k60).
1573863251: No will message specified.
1573863251: Sending CONNACK to mosqpub|13948-CONTROL (0, 0)
1573863251: Received PUBLISH from mosqpub|13948-CONTROL (d0, q0, r0, m0, 'home/greehvac/power/set', ... (1 bytes))
1573863251: Sending PUBLISH to mosqsub|6872-CONTROL (d0, q0, r0, m0, 'home/greehvac/power/set', ... (1 bytes))
1573863251: Received DISCONNECT from mosqpub|13948-CONTROL
1573863251: Client mosqpub|13948-CONTROL disconnected.
1573863254: Received PINGREQ from mqttjs_f22da782
1573863254: Sending PINGRESP to mqttjs_f22da782 

Publish test commands with Mosquitto:

C:\Mos>mosquitto_pub -h localhost -t home/greehvac/mode/set -m "off"
C:\Mos>mosquitto_pub -h localhost -t home/greehvac/power/set -m 0

Unfortunately, I can't tell if the bridge is working or if there's a problem elsewhere. Is there a way to enable a "verbose" mode? I have been using the above mosquitto publish commands to test and see if the Gree reacts. In addition there seems to be no response to other publish/set commands or subscribe/get commands.

I'm sorry to ask for help here as I understand this is not a support forum, but I'm just not getting anywhere. If there were more logs or diagnostic messages I might be able to work it out, but I'm stuck. Any help would be most appreciated!

judders commented 4 years ago

Can tell you there should be a message in bridge..

Nov 18 21:02:30 jess mygree.sh[31036]: [MQTT] Connecting to mqtt://192.168.2.3... Nov 18 21:02:30 jess mygree.sh[31036]: [MQTT] Connected to broker Nov 18 21:02:30 jess mygree.sh[31036]: [UDP] Connected to device at 192.168.2.8 Nov 18 21:02:30 jess mygree.sh[31036]: [UDP] New device registered: 1e34d0d1 Nov 18 21:02:30 jess mygree.sh[31036]: [UDP] Device 1e34d0d1 is bound! Nov 18 21:12:01 jess mygree.sh[31036]: [MQTT] Message "1" received for gree2mqtt/power/set Nov 18 21:12:01 jess mygree.sh[31036]: [UDP] Status updated on 1e34d0d1 Nov 18 21:12:05 jess mygree.sh[31036]: [MQTT] Message "0" received for gree2mqtt/power/set Nov 18 21:12:05 jess mygree.sh[31036]: [UDP] Status updated on 1e34d0d1

DaveDaveDaveDave commented 4 years ago

Thanks! It really helps to know the expected output. Looks like it's failing at the negotiation stage. I'll focus efforts there.

judders commented 4 years ago

Yeah you should see the "New device registered: 1e34d0d1" if it worked. See if the Pi can see your heatpump, and the port is open. "sudo nmap 192.168.10.74 -sU -p 7000"

I get.... Host is up (0.16s latency).

PORT STATE SERVICE 7000/udp open|filtered afs3-fileserver MAC Address: xx:xx:xx:xx (Zhuhai Ewpe Information Technology)

If not try disabling the pi firewall "sudo ufw disable"

DaveDaveDaveDave commented 4 years ago

Thanks for this. Yes the port is open, but I may have discovered the issue.

My unit is branded as Bryant - however, the remote and all the operating specifics are identical to the Gree Crown+, and the default WiFI SSID is gree-XXXX. The WiFi board inside the unit shows that it was built in 2014. I use the Gree G-Life App to access it without any issue. https://play.google.com/store/apps/details?id=com.gree.g_life&hl=en

I went back and looked at the app that the original gree bridge code was based on and discovered that I could not connect with this app. So after some sniffing with Wireshark, it appears that that my unit is a different model of Gree interface. It appears that the initial negotiation takes place with a packet from port UDP 1024 to 988 on the HVAC, after that all communication in done to port TCP 6000. That said, port TCP 7000 is also open.

6000/udp open|filtered X11
7000/udp open|filtered afs3-fileserver

I can see the plugin making the attempt to connect with the packet to port 7000, but no response from the HVAC.
So unfortunately, I think I'll have to sort this out on my own since my HVAC unit isn't compatible with the Gree bridge code. I'm hoping this wifi module has been used in other HVAC and there has been some development elsewhere.

Thanks everyone for your help.