nyffchanium / argoclima-integration

Home Assistant integration for Argoclima (Argo) climate control devices
MIT License
22 stars 5 forks source link

Dummy server implementation to restrict internet access #2

Closed lallinger closed 2 years ago

lallinger commented 2 years ago

Hey,

as i'm very concerned with the harcoded public IP the AC uses (as much security wise as that this IP might not be reachable in the future) i tried to restrict the internet access for the AC. This unfortunately does not work, as the AC needs constant access to this public IP or the local API this home assistant integration uses stops working. Because of this i took the dive and analyzed the packets that the AC sends and receives from this public IP. With this i was able to implement a dummy server which imitiates the public servers behaviour enough so the AC continues working without contacting the real server.

As the rest of the software of the AC the public server is a complete mess, Most of the values it uses do not make any sense to me and the do not seem to follow the same schema as the local API. Also the AC reuses the same TCP connection to send multiple http request, because of this i could not just implement a simple http server but needed to create a http server from tcp scratch..

If you want you can add this to your repo and test it out yourself, i added information on how to to the readme.

Also i wanted to thank you for creating this integration! I was very happy when i found it after being halfway through reverse engineering the local API myself.

cheers

nyffchanium commented 2 years ago

Hi

Yeah I share your concerns. Tried blocking its internet access but that stopped the local API working as well, as you also discovered. It's quite questionable why the webinterface can switch to local mode when the communication with the server happens anyway.

The whole software just reeks of (very) bad practices. Not even gonna mention the code :sweat_smile:. Reverse engineering that stuff was a pain.

So thank you for that dummy server, I'll definitely be using it.

Using my integration here, I still have the problem that the ESP that's seemingly controlling the AC, or at least hosting the API, crashes from time to time, Probably some memory leak spilling some memory with every request.

Glad someone actually stumbled upon this, didn't think there would be any Home Assistant users who also happen to own this AC :stuck_out_tongue_winking_eye:.

lallinger-tech commented 2 years ago

Using my integration here, I still have the problem that the ESP that's seemingly controlling the AC, or at least hosting the API, crashes from time to time, Probably some memory leak spilling some memory with every request.

With the public Server i had the same issue, can't say yet if it happens with my local server too, i hope it does not because my wild guess is that the tcp connections don't get closed correctly and eventually the esp runs out of high ports to use.. If the problem persists i plan to hook it up to a smart plug and cutting the power of the AC fpr 5 minutes if it's unavailable for a few minutes via an HA automation.

Glad someone actually stumbled upon this, didn't think there would be any Home Assistant users who also happen to own this AC 😜.

I googled several times before i stumbled across this😅 the name Argo does not make it easy to find because of ArgoProj😅

nyffchanium commented 2 years ago

If the problem persists i plan to hook it up to a smart plug and cutting the power of the AC fpr 5 minutes if it's unavailable for a few minutes via an HA automation.

That's what I eventually ended up doing. Using a Shelly to cut the power when the entity becomes unavailable. We'll see how it goes

lallinger commented 2 years ago

So i just witnessed it beeping a very short almost silent beep and the screen showing two dashes for a second and it was unavailable in HA looking at the server logs NTP requests still were coming in and a few seconds later it was available again, so maybe this really solves the problem

nyffchanium commented 2 years ago

That'd be great! Let's hope for the best 🙏