Drayton Wiser Thermostat Binding

Hi All,

I’ve bought a Drayton Wiser smart thermostat and have started looking at the API calls the application makes to create a new binding for openhab.

This is my first binding and I’ve not coded in Java for some time.

The first call is a get request to the thermostat, which returns JSON. My first problem is that I can’t find a JSON class to import. Is there one, or will I have to loop through the body text manually?

Thanks in advance,

After some great work from @andrew-schofield the Binding is available for testing here


Good luck with your binding, nice to hear that you want to contribute!

For JSON Processing you can use gson. Look up that library with google, you will find a lot of tutorials.

Hint: there are websites available, which generate java POJO classes out of a given JSON. You can use these with gson, to map the json to java objects.

Have fun coding!

1 Like

I managed to make some good progress yesterday and now have the thermostat temperature reading into OpenHAB. Thanks @bennYx0x for the tip on POJO and JSON - they saved me an immense amount of time (once I worked out where to reference GSON in the manifest file to include it)

I’m a little confused about how best to structure it though. The binding will communicate with the Heat Hub, which returns the status of all connected devices and rooms in a JSON string. Do I treat the Heat Hub as a bridge and then have each device as a “thing”? Although you can have multiple devices in a room, so does the room become the thing you set?

I’ll have a look through some more existing bindings to see what best practices I can spot, but any thoughts are welcome

Good to hear that you made progress! :slight_smile:

Im not an expert for bindings, but regarding go the documentation (http://docs.openhab.org/concepts/things.html):

Bridge: Special thing for retrieval of other things (like you said, the devices)

Things: represent (in most cases) physical entities/ devices

Regarding the organisation into rooms: that is a job for (item-)groups, which members are the items of the devices (=things, through channels).

1 Like

Hi Rob,
I have been digging through your bindings code and I am confused about the authentication. Where does the Auth token come from?
Thanks for your efforts!

That’s a bit that needs lots more investigation. To get the auth key I did some packet sniffing on my network. All traffic from the App to the Heat Hub is unencrypted HTTP traffic. My fear is the auth token is generated when you create an account with Wiser and will therefore by encrypted, but I’m not sure. When I get some time, I’ll go through the setup process from scratch and sniff all the traffic on my phone to see if there’s a way to find it.

I was afraid of that… Maybe we can ask for help in obtaining the key.


They’ve already said that they have no plan of making a public API. Plus I’m a little concerned about poking the wasp nest, I don’t fancy reverse engineering the process again.

When I get a chance I’ll see if the hub gives the game away. You can have multiple accounts linked to the same hub so the SECRET is either generated by the online authentication service or the HeatHub. Seeing how independent the HeatHub is I’m fairly confident it’s done locally.

Hi Rob,

Do you know if hot water can be boosted too?

If it can be done in the app I see no reason why not.

I’ve only got a combi boiler so can’t test it out. If you’re able to sniff the packets (particularly the /data/domain address) I’d be interested to see what the JSON looks like because it’ll help with the discovery.

Thanks for the update Rob.

Just researching at the moment and haven’t yet purchased, but may do so if I can programatically boost the hot water, say when temperature in hot water tank drops to a pre-defined level.

Take a look at the wiring instructions here

For the standard two channel wiring there’s no knowledge of water temperature sent to the HeatHub. It’s just on and off based on a timer and the boiler will control getting it to a set temperature. If your boiler supports OpenTherm you might be in luck, but I can’t say for sure.

EDIT: There is a water override button. So you could leave that on all the time, but it’s going to waste a lot of energy

Thanks for clarification on HeatHub capabilities, however I’m monitoring water tank temperature independently, so looking for hardware where I can make some form of API call to turn the boiler on for a predefined time.

I’m guessing the water override/boost functionality may allow me to do something like this if exposed in the API. i.e. make a call to heat hot water for 1hr

In that case it sounds like it would work. You may be able to alter the schedule too, but I’ve not looked into that yet.

Hi Rob. Did you get any further working out where the secret comes from? I’m looking at this for another automation system. I managed to get to the same point as you and found my way here from Google.

I found a couple of things:
Signing out of the app doesn’t revoke the secret. Signing in again doesn’t create a new one. This suggests it’s set at setup.
Local API requests work without an internet connection. The app won’t work without an internet connection (you can’t login). I suspect logging in returns the secret for your particular hub.

I’ve yet to packet capture another instance of the app to see if a different secret is returned. The secret looks looks to be base64 encoded, but decoding doesn’t produce anything useful.

Did you look at the setup process again?

I’ve not had another chance to spend any time on it (been finishing off other bits of the house, far too many projects on the go!) but I’ve reached the same conclusions as you. All traffic is internal but the app always seems to authenticate externally.

Today I read about Debooke which sounds ideal for tracing the taffic between the phone and their servers, but I don’t have anything with Mac OSX on it here.

I was using a Android MITM proxy which should decrypt the SSL connection but I don’t think the app accepted the CA cert it installs so wouldn’t connect.

I did find where it connects to which is https://api-nl.wiserair.com Which presents you with their full API guide at http://api-nl.wiserair.com/swagger/ui/index. This must be what Amazon etc use for their integrations. I can’t see anything on there about authentication though. Using basic auth with registered username and password wouldn’t work for the few API endpoints I tried.

When Amazon connects though the Alex app it does it via OAuth. I looked again at the flow and it appears you need a client_id from Wiser to start the OAuth process.

1 Like

Wiser Air is Schneider’s Wiser for the American Market which includes air conditioning. All I found were calls to Azure rather than WiserAir. Did you find the swagger URL through googling or packet sniffing?

I found it through packet sniffing. Also it’s in the Cloud object returned by /data/domain/.

1 Like

Having a look at the user guide at https://wiser.draytoncontrols.co.uk/sites/default/files/documents/drayton_wiser_user_guide_2208.pdf There’s a section on using setup mode to change the wifi connection it uses (rather than a full reset). The process involves the hub creating its own access point. Since you don’t have an account at initial setup I hope it might give us the secret to use for local API calls.

1 Like