Device vs homey.devices

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

    capabilityId: 'onoff',
    value: true,

it does not turn on, but if I use

    deviceId:, //same object as above
    capabilityId: 'onoff',
    value: true

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