# Tuya Cloud platform and homey scripting

**URL:** <https://community.homey.app/t/tuya-cloud-platform-and-homey-scripting/135515>\
**Category:** Tutorials\
**Tags:** tutorial, advancedflow\
**Created:** [April 27, 2025, 7:26am UTC](https://community.homey.app/t/tuya-cloud-platform-and-homey-scripting/135515 "2025-04-27T07:26:58Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Antohagg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/antohagg/32/48013_2.png) [@Antohagg](https://community.homey.app/u/Antohagg)\
**Post date:** [December 11, 2025, 11:08am UTC](https://community.homey.app/t/tuya-cloud-platform-and-homey-scripting/135515/8 "2025-12-11T11:08:45Z")

</div>

I have got everything working, but since the device is not in the Tuya app, I have created a virtual device with the App Device Capabilities.

First I needed to get the device id and the name of the Capabilities, this can be done by dumping out all devices and capabilities with this code and find the device id and the capabilites (this only needs to be done once):

```auto
console.log(await Homey.devices.getDevices());

```

Then i use the device ID:

```auto
const device = await Homey.devices.getDevice({ id: 'whatever the ID is' });

```

To get the value of the Capability i use the name with this code:

```auto
device.capabilitiesObj['whatever the name of the capability is'].value);

```

Then i compare the value recived with the script and update if it is out of sync:

```auto
  if ((device.capabilitiesObj['whatever the name of the capability is'].value) !== (result.result[position].value)) {
    await Homey.devices.setCapabilityValue({
    deviceId:'whatever the ID is', 
    capabilityId:'whatever the name of the capability is',
    value: (result.result[position].value)});
    console.log('På/Av oppdatert med:',(result.result[position].value));
  }

```

Hope this helps if someone is trying the same. Was a lot of trial and error to get the device and set the value of the capabilities.

---

_[View the full topic](https://community.homey.app/t/tuya-cloud-platform-and-homey-scripting/135515)._
