GreeAC-DummyServer icon indicating copy to clipboard operation
GreeAC-DummyServer copied to clipboard

Port and domain configuration

Open IlogicalKarma opened this issue 1 year ago • 4 comments

For those who have come across this repo hoping to prevent external connections from their AC, here is some information I came across:

The port is NOT always 5000, in my case, it was 1813. To find it I suggest setting up a network with an access point that has ssh access and a tool such as tcpdump (I also recommand using Wireshark to remotely monitor the packets with filtering and information displayed neatly). While monitoring the packets, you should unplug the unit and plug it in again after 10-20 seconds. It will attempt to resolve the domain assigned to it and, following that, it will send a packet to one of the resolved addresses.

The linked repository for ConfigTool did not work for me, but you should be able to see the DNS request with the name when tracking down the port. In my case it was eu.dis.gree.com.

Please note that my AC unit is using version 1.25, but it should function similarly to 1.21. Also note that, despite the fact that it works, I am experiencing delays and timeouts in home assistant when attempting to connect to it. This is likely something that cannot be fixed without a replica of the server.

IlogicalKarma avatar Jul 17 '24 09:07 IlogicalKarma

From my experience, units that use port 1813 do not use plain TCP communication as provided by this project - they use TLS, and without a proper server to connect to they start misbehaving and timing out.

I have created a dummy server with TLS support in https://codeberg.org/joserebelo/gree-dummy-tls-server

joserebelo avatar Feb 22 '25 21:02 joserebelo

Thank you so much!

IlogicalKarma avatar Mar 02 '25 17:03 IlogicalKarma

@IlogicalKarma

Did you manage to set up a gree dummy TLS server?

Can you give me step-by-step instructions for HomeAssistant on how to set it up with HACS?

My AC is addressing three ports: 16386, 16388, 1813, and the DNS resolves to eu.dis.gree.com

Thank you very much.

MrX0r avatar Mar 19 '25 14:03 MrX0r

I will do my best, but it's been a while. You will have to fill in the gaps with research or extra questions.

Requirements: a server to put this all on

I. Setting up the dummy server Refer to the previous comment from @joserebelo. His server works great. The ports seem a bit different from yours. 1813 is probably still the TLS, but if you don't have any connections on port 5000 than you will probably have to figure those out yourself.

  1. Basically, paste the docker compose from codeberg: services: gree-dummy-tls-server: container_name: gree-dummy-tls-server image: codeberg.org/joserebelo/gree-dummy-tls-server:latest environment: DOMAIN_NAME: your.dns.entry.example.com EXTERNAL_IP: 192.168.1.50 ports:
    • 1813:1813 # tls
    • 5000:5000 # tcp
  2. Configure it and figure out the right ports for the connection. Here are the environment variables you will be using: LISTEN_PORT_TCP Optional - The port for plaintext TCP connections (default: 5000). LISTEN_PORT_TLS Optional - The port for TLS connections (default: 1813). LISTEN_PORT_PROMETHEUS Optional - If set, someth prometheus metrics are exposed on this port.
  3. Leave the man a star on codeberg. I had been using my AC for a year with delays and timeouts thinking everything was set up properly.

II. Set up dnsmasq on the server. This is decently documented and it varies based on what you set it up on. II.1. Add a redirect to your dummy server in /etc/dnsmasq.conf, unless you have the config somewhere else address=/DOMAIN_YOUR_AC_IS_CONNECTING_TO/LOCAL_IP_TO_DUMMY_SERVER

III. Make sure your AC is set up to connect to your network, avoid updating(who knows what they will change) and configure a custom DNS server for the device on your router. My Asus router has this setting under the DHCP section. If that is not an option, you could consider making it the server for you entire network, just make sure it has a decent connection and that you forward other resolves to a DNS provider like quad9.

IV. Finally, set up https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent. Follow the instructions on the repo, I had to use encryption_version: 2.

IlogicalKarma avatar Mar 19 '25 15:03 IlogicalKarma