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
317 stars 105 forks source link

Use device without Internet (only in local network) #211

Open MarcoBolter opened 1 month ago

MarcoBolter commented 1 month ago

First of all, I would like to thank you for developing and providing this integration. It works excellently.

I would like to operate the device only in the local network. I don't want my data to be sent to a cloud. Furthermore, the integration stops working if it does not have an internet connection.

If I block internet traffic and restart the device, it won't start up again.

There is an option in the integration (disable_available_check), but the problem still occurs. I have tried various things and unfortunately cannot get a handle on it.

I would be very grateful for any information or possible solutions. I can also provide support or test it.

Many thanks for your efforts! BR Marco

RobHofmann commented 1 month ago

Hmm this might be something related to your AC. I've got all my AC's disconnected from the internet and they work with this integration. Make sure to open the port (which is defined in the config) from your HASS installation towards your AC('s).

MarcoBolter commented 1 month ago

Interesting point, but I don't think that can be the case. The devices are all on the same network. I have the router, HASS and other systems running on Proxmox, and internally they are all on the same network. Therefore, they only get their IP addresses from OPNsense and communicate directly with each other without having to leave the network to the outside.

I use the Gree 0010039939 and am wondering why I just can't get it to work without internet. Which devices do you use? I would be very happy to find a solution to the problem.

RobHofmann commented 1 month ago

i'm using cooper&hunter AC's. can you share your config?

MarcoBolter commented 1 month ago

To be more precise, I have the VAI5-025WNI split appliances from Vaillant. These can be connected to the WLAN with the Gree 0010039939 WLAN module. This works perfectly. It may also be due to these Gree Wlan interfaces that need internet. Thank you very much for taking the time to help me!

Of course, the configuration is attached:

Air conditioner

RobHofmann commented 1 month ago

Hmm this looks good.

Can you put the component logging into debug mode and share the debug logs?

Example for your logger component to put this component into debug logging mode:

default: error
logs:
  custom_components.gree: debug
MarcoBolter commented 1 month ago

I tested this again today and the result was the same. If there is no internet connection, the integration doesn't seem to be able to connect.

However, if the device is connected while the internet is still on and I then block the connection via OPENsense, it still seems to work. I'll keep an eye on it to see if it stays that way.

Do you have any other ideas? I would really like to operate the device without the internet, but I think you understand my dilemma.

Enclosed are the logs without internet. and when I switched on the internet.

home-assistant_no_internet.log.log home-assistant_with_internet.log.log

RobHofmann commented 1 month ago

Really weird, it simply does not connect at all without the internet. Im 99% sure this is something in the device itself.

FYI: This component does not do anything with resources on the internet. It simply creates a local (offline) connection to your HVAC directly and thats it.

Im afraid this can't be solved by this software.

The only thing I can think of, but absolutely have no experience with, is to flash your device with other (vanilla) Gree firmware if thats possible. However I'm really unsure this is possible at all.

pini72 commented 1 month ago

Hi,

I'm experiencing the exact same issue as described here. Since yesterday, my internet is down due to infrastructure problems in my area, and now the Gree integration fails to detect my AC units.

I've attached my log file for reference.

Thanks! [Uploading filtered_gree_climate.log…]()

MarcoBolter commented 1 month ago

As mentioned by @RobHofmann, I too am unsure if the problem is fundamentally related to the integration. Once the Gree devices have had an internet connection, I can switch off the internet and they continue to work without any problems. This is surprising to me. I'm still analysing the exact cause of the problem to ideally be able to fix it. In the worst case, I would either have to try to adapt the firmware of the Gree devices or develop a device based on an ESP myself. That would be a shame, as the integration itself works perfectly.

@RobHofmann: Do you have any more ideas about what I could try? Or are you still looking for a solution, or is the topic already closed for you?

@pini72: Which devices do you use and what measures have you already taken to solve the problem?

Thank you very much for your support! BR, MArco

RobHofmann commented 1 month ago

Hmm the only alternative I can think of is to check what kind of traffic it communicaties and try to replicate that within your network. But I think thats quite farfetched.

From my side I'm unable to help in this, since my HVAC does not have this feature/flaw. I don't have the means to test this.

MarcoBolter commented 1 month ago

I understand anyway thanks for your support, I appreciate it. I need to take some time to find a solution, when I have found something I will be happy to share it with you.

RobHofmann commented 1 month ago

I'm looking forward to it. Thanks in advance :).

Julfried commented 1 month ago

I think this is related to this issue here: https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent/issues/88

Newer versions of gree devices (and potentially other vendors) need to send a heartbeat signal to the gree servers in order to stay active for local commands. After some time, if the device gets no response it also blocks local commands. Currently my workaround is to add a firewall rule to let the heartbeat signal pass on port 5000, though this is not the point using this integration.

A potential solution could be to setup a "fake" heartbeat server and redirect to the trafic to it: https://github.com/emtek-at/GreeAC-DummyServer/forks

I think this would to integrate this in here, though it would definitly need some work since the repo ist 5 years old.

pini72 commented 1 month ago

@pini72: Which devices do you use and what measures have you already taken to solve the problem?

I use an air conditioner from a local brand called Tadiran model Alpha Pro that works with this module: grjwb04-j

I think this is related to this issue here: #88

Yes, it makes sense, because after disconnecting the internet, the air conditioner continues to work for a certain time until it disconnects

Julfried commented 1 month ago

Yes, it makes sense, because after disconnecting the internet, the air conditioner continues to work for a certain time until it disconnects

For me it is exactly the same. One correction, opening port 5000 in the firewall does not solve the issue and it still disconnects after some time.

pini72 commented 1 month ago

port 5000

try port 1813 see here

Julfried commented 1 month ago

Ah thanks, I will try that, although I think this problem will still remain present from my experience:

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.

Integrating such a dummy server in this integration would be cool. Maybe add this as a boolean option in the yaml config and if someone wants to enable this he would have to setup his DNS server and point the domain to his home assistant instance. What do you think?

MarcoBolter commented 1 month ago

Integrating the ‘dummy server’ would of course be the ideal solution, as the existing integration works brilliantly.

@RobHofmann: can you imagine that?

That's why I find it so unfortunate that it can only be used with an internet connection. There are several reasons for this - among other things, I want to prevent my home from being controlled from outside. In addition, the functionality would be completely limited if the server is switched off or the internet fails.

I think developing my own ESP to replace the Gree device would be very time-consuming. If I had the firmware, I could customise it and reflash it. The solution with a Docker container and the dummy server also seems a bit complicated to me, as I would like to have a user-friendly solution that can also be used by others.

Do you have any other experience or ideas on how this problem could be solved?

Julfried commented 1 month ago

I fear, there is no other solution than mimicking what the gree server does. Starting the server from inside this extension is the most userfriendly option imho, but I am unsure how home assistant would react to this. Is there any experience with something like this?