# Device vs homey.devices

**URL:** <https://community.homey.app/t/device-vs-homey-devices/104077>\
**Category:** Developers\
**Tags:** homeyscript, homey-pro-2023\
**Created:** [February 15, 2024, 7:03pm UTC](https://community.homey.app/t/device-vs-homey-devices/104077 "2024-02-15T19:03:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nusse1967](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nusse1967/32/80103_2.png) [@nusse1967](https://community.homey.app/u/nusse1967)\
**Post date:** [February 15, 2024, 7:03pm UTC](https://community.homey.app/t/device-vs-homey-devices/104077/1 "2024-02-15T19:03:03Z")

</div>

Hi.  
I find a Device object from it’s name, via `Homey.devices.getDevices()`. The object variable I call “device”. It is a switch which I would like to toggle.  
Now, if I use

```auto
device.setCapabilityValue({
    capabilityId: 'onoff',
    value: true,
  });

```

it does not turn on, but if I use

```auto
 Homey.devices.setCapabilityValue({
    deviceId: device.id, //same object as above
    capabilityId: 'onoff',
    value: true
  });

it works just fine. What is this newbie doing wrong?
```
