I’ve been using Homey as well as an ADAX smart heater for some time. Unfortunately, the latter doesn’t offer much apart from being Wi-Fi enabled. It doesn’t have many features, and although the ADAX 2 app now has Google support, for me, Amazon and HomeKit support would be ideal instead. But I digress.
What I’d like to describe in this post is how you can connect it to Homey then control it with a Flow.
It’s a bummer that ADAX doesn’t provide any APIs whatsoever. What’s more, it agressively protects itself (and the user) from being controlled in any other way. Consequently, it’s somewhat hard and complicated to make it work with Homey, and everyone has to perform the following procedure for themselves.
Let’s do it step by step:
Sniffing the app through a proxy
I’m on macOS, so I’m using an app called Proxyman for creating a proxy server on my computer. Then I set this as the proxy on iOS, on my iPhone.
- Launch Proxyman. Near the top, note the default port number, as well as the local IP of the computer. The IP can be displayed by Alt-clicking the Wi-Fi icon.
- Connect your iPhone to the Wi-Fi network, then open Settings, select Wi-Fi, and tap the
(i)button next to the name of the network. Scroll to the bottom, select “Configure Proxy”, and type in the IP and port of the proxy you just created, e.g.
- Quit settings, then open the ADAX app. You should see this:
Now you’ll need another app, Postman. You’ll use this for testing whether sniffing the data and replaying requests worked.
Once you set a new temperature from within the ADAX app, search for the following line:
This contains all the information we’ll need: address of the website, cryptographic signature, and the value of the temperature. You should look for
body , in the lower left part. Like this:
Once this is done, launch Postman, and set it up as follows:
- Select NEW, then GET. Change GET to POST immediately, and add the URL that we extracted from the proxy above. This contains our account information (for authentication) as well as the temperature. The temperature is at the end of the URL, like this:https://smart-apps-1.adax.lt/sheater-client-api/rest/zones/XXXXXXX/target_temperature/XXXXX/ 1600 meaning 16 degrees Celsius.
- Now add the following line under Headers:
- Then, switch to Body, and add a key-value pair where the key is
signatureand the value is the signature you extracted from the data sniffed by the proxy:
Note that each different temperature setting has its own signature. This is of course meant to be a safety feature, but for our purposes, it’s just an annoyance. So basically you must repeat this process for a set of pre-defined temperature values in order to generate re-usable URLs. You’ll get different URLs containing the desired temperature at the end, along with a unique signature.
When you are done with each temperature setting and the corresponding URLs, the only thing that remains is obtaining some runnable code from Postman. Just click on the “Code” button, and it will spit out the code in many different languages.
I ended up creating a PHP script on a Raspberry Pi, which I trigger in Homey, and the PHP in turn calls the ADAX system.
By the way, I’m pretty sure there’s a more elegant solution for this, but I don’t have enough experience with Homey for programming a virtual thermostat or running PHP directly from it, instead of having to call an external PHP file.
So, if you could help me with running cURL or sending a POST request in general, using Homey directly, I’d be very grateful, because then I wouldn’t need a separate webserver just for this purpose.
Of course, in return, I’d be happy to share the PHP I generated, in case someone finds it to be helpful.
I hope it helps