# Subscribing to device states from API

**URL:** <https://community.homey.app/t/subscribing-to-device-states-from-api/143889>\
**Category:** Developers\
**Tags:** app\
**Created:** [October 7, 2025, 8:59pm UTC](https://community.homey.app/t/subscribing-to-device-states-from-api/143889 "2025-10-07T20:59:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hufsa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hufsa/32/143537_2.png) [@Hufsa](https://community.homey.app/u/Hufsa)\
**Post date:** [October 7, 2025, 8:59pm UTC](https://community.homey.app/t/subscribing-to-device-states-from-api/143889/1 "2025-10-07T20:59:50Z")

</div>

I am trying to make my first app. After a couple of hours I finally figured out how to grab information from devices not in my app. But I want to make a trigger based of changes to other devices. How can I subscribe to them?

I have been looking at registerCapabilityListener and registerMultipleCapabilityListener, but I cant really get them to work (from the [https://apps-sdk-v3.developer.homey.app](https://apps-sdk-v3.developer.homey.app))

Here is small sample just to illustrate why I am trying to do:

```auto
'use strict';

const Homey = require('homey');
const { HomeyAPI } = require('homey-api');

class MyApp extends Homey.App {

  async onInit() {
    this.homeyApi = await HomeyAPI.createAppAPI({
      homey: this.homey,
    });

    const deviceId = "<someid>";

    const testDevice = await this.homeyApi.devices.getDevice({ id: deviceId });
    this.log(testDevice);

    const measurePowerValue = await this.homeyApi.devices.getCapabilityValue({ deviceId: deviceId, capabilityId: "measure_power" });
    this.log(`${deviceId}: measure_power value: ${measurePowerValue}`);

    // attempt at something
    this.testDevice.registerCapabilityListener('measure_power', async (value, opts) =>{
      this.log('value', value);
      this.log('opts', opts);
    });

    // another attempt at something
        testDevice.on('capability.measure_power', (newValue, oldValue) => {
          this.log(`value changed from ${oldValue}W to ${newValue}W`);
          this._onDeviceUpdate().catch(err => this.error('Error in HAN measure_power update handler:', err));
        });
        this.listeners.push({ device: testDevice, capability: 'measure_power' });

    this.log('MyApp initialized');

  }

}

module.exports = MyApp;

```

Is this even possible, or do I have to rely on intervals?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 8, 2025, 4:52am UTC](https://community.homey.app/t/subscribing-to-device-states-from-api/143889/2 "2025-10-08T04:52:03Z")

</div>

There are two distinct API’s: to manage the devices _your app created_, you use the [SDK](https://apps-sdk-v3.developer.homey.app/). To manage devices _from other apps_, you use the [Web API](https://athombv.github.io/node-homey-api/).

To listen for changes on capabilities from devices not managed by your app, you need to use the Web API [`device.makeCapabilityInstance()`](https://athombv.github.io/node-homey-api/HomeyAPIV2.ManagerDevices.Device.html#makeCapabilityInstance).

---

<div class="post-metadata">

**Author:** ![Hufsa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hufsa/32/143537_2.png) [@Hufsa](https://community.homey.app/u/Hufsa)\
**Post date:** [October 8, 2025, 1:34pm UTC](https://community.homey.app/t/subscribing-to-device-states-from-api/143889/3 "2025-10-08T13:34:23Z")

</div>

Nice, exactly what I was looking for, Thanks 😃

Adding an example here for others:

```auto
'use strict';

const Homey = require('homey');
const { HomeyAPI } = require('homey-api');

class MyApp extends Homey.App {

  async onInit() {
    this.homeyApi = await HomeyAPI.createAppAPI({
      homey: this.homey,
    });

    const deviceId = "<someid>";

    const testDevice = await this.homeyApi.devices.getDevice({ id: deviceId });
    this.log(testDevice);

    testDevice.makeCapabilityInstance('measure_power', value =>{
      this.log('Device measure_power changed to:', value);
    });

    this.log('MyApp initialized');

  }

}

module.exports = MyApp;

```
