Indirect access to devices in flows

Pass the name and/or id of a device (like a light bulb) to a flow that uses that value to get a device attribute like a light bulb color and to control it like change color and turn on or off, etc.

If this isn’t supported in flows can it be done in homeyscript?
Can it be implemented in flows?

In flow directly i do not found, but…

In flow You can call a homeyscript with and without arguments/return tag in very different ways (You must be Homeyscript app installed).

Inside of this script You then can…

  • iterate and filter/find over all devices, taken via ‘const devices = await Homey.devices.getDevices();’
  • Just use device ID ( something like ‘33774521-1b9c-4159-b4a6-fd5c9b8ead0e’ to directly point to a device
  • Take whatever You want and set into Tag from device.capabilitiesObj
  • Change with device.setCapabilityValue(name,value)
    …

PS. My personal opinion - before apply the homeyscript card make sure, the code is working inside the plain HomeyScript scripts. It’s little bit easier to debug and better to edit.

I am wondering what your use case is for this question?

As @Cuprum mentioned it can be done with homeyscript, but I’m wondering if installing an app of the device to homey isn’t giving you all you need via flow cards.

I do not know @Chuck 's case, but for me ( information about such possibilities ) it comes for some experiments to control devices by fuzzy groups. And.. yes, real life may be little bit more complicated, than Zones can solve. For example, if there is need to build partially overlapping “zones”. Cause of that i already somewhere here hinted about my dream - free labels and activities based on that. For example a card(goal) “Switch on all label ‘nightlight’ devices”.

I agree that in real life you have devices in different zones that you would like to manage as a group (I have created a script as well for that because my lights are not in the same zone)

Just wondering if the app Group app wouldn’t do the same for users who won’t or can’t use homeyscript ? I didn’t use that app because I liked playing with the homeyscript to create what I wanted, but I understand that not all users are like that :smile:

Your suggestion for labels could also work if that was an option indeed

Here’s one use case:

I have a number of RGB bulbs. I want to use color to indicate events like when the green house is getting too cold I’ll set the lights blue.

For these bulbs I have to set the hue, temperator, saturation and color. Doing those 4 steps on 3 bulbs is 12 steps.

I want a controlling flow to call this new flow like a subroutine. Pass the id of the first bulb and the color you want. The subroutine sets it. Now call it with the id’s of the other bulbs.

The Device Capabilities app has flowcards with which you can set multiple devices at once:

In this case most would be a number.