Getting Started with the Adax API

The Adax API provides a standard http-based interface for control of Adax thermostats. Software developers will be able to query status and send commands to their thermostat(s). Adax aims to follow the general rules of API compatibility and will protect implementations from breaking when bug fixes and new features are implemented. The API also strives to be self-documenting, easy to understand and use.

4.1. Remote Client API User Guide


Adax API is provided as a REST service and that allows you to:

  • Get your rooms target and current temperatures,
  • Change your rooms heating target temperatures.

Getting Started

For using Adax API you will need an authentication token for secure access and some REST services usage knowledge. The API is provided at the https://
api-1.adax.no/client-api/ address. The services description can be accessed at the https://api-1.adax.no/client-api/openapi in an OpenAPI format. You
could also use the provided Python and Java samples as a starting point.

Obtaining Authentication Credentials Required for Adax API

Using the Adax WiFi application you can create and get the authentication token used for accessing the Adax API. You should use at least the Adax WiFi
app version 3.7. The authentication token can be accessed following those steps:

  1. Navigate to Account Tab,
  2. Select “Remote user client API”
  3. Select “Add Credential”
  4. Give some name to the created credential and copy the generated password.

Using Adax API

The API provides 3 end points:

  1. /auth/ for authentication to the REST service.
  2. /rest/v1/control/ for controlling your rooms
  3. /rest/v1/content/ for getting rooms statuses. (add ?withEnergy=1 to get heaters power consumption for past hour)
  4. /rest/v1/energy_log/{roomId} – returns hourly energy log from current time back to 1 week for the specified room in 1h intervals.

Control and status endpoins accepts and returns json documents.

Code Samples

Python Sample

# install dependencies with: pip install requests sanction # install dependencies with: pip install requestssanction
import requests
import sanction
import time
import datetime

CLIENT_ID = "300288"

# replace with your client ID (see Adax WiFi app,Account Section)
CLIENT_SECRET = "xd8TdSCendw2cb6h"

# replace with your client secret (see Adax WiFi app,Account Section)
API_URL = "https://api-1.adax.no/client-api"
oauthClinet = sanction.Client(token_endpoint = API_URL + '/auth/token')

def get_token():

# Authenticate and obtain JWT token
oauthClinet.request_token(grant_type = 'password', username = CLIENT_ID, password = CLIENT_SECRET)
return oauthClinet.access_token

def refresh_token():
oauthClinet.request_token(grant_type='refresh_token', refresh_token = oauthClinet.refresh_token, username =
return oauthClinet.access_token

def set_room_target_temperature(roomId, temperature, token):

# Sets target temperature of the room
headers = { "Authorization": "Bearer " + token }
json = { 'rooms': [{ 'id': roomId, 'targetTemperature': str(temperature) }] }
response = requests.post(API_URL + '/rest/v1/control/', json = json, headers = headers)

def get_energy_info(token, roomId):
headers = { "Authorization": "Bearer " + token }
response = requests.get(API_URL + "/rest/v1/energy_log/" + str(roomId), headers = headers)
json = response.json()

for log in json['points']:
fromTime = datetime.datetime.utcfromtimestamp(int(log['fromTime']) / 1000).strftime('%Y-%m-%d %H:%M:%S')
toTime = datetime.datetime.utcfromtimestamp(int(log['toTime']) / 1000).strftime('%Y-%m-%d %H:%M:%S')
energy = log['energyWh'];
print("From: %15s, To: %15s, %5dwh" % (fromTime, toTime, energy))

def get_homes_info(token):

headers = { "Authorization": "Bearer " + token }
response = requests.get(API_URL + "/rest/v1/content/?withEnergy=1", headers = headers)

json = response.json()

for room in json['rooms']:

roomName = room['name']

if ('targetTemperature' in room):
targetTemperature = room['targetTemperature'] / 100.0
targetTemperature = 0

if ('temperature' in room):
currentTemperature = room['temperature'] / 100.0
currentTemperature = 0

print("Room: %15s, Target: %5.2fC, Temperature: %5.2fC, id: %5d" % (roomName, targetTemperature, currentTemperature, room['id']))

if ('devices' in json):
for device in json['devices']:
deviceName = device['name']
energy = device['energyWh'];
energyTime = datetime.datetime.utcfromtimestamp(int(device['energyTime']) / 1000).strftime('%Y-%m-% d %H:%M:%S')
print("Device: %15s, Time: %15s, Energy: %5dwh, id: %5d" % (deviceName, energyTime, energy, device ['id']))

token = get_token()

while True:
# Change the temperature to 24 C in the room with an Id of 196342
set_room_target_temperature(735362, 2400, token)

# Replace the 196342 with the room id from the
get_homes_info output
set_room_target_temperature(750269, 2400, token) 
# Replace the 196342 with the room id from the
get_homes_info output
get_energy_info(token, 735362)
token = refresh_token()