Cannot post rules with location capabilities

Yesterday I ran into a little logic issue with a rule that I had posted a couple weeks ago not firing when the condition was met. It was a little error on my part. I updated the rule and posted the updated rule. This morning I tried to post a modified version of the the rule and got…

"One or more invalid capabilities in body"

So I thought maybe I had a typo or something and reverted back to how it was and tried to post that. Same error.

Then I tried to repost a simple “if it’s not cold outside open the shades” rule and it failed with the same error. My guess is the

                        "location":{
                           "attribute":"TemperatureF"
                        }

is failing.

Confirmed it is the

“location”:{“attribute”:“TemperatureF”}

that is causing the failure by removing that from the rule and posting the changed rule.

@nayelyz is the team working on something that is causing this to fail?

Curious. It is certainly working OK at the moment.

Just tried to repost a rule with location/temp and it still fails. If I pull the location/temp out of the rule it posts fine.

How strange. Still OK for me. I was using:

{
    "name": "ZZZZ Temp Test",
    "actions": [
        {
            "if": {
                "greaterThan": {
                    "left": {
                        "location": {
                            "attribute": "TemperatureF"
                        }
                    },
                    "right": {
                        "integer": 40
                    }
                },
                "then": [
                    {
                        "command": {
                            "devices": [
                                "12345678-9012-4e22-a339-b01234567890"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "on"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

That’s pretty much what I’ve been doing. In fact, I took your rule, popped in one of my lights to replace the device, changed the test temp to 5 (it’s cold here today) and tried to post it.

{
    "requestId": "5ACB1695-6BF0-428D-AD9F-71D8A2723A8B",
    "error": {
        "code": "ERR_BAD_REQUEST",
        "message": "One or more invalid capabilities in body",
        "details": []
    }
}

Hi, @mrfitz98

Can you share with us your Rule, please? We can ask the team to check the log of the request ID you shared but it would be useful to see your exact sample

{
    "name": "ZZZZ Temp Test",
    "actions": [
        {
            "if": {
                "greaterThan": {
                    "left": {
                        "location": {
                            "attribute": "TemperatureF"
                        }
                    },
                    "right": {
                        "integer": 5
                    }
                },
                "then": [
                    {
                        "command": {
                            "devices": [
                                "7ecbda0f-b5cc-407b-9cfb-61e16c1b2e44"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "on"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

And the response is -

{
    "requestId": "67A751DE-42EE-4CC8-BE44-55367CF20D2C",
    "error": {
        "code": "ERR_BAD_REQUEST",
        "message": "One or more invalid capabilities in body",
        "details": []
    }
}```

Have you verified this device has the switch capability?

We have been trying to replicate the issue without success, so, it might be something on your side.
Also, are you creating a new Rule or modifying an existing one?

Yes, that device is a switch. It is the device I use to test rules with.

I have 3 rules posted using location /TemperatureF

8c6e4a5b-b66e-472f-8fbe-a53b478b046a
d52e0e76-4703-48b6-9861-1b9f0e099209
4f473380-39ef-4291-ba5a-91e769690099

I posted a rule using that capability yesterday.

8c6e4a5b-b66e-472f-8fbe-a53b478b046a

If I attempt to post any of these rules again, it will fail with the error I gave you. If I take the location / TemperatureF out of the rule it will post.

This is a rule I first posted about 2 weeks ago…

{
    "name": "Open or Close Shades after Sunset",
    "timeZoneId": "America/New_York",
    "actions": [
        {
            "if": {
                "and": [
                    {
                        "equals": {
                            "left": {
                                "device": {
                                    "devices": [
                                        "f7e669af-3c7f-4603-995c-020a61f6b709"
                                    ],
                                    "component": "main",
                                    "capability": "legendabsolute60149.sunSetOffset1",
                                    "attribute": "sunSetOffset"
                                }
                            },
                            "right": {
                                "integer": 26
                            }
                        }
                    },
                    {
                        "lessThan": {
                            "left": {
                                "location": {
                                    "locationId": "7ed84d12-c245-413b-829b-16eccdd3aa41",
                                    "attribute": "TemperatureF"
                                }
                            },
                            "right": {
                                "integer": 45
                            }
                        }
                    },
                    {
                        "not": {
                            "equals": {
                                "left": {
                                    "device": {
                                        "devices": [
                                            "46511b1d-2ce3-49f3-a43b-9669e494d5e2"
                                        ],
                                        "component": "main",
                                        "capability": "windowShade",
                                        "attribute": "windowShade"
                                    }
                                },
                                "right": {
                                    "string": "closed"
                                }
                            }
                        }
                    }
                ],
                "then": [
                    {
                        "command": {
                            "devices": [
                                "6c88e8f7-fbfb-4528-a7b7-f0e75007d2f4",
                                "49b33caa-3690-4ac8-a521-d8629d2df0c0",
                                "9961f729-0835-4b71-ae9c-1584b2b6305a",
                                "21530b5d-c2b2-4a04-8e1a-b974e806705c"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "windowShadeLevel",
                                    "command": "setShadeLevel",
                                    "arguments": [
                                        {
                                            "integer": 6
                                        }
                                    ]
                                }
                            ]
                        }
                    },
                    {
                        "command": {
                            "devices": [
                                "46511b1d-2ce3-49f3-a43b-9669e494d5e2"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "windowShade",
                                    "command": "close"
                                }
                            ]
                        }
                    },
                    {
                        "command": {
                            "devices": [
                                "043e063c-cce2-42c3-815f-5fba76cf8c63"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "windowShadeLevel",
                                    "command": "setShadeLevel",
                                    "arguments": [
                                        {
                                            "integer": 10
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                ],
                "else": [
                    {
                        "if": {
                            "and": [
                                {
                                    "equals": {
                                        "left": {
                                            "device": {
                                                "devices": [
                                                    "f7e669af-3c7f-4603-995c-020a61f6b709"
                                                ],
                                                "component": "main",
                                                "capability": "legendabsolute60149.sunSetOffset1",
                                                "attribute": "sunSetOffset"
                                            }
                                        },
                                        "right": {
                                            "integer": 26
                                        }
                                    }
                                },
                                {
                                    "equals": {
                                        "left": {
                                            "device": {
                                                "devices": [
                                                    "46511b1d-2ce3-49f3-a43b-9669e494d5e2"
                                                ],
                                                "component": "main",
                                                "capability": "windowShade",
                                                "attribute": "windowShade"
                                            }
                                        },
                                        "right": {
                                            "string": "closed"
                                        }
                                    }
                                },
                                {
                                    "greaterThan": {
                                        "left": {
                                            "location": {
                                                "locationId": "7ed84d12-c245-413b-829b-16eccdd3aa41",
                                                "attribute": "TemperatureF"
                                            }
                                        },
                                        "right": {
                                            "integer": 65
                                        }
                                    }
                                }
                            ],
                            "then": [
                                {
                                    "command": {
                                        "devices": [
                                            "6c88e8f7-fbfb-4528-a7b7-f0e75007d2f4",
                                            "49b33caa-3690-4ac8-a521-d8629d2df0c0",
                                            "9961f729-0835-4b71-ae9c-1584b2b6305a",
                                            "21530b5d-c2b2-4a04-8e1a-b974e806705c",
                                            "043e063c-cce2-42c3-815f-5fba76cf8c63",
                                            "46511b1d-2ce3-49f3-a43b-9669e494d5e2"
                                        ],
                                        "commands": [
                                            {
                                                "component": "main",
                                                "capability": "windowShade",
                                                "command": "open"
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

I try to post it now, it gives me that error.

8 Open or Close Shades after Sunset d52e0e76-4703-48b6-9861-1b9f0e099209 7ed84d12-c245-413b-829b-16eccdd3aa41 Home

Details for rule "Open or Close Shades after Sunset"
Key	Value
Status	Enabled
Creator	SMARTTHINGS
Execution	Cloud
Owner ID	7ed84d12-c245-413b-829b-16eccdd3aa41
Owner Type	Location
Date Created	2023-02-01T13:35:29Z
Date Updated	2023-02-01T13:35:29Z

ok, we will ask the team for more info about this.
Can you provide support access to your account, please?

  1. Go to the SmartThings Web (my.smartthings.com)
  2. Log in to your Samsung Account
  3. Select Menu (⋮) and choose Settings
  4. Toggle on Account Data Access
  5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.

Is your email the same one you use here in the forum?

I have turned on access, and yes, this email is good.

None of the rules that I had posted which used location / TemperatureF work anymore. I’ve had variations of these rules running for weeks. The rules still show as “enabled.” So it is not an issue with just posting the rules, the system is no longer executing the rules that had been posted.

ok, thank you for the information, @mrfitz98
We’ll check more details with the engineering team and get back to you.

Over the weekend I attempted to post the rules with location /TemperatureF and each time it failed with the “One or more invalid capabilities in body” error.

Monday morning I tried again and it also failed. Monday afternoon I tried again and was able to post the rules successfully.

This stopped working Friday, and started working again Monday afternoon. All rules I had which used TemperatureF as a condition stopped working. It wasn’t just that I could not post rules, the ones I had posted stopped working too.

I find it very disturbing that a SmartThings managed capability can just stop working for an individual location (which is what I think happened based on the fact that others in different locations did not have this problem.) Obviously SmartThings should not be trusted with anything critical.

Hi, @mrfitz98. This is a little confusing, does it mean that what started to work on Monday is just the creation of the Rule but the functionality is still incorrect?

It is strange that it is only happening in one location and to you as @orangebucket mentioned he had no issues with his Rules.

Friday I could not post rules that were using that capability.

Rules that had previously been working fine that had that capability stopped working.

Saturday I could not post rules that were using that capability.

Rules that had previously been working fine that had that capability were not working.

Sunday I could not post rules that were using that capability.

Rules that had previously been working fine that had that capability were not working.

Monday morning I could not post rules that were using that capability.

Rules that had previously been working fine that had that capability were not working.

Monday evening I was able to post a rule using that capability.

Rules that had previously been working fine that had that capability were now working.

On a related question, where do I get the list of attributes associated with “location”?

Thanks

Henry

You have to drill down into the API reference. It ends up saying:

attribute

required string (LocationAttribute)

Enum: "FineDust" "FineDustIndex" "Humidity" "Mode" "Security" "Temperature" "TemperatureC" "TemperatureF" "UltraFineDust" "UltraFineDustIndex" "Weather" "WeatherAlertSeverity"

Unfortunately the possible values don’t seem to be documented.

@orangebucket

Following this thread I´m trying to use some of these values in a rule to write to a tile (using @Mariano_Colmenarejo ‘s Number Field from his Virtual Devices) to compare with my home AirQ sensor values. Triggering from changes in location UltraFineDust value I can write without problem from my PM2.5 dust sensor but can’t find the syntax to write the location value. Unable to see how to use `LocationAttribute’ string you mention here - don´t know if there are any examples or documentation anywhere.
Trying as an alternative on a text field the rule is accepted but, logically being numeric fails - on the API browser Execute button it shows failure but I do see the values, so they are being retrieved. Any ideas on this one? Thanks

The code I’m trying, but the API browser returns “operand not valid for operation” is

{
   "if": {
    "changes": {
     "operand": {
      "location": {
       "locationId": "MY LOCATION ID",
       "attribute": "UltraFineDust",
       "trigger": "Always"
      }
     }
    },
    "then": [
     {
      "command": {
       "devices": [
        "221eb0e5-a898-4f7e-b8cd-e0329371d7e8"
       ],
       "commands": [
        {
         "component": "main",
         "capability": "legendabsolute60149.numberFieldOne",
         "command": "setNumberFieldOne",
         "arguments": [
          {
           "device": {
            "devices": [
             "MY PM2.5 SENSOR ID"
            ],
            "component": "main",
            "capability": "fineDustSensor",
            "attribute": "fineDustLevel"
           }
          }
         ]
        }
       ]
      }
     },
     {
      "command": {
       "devices": [
        "221eb0e5-a898-4f7e-b8cd-e0329371d7e8"
       ],
       "commands": [
        {
         "component": "main",
         "capability": "legendabsolute60149.numberFieldTwo",
         "command": "setNumberFieldTwo",
         "arguments": [
          {
           "location": {
            "locationId": "MY LOCATION ID",
            "attribute": "UltraFineDustIndex"
           }
          }
         ]
        }
       ],
       "sequence": {
        "commands": "Serial",
        "devices": "Serial"
       }
      }
     }
    ],
    "sequence": {
     "then": "Parallel",
     "else": "Serial"
    }
   }
  }