SmartThings API Browser+ ... Now Available to All

I don’t know if it’s the correct place to ask, sorry, I was looking at the info of the mobile phones at home, because my wife’s Oneplus 9 no longer marked the position correctly and I discovered that some info is not present for him, but yes for mine Pixel 7 pro.

For Pixel 7 Pro, I press Detail in Browser+ menu and I receive this information:

For Oneplus 9 I press Detail in Browser+ menu and I receive, before this error:
image
and after the detail is this, without Parent ID and Parent Name. Why?


I thought this was the problem because the geolocation was working badly, but even after deleting this device, and re-enabling the geolocation, the data remains the same and now it’s working again

I think I can guess what is going on there.

The ‘Parent ID’ there is actually the parentDeviceId in the device object that the API returns. The ‘Parent Name’ is determined by requesting that device ID from the API and reading the label.

Not all devices have a parentDeviceId. For hub connected devices the parent is the hub. For mobile presence devices of type MOBILE the parent is a device that represents the phone or tablet itself. I call it a ‘mobile as a thing’ because the presentation is Mobile_as_a_thing. This is also of type MOBILE and the name and label have always been the same as the mobile presence device for me (but then I haven’t renamed my mobile presence devices).

The ‘mobile as a thing’ device is not part of a SmartThings Location and so it can only be read from the API by the owner account. So for your own mobile the device can be read and the name retrieved, but for your wife’s mobile the device cannot be read and you get the 403 error. Todd has presumably elected not to display the ‘Parent ID’ in this case.

1 Like

I have been using the API Browser + to enter rules. I created a rule that runs every 10 minutes. I want to have multiple actions that occur when this rule is triggered. I created a JSON file with the multiple Actions and imported the file with no errors.

When I click on the Rule and select Details, it only shows the last Action. Here is what is shown:

{
“every”: {
“interval”: {
“value”: {
“integer”: 10
},
“unit”: “Minute”
},
“actions”: [
{
“command”: {
“devices”: [
“mqtt device id”
],
“commands”: [
{
“component”: “main”,
“capability”: “partyvoice23922.numberfield”,
“command”: “setNumber”,
“arguments”: [
{
“device”: {
“devices”: [
“zwave device id”
],
“component”: “main”,
“capability”: “illuminanceMeasurement”,
“attribute”: “illuminance”
}
}
]
}
]
}
}
]
}
}

I removed the actual IDs from the list above.

Here is what was in my JSON file:

{
“name”: “Every 10 min copy illuminance - MQTT”,
“actions”: [
{
“every”: {
“interval”: {
“value”: {
“integer”: 10
},
“unit”: “Minute”
},
“actions”: [
{
“command”: {
“devices”: [
“mqtt device 1 id”
],
“commands”: [
{
“component”: “main”,
“capability”: “partyvoice23922.numberfield”,
“command”: “setNumber”,
“arguments”: [
{
“device”: {
“devices”: [
“zwave device 1 id”
],
“component”: “main”,
“capability”: “illuminanceMeasurement”,
“attribute”: “illuminance”
}
}
]
}
]
},
“command”: {
“devices”: [
“mqtt device 2 ID”
],
“commands”: [
{
“component”: “main”,
“capability”: “partyvoice23922.numberfield”,
“command”: “setNumber”,
“arguments”: [
{
“device”: {
“devices”: [
“zwave device 2 id”
],
“component”: “main”,
“capability”: “illuminanceMeasurement”,
“attribute”: “illuminance”
}
}
]
}
]
},
“command”: {
“devices”: [
“mqtt device 3 id”
],
“commands”: [
{
“component”: “main”,
“capability”: “partyvoice23922.numberfield”,
“command”: “setNumber”,
“arguments”: [
{
“device”: {
“devices”: [
“zwave device 3 id”
],
“component”: “main”,
“capability”: “illuminanceMeasurement”,
“attribute”: “illuminance”
}
}
]
}
]
}
}
]
}
}
]
}

This file is imported and does not generate any errors.

Does the API Browser + not support multiple Actions?

The API Browser+ simply submits the JSON to the API similar to the ST CLI command “smartthings rules:create”. Documentation on the API is here. I’d be curious to see what is returned when you use the CLI to retrieve the rule.

I’m just getting into rules myself, so if I can help I think this should work

{
 "name": "Every 10 min copy illuminance - MQTT",
 "actions": [
  {
   "every": {
    "interval": {
     "value": {
      "integer": 10
     },
     "unit": "Minute"
    },
    "then": [
     {
      "command": {
       "devices": [
        "mqtt device 1 id"
       ],
       "commands": [
        {
         "component": "main",
         "capability": "partyvoice23922.numberfield",
         "command": "setNumber",
         "arguments": [
          {
           "device": {
            "devices": [
             "zwave device 1 id"
            ],
            "component": "main",
            "capability": "illuminanceMeasurement",
            "attribute": "illuminance"
           }
          }
         ]
        }
       ]
      }
     },
     {
      "command": {
       "devices": [
        "mqtt device 2 ID"
       ],
       "commands": [
        {
         "component": "main",
         "capability": "partyvoice23922.numberfield",
         "command": "setNumber",
         "arguments": [
          {
           "device": {
            "devices": [
             "zwave device 2 id"
            ],
            "component": "main",
            "capability": "illuminanceMeasurement",
            "attribute": "illuminance"
           }
          }
         ]
        }
       ]
      }
     },
     {
      "command": {
       "devices": [
        "mqtt device 3 id"
       ],
       "commands": [
        {
         "component": "main",
         "capability": "partyvoice23922.numberfield",
         "command": "setNumber",
         "arguments": [
          {
           "device": {
            "devices": [
             "zwave device 3 id"
            ],
            "component": "main",
            "capability": "illuminanceMeasurement",
            "attribute": "illuminance"
           }
          }
         ]
        }
       ]
      }
     }
    ]
   }
  }
 ]
}

UPDATE should not have changed “actions” for “then” !

I changed the file to use the term “then” instead of “action” and it returns a message that the JSON is malformed and it lists “then” as the problem.

No sorry - I updated the post with a footnote to say that it should be “actions” in this case. Don’t know why they use the tag “actions” in the “every” function and “then” in all other functions, when “actions” is the bracketing for the whole file.
Try replacing simply “then” with “actions” in the code I sent you and copy/paste…should run

I figured out the problem.

I did not have each command inside { }. Once I fixed this it started working correctly.

Thanks for the great help and API Browser.

1 Like

NOTICE OF UPDATE

API Browser+ has been updated with the following changes:

  • New ‘Rules’ button on device list screen (Devices->Devices menu): selecting a device and clicking the ‘Rules’ button will show all rules using the device (suggested by @Johnnybegoode)
    • Caveat: Rules created using the CLI are not accessible through the published API with your Personal Access Token; therefore CLI-created Rules are not listed (there is a way around this using undocumented APIs that I’ve not implemented here)
  • Suppression of 403 error seen when displaying details for some mobile devices (reported by @Diegocampy )
  • Fix to issue where some devices may not get listed when selecting ‘Where used’ for a capability

A couple of notes regarding Rules

  • As mentioned above, be aware that Rules created using the CLI are not listed
  • If you are just learning about Rules, it can be really useful to see the Rule representation of your existing automation routines created through the app. You can view the Rules syntax for both your regular routines and lighting automations by viewing the details under the Automations menu item.

Simply refresh your browser to start using the update.

12 Likes

The API Browser +

but it is already the standard for many users. Now for those using rules an important function which gets over looking for a ‘needle in a haystack’
Congratulations, I’m sure many people like myself really appreciate your work.

PS As a user I have learnt rules precisely using the API Browser+ :+1:

4 Likes

7 posts were split to a new topic: Create rule that compares temperatures?

Hi @TAustin , is there any way to query the hub to see what time it is set to? I had a significant power outage yesterday and now all my timed routines are out. I believe it will reset itself in 24 hours, but it would be good to be able to check what time the hub thinks it is.

A driver can get it, but don’t have any general purpose driver just to do that and display it. If you happen to use my ONVIF driver for video cameras, it shows the hub time on the device details screen, but I can’t think of any others that do that.

1 Like

@TAustin,
Why would I be getting a http error 401 popup after putting on the token?

It is likely something wrong with your Token - either it didn’t get copy/pasted correctly, OR it doesn’t have the required minimum access authorizations. Make sure you have at least read authority for locations, devices, etc.

Thanks Todd. Any chance you could add it to the Hub “Details” pages?

Not a big deal as major power outages are thankfully rare, but it would be good info to have access to.

1 Like

So weird. Doing it again with a new toek worked. Oh well.thanks!

@TAustin

The CLI displays a lot more information about a hub when the -j option is used on the command line. Not sure if it’s calling a different API or providing additional information in the URL to get that detailed data. It would be nice if we could have that info (or an option to get it) in the API Browser+.

Thanks!

bep@debian10:~$ st devices 80 -j
{
    "deviceId": "2ca01359-7f67-469e-9887-172e72b0423f",
    "name": "SmartThings Hub",
    "label": "SmartThings Hub",
    "manufacturerName": "SmartThings",
    "presentationId": "SmartThings-smartthings-hub",
    "locationId": "b355f7f5-7de9-4294-883d-d31b6c96b166",
    "roomId": "873f5f82-9b16-4cd6-aa63-cab6842c9c92",
    "sharedLocations": [],
    "components": [
        {
            "id": "main",
            "label": "main",
            "capabilities": [
                {
                    "id": "bridge",
                    "version": 1
                }
            ],
            "categories": [
                {
                    "name": "Hub",
                    "categoryType": "manufacturer"
                }
            ]
        }
    ],
    "createTime": "2018-08-18T23:04:06Z",
    "childDevices": [
        {
            "id": "0118d1a0-3681-4160-8bbf-35f8e262776d"
        },
        {
            "id": "08bbdb98-a5bd-4364-b613-fe9bcc5a35dc"
        },
        {
            "id": "0c678864-06f6-43c5-a918-5a6811e53af5"
        },
        {
            "id": "0eb12e0c-e37d-4592-9d67-b560a0040800"
        },
        {
            "id": "0ed08dc5-906c-49a3-87e8-e3b5a5d2ff1e"
        },
        {
            "id": "1acf11bd-0a41-4f98-86e4-ec1e8251d0cd"
        },
        {
            "id": "1df0ca69-3751-4cf4-bd98-04a8cf2633e4"
        },
        {
            "id": "1f8b4244-5e1a-49ac-a8c7-9b8cfc6ee40f"
        },
        {
            "id": "227a0c45-aa2d-4a62-9de5-d4dcc32aab30"
        },
        {
            "id": "227a5cc2-bb4c-49fd-abc7-58b094129113"
        },
        {
            "id": "22e2e7fc-0c38-46ff-8018-6f7943fd22dc"
        },
        {
            "id": "33461da0-5d43-4b30-ae21-97996b5a9442"
        },
        {
            "id": "3aaf6167-92bd-41d6-a976-101a6951272d"
        },
        {
            "id": "433b0f1a-1c97-4836-b6b7-b123712f6cb6"
        },
        {
            "id": "44127f0d-fafd-47e3-942f-529df20f6d40"
        },
        {
            "id": "477e4502-d4de-4a22-83bd-446c36afa791"
        },
        {
            "id": "4b02381e-ddbc-4c23-978c-9ba60871c04b"
        },
        {
            "id": "4c390cf9-5eda-4f1c-a45f-7d20041ec678"
        },
        {
            "id": "4ca23599-804b-42fb-96e2-f2f83394e5a6"
        },
        {
            "id": "54027168-238d-4e16-9c9a-76b53808f03c"
        },
        {
            "id": "54a0731f-ccd0-424f-9b13-456ed5082af7"
        },
        {
            "id": "54a6b897-1a57-4153-8211-e12233049cc4"
        },
        {
            "id": "55813903-c855-4234-9ae4-0b6d50905cd0"
        },
        {
            "id": "659a0db9-982c-4fec-9b7c-4ea1d67af43c"
        },
        {
            "id": "65fa4ab8-b3ff-4f7c-afdd-a5ff86c71fb5"
        },
        {
            "id": "67236182-67bc-499e-9814-7c11c33d9d95"
        },
        {
            "id": "69e354f2-6181-496b-9db3-3403de5d2679"
        },
        {
            "id": "6c11b69a-1355-49a1-9791-15fdd162cf78"
        },
        {
            "id": "6f9d59cb-c649-4a3e-9cd1-b1dfd6dae7b5"
        },
        {
            "id": "77cc71e2-8094-4221-82b3-8fecacf24ae9"
        },
        {
            "id": "7892b5d4-3058-4521-9350-79799a33685c"
        },
        {
            "id": "78efa5bf-2f5d-4799-9621-aa4b132cf74d"
        },
        {
            "id": "7bb87892-bab7-46af-be22-0bbfeb35656c"
        },
        {
            "id": "7df2ce3c-cd42-4ce6-ad86-cda5698bd57d"
        },
        {
            "id": "890916a0-6d6a-47e2-8aac-90435ede1638"
        },
        {
            "id": "8c44c5d5-917a-4731-86d7-07becbd4cca2"
        },
        {
            "id": "95130d4e-f4ee-4c39-b624-ad6013361692"
        },
        {
            "id": "9794469e-6bda-458b-a2a7-bcbfb0dd989a"
        },
        {
            "id": "9bea3a86-7c98-4a0d-9f9e-6865374b3762"
        },
        {
            "id": "9c04ec4f-9289-41a1-864c-3462b16f3d8b"
        },
        {
            "id": "9ce207fd-70df-4c4f-89f2-616540f3a005"
        },
        {
            "id": "9d10db22-bde6-4e17-9d5c-f8863d8f1f0c"
        },
        {
            "id": "9e43361b-b9b2-4d76-85ab-81573012b326"
        },
        {
            "id": "a095762a-6546-4a08-9deb-982123a4101a"
        },
        {
            "id": "aa328f4d-8638-4e92-a4b5-64259722b355"
        },
        {
            "id": "ace97563-d9b3-4449-90be-96ffd16c1d8d"
        },
        {
            "id": "b4cf0bff-2de2-4ad7-8636-740cd8086eae"
        },
        {
            "id": "b50db8e2-dff8-4dbc-a4af-6fbb584a24a8"
        },
        {
            "id": "b9648329-2b79-47d2-b49e-05692ce079c2"
        },
        {
            "id": "b981d46a-a0bf-4369-a3d6-be50daa6a220"
        },
        {
            "id": "b99ebbfd-fc49-4294-8cff-83bd20bdf42e"
        },
        {
            "id": "bacde126-e038-4126-b324-65330c59fc0f"
        },
        {
            "id": "be62d82a-af36-4b1b-81f1-2700a702c36c"
        },
        {
            "id": "bfd83f23-e71e-49c2-8e0e-958b58b549c7"
        },
        {
            "id": "c0abc8cf-c672-4ae7-bb5e-77d42e1600bd"
        },
        {
            "id": "c51f9d0f-8e2b-4966-9644-6d5f5d889eeb"
        },
        {
            "id": "c7211f72-3ad8-409c-a987-899fa5d87c62"
        },
        {
            "id": "c87d89e8-0eda-4919-9aaf-d0f398ae0b3d"
        },
        {
            "id": "ce111b99-0356-4a5b-afe0-99d178dee97e"
        },
        {
            "id": "d0c7f339-91f0-494c-8364-af4324472019"
        },
        {
            "id": "d4389e1e-d1ae-4e0b-8e9e-94e717e5f5cb"
        },
        {
            "id": "d81ed923-338e-467b-8714-0bf71fb51c06"
        },
        {
            "id": "d9f209c8-7a8f-4f41-85a8-631f7e28bffd"
        },
        {
            "id": "e2b994b2-d3fc-45d9-a81f-b963d77404c6"
        },
        {
            "id": "e67963f6-1506-4b88-a73e-7b1e769b2579"
        },
        {
            "id": "e7e6c422-1e26-4af8-b293-6b3ad687f753"
        },
        {
            "id": "e9f2e8d4-2a73-4098-a89e-bd802a212d28"
        },
        {
            "id": "ff50e788-74ef-4253-ae18-bd42c2598f2a"
        }
    ],
    "profile": {
        "id": "f6769ddf-caa6-309c-800a-f9944b60b014"
    },
    "hub": {
        "hubEui": "D052A8ACA3C60001",
        "firmwareVersion": "000.046.00010",
        "hubDrivers": [
            {
                "driverVersion": "2023-05-18T20:05:48.552939015",
                "driverId": "d9c3f8b8-c3c3-4b77-9ddd-01d08102c84b",
                "channelId": "15ea8adc-8be7-4ea6-8b51-4155f56dc6cf"
            },
            {
                "driverVersion": "2023-01-24T19:42:49.409144353",
                "driverId": "7824e4db-9ee9-4443-8452-ddc4e4290108",
                "channelId": "c09d2a68-e32c-4366-a4fc-ea4731b96ec3"
            },
            {
                "driverVersion": "2023-05-02T19:26:17.438415188",
                "driverId": "c21a6c77-872c-474e-be5b-5f6f11a240ef",
                "channelId": "b1373fea-da9b-434b-b674-6694ce5d08cc"
            },
            {
                "driverVersion": "2023-01-30T23:52:49.99918411",
                "driverId": "59869ce8-ee90-4c26-b465-19b7b071d521",
                "channelId": "c09d2a68-e32c-4366-a4fc-ea4731b96ec3"
            },
            {
                "driverVersion": "2023-05-16T19:19:45.251021148",
                "driverId": "c856a3fd-69ee-4478-a224-d7279b6d978f",
                "channelId": "15ea8adc-8be7-4ea6-8b51-4155f56dc6cf"
            },
            {
                "driverVersion": "2023-05-16T21:32:21.420306228",
                "driverId": "f2e891c6-00cc-446c-9192-8ebda63d9898",
                "channelId": "b1373fea-da9b-434b-b674-6694ce5d08cc"
            },
            {
                "driverVersion": "2023-05-01T14:41:24.454431022",
                "driverId": "7ca45ba9-7cfe-4547-b752-fe41a0efb848",
                "channelId": "c8bb99e1-04a3-426b-9d94-2d260134d624"
            },
            {
                "driverVersion": "2023-05-17T04:17:21.217313249",
                "driverId": "0fd9a9a4-8863-4a83-97a7-5a288ff0f5a6",
                "channelId": "e6e29aeb-2793-4ebf-b8f6-e37b69e32c61"
            },
            {
                "driverVersion": "2022-12-02T05:33:35.530471412",
                "driverId": "b874bb3e-37ae-4c96-9ea4-65ef9ac1e2e2",
                "channelId": "2423da55-101c-4b21-af58-0903656b85ca"
            },
            {
                "driverVersion": "2023-04-11T19:49:55.817826242",
                "driverId": "dbe192cb-f6a1-4369-a843-d1c42e5c91ba",
                "channelId": "15ea8adc-8be7-4ea6-8b51-4155f56dc6cf"
            },
            {
                "driverVersion": "2022-09-18T14:12:33.434674562",
                "driverId": "038a9312-66c8-4a30-9299-b346d57f28a9",
                "channelId": "c09d2a68-e32c-4366-a4fc-ea4731b96ec3"
            },
            {
                "driverVersion": "2023-05-13T00:43:59.737274872",
                "driverId": "caabad91-9ac2-4232-b14a-6f451301f1b3",
                "channelId": "42512f35-e905-416d-8696-479587f23fe2"
            },
            {
                "driverVersion": "2022-10-02T20:15:49.147522379",
                "driverId": "e120daf2-8000-4a9d-93fa-653214ce70d1",
                "channelId": "479886db-f6f5-41dd-979c-9c5f9366f070"
            },
            {
                "driverVersion": "2023-02-28T20:01:53.843314039",
                "driverId": "0f206d13-508e-4342-9cbb-937e02489141",
                "channelId": "b1373fea-da9b-434b-b674-6694ce5d08cc"
            },
            {
                "driverVersion": "2023-05-01T16:47:41.617579276",
                "driverId": "6342be70-6da0-4535-afc1-ff6378d6c650",
                "channelId": "c8bb99e1-04a3-426b-9d94-2d260134d624"
            },
            {
                "driverVersion": "2023-02-15T13:12:48.26082512",
                "driverId": "5ad2cc83-5503-4040-a98b-b0fc9931b9fe",
                "channelId": "479886db-f6f5-41dd-979c-9c5f9366f070"
            },
            {
                "driverVersion": "2023-04-24T00:20:33.095683352",
                "driverId": "e67c842f-49a5-4083-95f0-c8137ae3c2f6",
                "channelId": "e6e29aeb-2793-4ebf-b8f6-e37b69e32c61"
            },
            {
                "driverVersion": "2023-01-25T13:03:35.528496166",
                "driverId": "2575f638-2ebb-429c-91a2-9bff827396a0",
                "channelId": "c09d2a68-e32c-4366-a4fc-ea4731b96ec3"
            }
        ],
        "hubData": {
            "zwaveStaticDsk": "17190-53446-57653-19148-39064-09804-17750-45437",
            "zwaveS2": true,
            "hardwareType": "CELL_HUB",
            "hardwareId": "0024",
            "zigbeeFirmware": "5.4.7",
            "zigbee3": true,
            "zigbeeOta": "2",
            "otaEnable": "false",
            "zigbeeUnsecureRejoin": false,
            "zigbeeAvailability": "Available",
            "zwaveAvailability": "Available",
            "lanAvailability": "Available",
            "matterAvailability": "Unsupported",
            "localVirtualDeviceAvailability": "Available",
            "zigbeeChannel": "20",
            "zigbeePanId": "48CB",
            "zigbeeEui": "000B57FFFEF6A65E",
            "zigbeeNodeID": "0000",
            "zwaveNodeID": "01",
            "zwaveHomeID": "D72CE6D6",
            "zwaveSucID": "01",
            "zwaveVersion": "6.04",
            "zwaveRegion": "US",
            "macAddress": "F4:C2:48:2E:6E:3E",
            "localIP": "192.168.1.217",
            "zigbeeRadioFunctional": true,
            "zwaveRadioFunctional": true
        }
    },
    "type": "HUB",
    "vid": "SmartThings-smartthings-hub",
    "mnmn": "SmartThings",
    "ocfDeviceType": "x.com.st.d.hub",
    "restrictionTier": 0,
    "allowed": null
}
1 Like

Sure I’ll take a look!

1 Like

And also, it would be nice to either provide a link from the location ID of the hub or a separate way to see the locations associated with your account that provides this:

$ ./smartthings locations 1
─────────────────────────────────────────────────────────
 Name               My home
 Location Id        abc123ab-c123-abc1-23ab-000000000000
 Country Code       USA
 Time Zone Id       America/Los_Angeles
 Background Image
 Latitude           45.51498617
 Longitude          -122.67886289
 Region Radius      250
 Temperature Scale  F
 Locale             en-US
─────────────────────────────────────────────────────────
1 Like