Selecting all devices during configuration

I am trying to develop a smart app that sends events to a monitoring site (https://www.constantgraph.com) for analysis - you can use it to plot graphs and “disaggregate” a single whole home energy monitor feed into the energy for the individual devices.

I have the basics of the app working and as part of the installation you have to chose which devices you want to be monitored during the PAGE phase of the CONFIGURATION lifecycle event (as described here: Configuration | SmartThings Developers).

{
                        "id": "powerDevices",
                        "name": "Which power devices?",
                        "description": "Tap to set",
                        "type": "DEVICE",
                        "required": false,
                        "multiple": true,
                        "capabilities": [ 'powerMeter' ],
                        "permissions": [ "r" ]
                      },

Is there a way to get the user to select all/any of their devices (rather than just powerMeters)? I have tried putting multiple capabilities into the array e.g. “capabilities” : [‘powerMeter’, ‘switch’] but this just gives me back devices that have both capabilities. I have tried using various combinations of “*” and comma separated lists but they either give me an error or no list of devices at all.

I also tried using “sensor” and “actuator” which are more generic but (at least on my set-up) the devices got filtered out.

I could have multiple settings sections - one for each device capability but as a UI that doesn’t work great as you could end up selected the same device multiple times.

I need to go through this step to be able to grab the device Id and use it in the subscription to the device events - unless someone knows a better way to get device events?

First time post on this forum (I’ve previously been working on the Vera/EZLO hub), so any help appreciated.

Having investigated a bit more, I think I have found my own answer…

In the INITIALIZE phase of the CONFIGURATION lifecycle you get to specify permissions. I had left it blank as per the example in the documentation. However by putting in the following…

"configurationData": {
                "initialize": {
                    "name": "ConstantGraph Web Hook App",
                    "description": "Sends usage data to ConstantGraph for analysis",
                    "id": "app",
                    "permissions": [ "r:devices:*" ],
                    "firstPageId": "1"
               }
}

I can query all of the devices using the /devices API call and retrieve the Ids for all of the devices rather than just the ones the user selected. As such I can delete the section where the user selects the devices to monitor. The problem now is that you can’t create more than 20 subscriptions but at least I have the data to work with.

I want to try setting everything up again and see if I can get it to work this time. Can you confirm that only these is enough to select (all location and all device)
No other flags?

Hi, @Diegocampy.
If I understand correctly, @constantgraph was using a SmartApp because he’s talking about the lifecycle “CONFIGURATION”.
And, you’re creating a Personal Access Token which is not used for SmartApps because they have their own token type which allows you to create subscriptions for example. Perhaps he can provide more info about his case…

I’d be tempted to add ‘List all devices’ in case the app requests a list of devices. None of the other scopes seem to differentiate between listing and reading but as this one does it is probably worth selecting it.

@nayelyz This is a case of the question probably not being in the optimum thread. I believe @constantgraph successfully developed the SmartApp that was the reason for this thread but the practicalities of getting that to the end users led to an API client using a PAT also being produced.

maybe for the language (my bad english) and for my little knowledge of behind the scenes of SmartThings and programming, I didn’t quite understand your messages, but I can answer my question, by listing “all devices” everything seems to work. Now I just have to figure out if it works well and how to do it :sweat_smile::man_shrugging:t2: