Custom UI visibleCondition

Trying to use visibleCondition but getting “unsuccessful-http-call status=400”

Whats the correct usage?

"dashboard": {
    "states": [
        {
            "component": "main",
            "capability": "switch",
            "version": 1,
            "values": [],
            "visibleCondition": {
                "capability": "switch",
                "component": "main",
                "version": 1,
                "value": "switch.value",
                "operator": "EQUALS",
                "operand": "on"
            }
        }...

Tagging @erickv

1 Like

Hi, @rym002

I’ve noticed that you’ve skipped the definition of the values that your device-config/dashboard will query. For a better reference, take a look at the Device Configuration documentation at the SmartThings CLI Wiki.

When i remove visibleCondition it submits without error. I am trying to make the switch state visible only if the switch is on.

When you read the developer docs, discussion of visibleCondition is limited to the automations section and the example suggests "attribute": "switch" rather than "value": "switch.value". That is presumably out of date but …

When you read the Core SDK code, the code comments do suggest the form "value": "switch.value" for all sections. However the test case in the SDK doesn’t use that format. It uses "value": "valueName". On the face of it, that shouldn’t be valid. So I am wondering if "value": "switch" is worth a go, if you haven’t already tried it.

1 Like

I tried both “switch” and “value” for the “value” attribute, both continue to receive 400 error.