Welcome to the Web API documentation πŸ‘‹

🌍 Learn how to build great integrations for Homey Pro & Homey Cloud.

The Homey Web API is a HTTP + Socket.IO API to control Devices, start Flows, view Insights and more. It is used by Athom internally for the Homey Mobile Apparrow-up-right, Homey Web Apparrow-up-right, Alexaarrow-up-right, Google Assistantarrow-up-right, and is available to 3rd party developers to create their own integrations.

As opposed to the apps running on Homey Pro or Homey Cloud, using the Homey Apps SDKarrow-up-right, integrating with the Homey Web API requires your own server or front-end.

The Web API can also used from within a HomeyScript. Learn more Β»arrow-up-right

Homey Pro apps with the homey:manager:api permission can also use some endpoints from within their app. Learn more Β»arrow-up-right

Creating a Web API Client

Before you can get started, you need to create your own Web API Client, to receive your Client ID & Secret.

Customers must authenticate using OAuth2 with your application, before you can make API calls on their behalf.

circle-check
circle-exclamation

Example

We provide a JavaScript & Node.js library, node-homey-apiarrow-up-right, to take care of the heavy lifting by authenticating & connecting to a customer's Homey Pro or Homey Cloud.

If you're not developing within a JavaScript environment, please visit HTTP Specification.

const AthomCloudAPI = require('homey-api/lib/AthomCloudAPI');

// Create a Cloud API instance
const cloudApi = new AthomCloudAPI({
  clientId: '...',
  clientSecret: '...',
});

// Get the logged in user
const user = await cloudApi.getAuthenticatedUser();

// Get the first Homey of the logged in user
const homey = await user.getFirstHomey();

// Create a session on this Homey
const homeyApi = await homey.authenticate();

// Loop all devices
const devices = await homeyApi.devices.getDevices();
for(const device of Object.values(devices)) {
  // Turn device on
  await device.setCapabilityValue({ capabilityId: 'onoff', value: true }); 
}

// Connect to receive realtime events
await homeyApi.devices.connect();
homeyApi.devices.on("device.delete", (device) => {
  // Device deleted
});
homeyApi.devices.on("device.update", (device) => {
  // Device updated
});
homeyApi.devices.on("device.create", (device) => {
  // Device created
});

πŸ‘₯ Community

Last updated

Was this helpful?