Visible condition with Embedded Configs

Trying to use visibleCondition along with embedded configs. These are the configs you can add directly into the device profile. Is visible condition allowed for embedded defintions:

components:
  - id: main
    capabilities:
      - id: switch
        version: 1
      - id: switchLevel
        version: 1
        config:
          visibleCondition:
            component: main
            capability: switch
            version: 1
            value: switch.value
            valueType: string
            operator: EQUALS
            operand: 'on'

In the example above, just tried to show/hide the switchLevel based on the status of the switch.

Hi, @blueyetisoftware!
Someone asked about these configurations and here I put the feedback from the team:

Basically, not all embedded configurations will take effect because it’s a work in progress, that’s why it isn’t documented yet.

1 Like

Thanks. I actually did see documentation for it, which is why I started messing with it. Just not sure if visibleCondition is allowed. All of the examples change values and that its all I have seen work so far.

Docs

Aah right, this was the update from last week. I’ll ask the team again to see if there’s an update or visibleCondition is still not supported.

1 Like

Hi, @blueyetisoftware
Following up, I confirmed with the team that visibleCondition isn’t supported yet in the embedded configurations.

2 Likes

Hi, @nayelyz Is visibleCondition now supported for embedded configurations?

Hi, @aqua2024
Sorry for the delay, I was making some tests and validating them with the engineering team.
Turns out this is not supported. This property in particular requires us to create a separate device configuration to be able to use it. Here’s an example in case it’s helpful:

{
  "type": "profile",
  "dashboard": {
      "states": [
          {
              "component": "main",
              "capability": "switch",
              "version": 1,
              "idx": 0,
              "group": "main",
              "values": [
                  {
                      "label":"{{switch.value}}",
                      "alternatives":[
                          {
                              "key": "on",
                              "value": "power: ",
                              "type": "active"
                          }
                      ]
                  }
              ],
              "composite": true
          },
          {
              "component": "main",
              "capability": "powerMeter",
              "version": 1,
              "idx": 0,
              "group": "main",
              "values": [
                  {
                      "label": "{{power.value}}{{power.unit}}"
                  }
              ],
              "composite": true,
              "visibleCondition": {
                  "capability": "switch",
                  "component": "main",
                  "version": 1,
                  "value": "switch.value",
                  "operator": "EQUALS",
                  "operand": "on"
              }
          }
      ],
      "actions": [
          {
              "component": "main",
              "capability": "switch",
              "version": 1,
              "idx": 0,
              "group": "main",
              "inline": null
          }
      ],
      "basicPlus": []
  },
  "detailView": [
      {
          "component": "main",
          "capability": "switch",
          "version": 1,
          "values": [],
          "patch": []
      },
      {
          "component": "main",
          "capability": "powerMeter",
          "version": 1,
          "values": [],
          "patch": []
      }
  ],
  "automation": {
      "conditions": [
          {
              "component": "main",
              "capability": "switch",
              "version": 1,
              "values": [],
              "patch": [],
              "exclusion": []
          },
          {
              "component": "main",
              "capability": "powerMeter",
              "version": 1,
              "values": [],
              "patch": [],
              "exclusion": []
          }
      ],
      "actions": [
          {
              "component": "main",
              "capability": "switch",
              "version": 1,
              "values": [],
              "patch": [],
              "exclusion": []
          },
          {
              "component": "main",
              "capability": "powerMeter",
              "version": 1,
              "values": [],
              "patch": [],
              "exclusion": []
          }
      ]
  }
}

//--------------------------------Another sample:
//822a802f-2ead-356a-a3bf-166ddb61c57a
{
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "idx": 0,
                "group": "main",
                "values": [],
                "composite": false
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "component": "main",
            "capability": "temperatureMeasurement",
            "version": 1,
            "visibleCondition": {
                "component": "main",
                "capability": "thermostatMode",
                "version": 1,
                "value": "thermostatMode.value",
                "operator": "ONE_OF",
                "operand": "[\"auto\", \"manual\"]"
            },
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "switchLevel",
            "version": 1,
            "visibleCondition": {
                "component": "main",
                "capability": "thermostatMode",
                "version": 1,
                "value": "thermostatMode.value",
                "operator": "ONE_OF",
                "operand": "[\"fanonly\", \"cool\"]"
            },
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "thermostatMode",
            "version": 1,
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "refresh",
            "version": 1,
            "values": [],
            "patch": []
        }
    ],
    "automation": {
        "conditions": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "switchLevel",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "thermostatMode",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            }
        ],
        "actions": [
            {
                "component": "main",
                "capability": "switchLevel",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "thermostatMode",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            }
        ]
    },
    "type": "profile"
}

Please, let me know if you have questions regarding its creation and usage in a profile.