RobHofmann / HomeAssistant-GreeClimateComponent

Custom Gree climate component written in Python3 for Home Assistant. Controls AC's supporting the Gree protocol.
GNU General Public License v3.0
286 stars 102 forks source link

WiFi registration helper & fake heartbeat server #131

Open markv9401 opened 1 year ago

markv9401 commented 1 year ago

Is your feature request related to a problem? Please describe. For me, a 2022 series Syen AC owner, it is a problem. Without a heartbeat server the HVAC unit will eventually 'reset' itself and lose the app / HA.

Describe the solution you'd like Based on existing solutions, repositories and some WireSharking I've hacked together my own solution that does not require letting the HVAC unit connect to the actual WAN internet at all, ever.

Additional context Do you think it'd be feasible to try and merge a fake heartbeat server into this integration? I don't believe it should be too difficult and it could be useful not having to run it separately. Please take a look at it ( https://github.com/markv9401/Fake-Gree-server ) and if you think it could be useful, I'd happily try to merge it into the server in a PR. Thanks!

maciejtarmas commented 1 year ago

While that would be in fact useful, your solution doesn't work for my 3 Cooper & Hunter units (basically another Gree brand). Emtek's does.

I don't know what the code actually does, but I noticed that you're exposing port 1812, when most known Gree variants connect to port 5000. Changing the port in your implementation doesn't do anything in my case though.

This might need more investigation.

As to WiFi registration, I wouldn't bother. You can spin up the fake heartbeat server, block all outgoing WAN traffic from the unit, reset it and try to register with the app again. The app will tell you that it failed (because it can't talk to China at this point, obviously), but the AC unit will keep the WiFi credentials that you entered.

markv9401 commented 1 year ago

Sure thing, I don't mind, just thought it could be useful. Port 1812 explanation: During the initial registration process (when you reset WiFi and first log in to Gree servers) it uses an apparently burnt-in domain and port, 1812. The response to this requests contains the servers used in further requests, including the port. That usually (exclusively?) ends up being port 5000. But it works just fine, the HVAC unit will work with whatever port it receives in the response. So by trying to include registration and changing the port to 1812, you essentially need a single port not 2 of them.

rapi3 commented 4 months ago

just to let you know how I solved, my Gree AC it is already initialized and connected to my wifi using android Gree app and I did not wanted to repeat the steps as I don't have the app installed on phone.

Now HA integration it work without reinitialize Gree AC wifi using fake server

Obscurax commented 1 week ago

I've tried this but it does not work with, Vaillant WiFi Adapter VAI8/5-i. Note that this device is supported since encryption v2 is supported.

I've set up https://github.com/markv9401/Fake-Gree-server Also tried https://github.com/emtek-at/GreeAC-DummyServer

A few minutes after traffic is blocked from the AC to outside the connection between the AC and HA is lost. It'd be nice to find a way to block all home calling.

jodewee commented 1 week ago

e that this device is supported since encryption v2 is suppo

I have about the same (bulex vivair, but basically the same) no need for fake gree server. just add the v2 encryption method in the config.yaml

Obscurax commented 1 week ago

e that this device is supported since encryption v2 is suppo

I have about the same (bulex vivair, but basically the same) no need for fake gree server. just add the v2 encryption method in the config.yaml

Sorry but this is not about the component not working. Which it does. It's about blocking home calling from the AC to the Gree servers.