fanSpeed UI Display change

I’m using fanSpeed for Dimmer Light now. This is because the fan speed of stage 4 fits well with Dimmer Light. So I’m using some changes to the fanSpeed label, but there’s a problem. Some of them are not properly changed.

What I want is that the label of the value of 0,1,2,3,4 of fanSpeed is marked as ‘off’, ‘1’ is marked as 1, ‘2’ is marked as 2, ‘3’, and ‘4’ is marked as 4. The part marked with “fan speed” is marked with “brightness”.

In the case of off, I didn’t want to mark it separately, but strangely, even though only 1, 2, 3, and 4 were set in the dashboard, it was displayed as 0 degree 0 and active, so I put it in the 0 degree setting value, {{i18n.attributes.panSpeed.i18n.value.0.label} which is the 0 default value of fanSpeed, and put it as inactive.
In the case of ‘brightness’, the default value of the swichLevel is ___PO_CODE_CAPABILITY.SMARTTHINGS.I brought SWITCHLEVEL_DEFAULT and used it.
___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT seems to apply properly, but {{i18n.attributes.fanSpeed.i18n.value.0.label}}This value did not apply properly.

Conditions and actions of automation were also modified as follows, but were deleted during upload.

What I’m curious about is my modification of conditions and actions of automation wrong? Anyone can correct it properly?

{
  "mnmn": "-",
  "vid": "ST_13622a65-b27a-4df2-be00-ad19ef964d19",
  "version": "0.0.1",
  "type": "profile",
  "dashboard": {
    "states": [
      {
        "component": "main",
        "capability": "fanSpeed",
        "version": 1,
        "idx": 0,
        "group": "main",
        "values": [
          {
            "alternatives": [
              {
                "key": "0",
                "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                "type": "inactive"
              },
              {
                "key": "1",
                "value": "1",
                "type": "active"
              },
              {
                "key": "2",
                "value": "2",
                "type": "active"
              },
              {
                "key": "3",
                "value": "3",
                "type": "active"
              },
              {
                "key": "4",
                "value": "4",
                "type": "active"
              }
            ]
          }
        ],
        "composite": false
      }
    ],
    "actions": [
      {
        "component": "main",
        "capability": "switch",
        "version": 1,
        "idx": 0,
        "group": "main"
      }
    ],
    "basicPlus": []
  },
  "detailView": [
    {
      "component": "main",
      "capability": "switch",
      "version": 1,
      "values": [],
      "patch": []
    },
    {
      "component": "main",
      "capability": "fanSpeed",
      "version": 1,
      "values": [
        {
          "key": "fanSpeed.value",
          "label": "___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT",
          "alternatives": [
            {
              "key": "1",
              "value": "1",
              "type": "active"
            },
            {
              "key": "2",
              "value": "2",
              "type": "active"
            },
            {
              "key": "3",
              "value": "3",
              "type": "active"
            },
            {
              "key": "4",
              "value": "4",
              "type": "active"
            }
          ]
        }
      ]
    }
  ],
  "automation": {
    "conditions": [
      {
        "component": "main",
        "capability": "switch",
        "version": 1,
        "values": [],
        "patch": [],
        "exclusion": []
      },
      {
        "component": "main",
        "capability": "fanSpeed",
        "version": 1,
        "label": "{{i18n.label}}",
        "displayType": "list",
        "list": {
            "alternatives": [
                {
                    "key": "0",
                    "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                    "type": "inactive"
                },
                {
                    "key": "1",
                    "value": "1",
                    "type": "active"
                },
                {
                    "key": "2",
                    "value": "2",
                    "type": "active"
                },
                {
                    "key": "3",
                    "value": "3",
                    "type": "active"
                },
                {
                    "key": "4",
                    "value": "4",
                    "type": "active"
                }
            ],
            "value": "fanSpeed.value",
            "valueType": "integer",
            "multiSelectable": false
        }
      }
    ],
    "actions": [
      {
        "component": "main",
        "capability": "switch",
        "version": 1,
        "values": [],
        "patch": [],
        "exclusion": []
      },
      {
        "component": "main",
        "capability": "fanSpeed",
        "version": 1,
        "list": {
            "alternatives": [
                {
                    "key": "0",
                    "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                    "type": "inactive"
                },
                {
                    "key": "1",
                    "value": "1",
                    "type": "active"
                },
                {
                    "key": "2",
                    "value": "2",
                    "type": "active"
                },
                {
                    "key": "3",
                    "value": "3",
                    "type": "active"
                },
                {
                    "key": "4",
                    "value": "4",
                    "type": "active"
                }
            ],
            "command": "setFanSpeed",
            "argumentType": "integer"
        }
      }
    ]
  },
  "migration": true,
  "isAutoUpdateRequired": true
}

Hi @Patate, sorry for the delay. We were able to replicate your issue. So, please, let me ask the engineering team about that. As soon as I find something, I will get back to you.

Hi @Ivan_Luis_Falleau Did you get any answers from the engineering team? I recently uploaded it like this, but automation or actions are not reflected at all. Automation or actions return to their original state as if nothing was entered when I received the device configuration again. Dashboard or detail view is reflected, but not properly reflected.For example, “___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT” part comes out as it is.

{
“mnmn”: “f2GW”,
“vid”: “ST_13622a65-b27a-4df2-be00-ad19ef964d19”,
“version”: “0.0.1”,
“type”: “profile”,
“dashboard”: {
“states”: [
{
“component”: “main”,
“capability”: “fanSpeed”,
“version”: 1,
“values”: [
{
“alternatives”: [
{
“key”: “0”,
“value”: “___PO_CODE_CAPABILITY.SMARTTHINGS.FANSPEED_DEFAULT_ATTRIBUTES_FANSPEED_0”,
“type”: “inactive”
},
{
“key”: “1”,
“value”: “1”,
“type”: “active”
},
{
“key”: “2”,
“value”: “2”,
“type”: “active”
},
{
“key”: “3”,
“value”: “3”,
“type”: “active”
},
{
“key”: “4”,
“value”: “4”,
“type”: “active”
}
]
}
],
“idx”: 0,
“group”: “main”,
“composite”: false
}
],
“actions”: [
{
“component”: “main”,
“capability”: “switch”,
“version”: 1,
“idx”: 0,
“group”: “main”
}
],
“basicPlus”:
},
“detailView”: [
{
“component”: “main”,
“capability”: “switch”,
“version”: 1
},
{
“component”: “main”,
“capability”: “fanSpeed”,
“version”: 1,
“values”: [
{
“key”: “fanSpeed.value”,
“label”: “___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT”,
“alternatives”: [
{
“key”: “0”,
“value”: “___PO_CODE_CAPABILITY.SMARTTHINGS.FANSPEED_DEFAULT_ATTRIBUTES_FANSPEED_0”,
“type”: “inactive”
},
{
“key”: “1”,
“value”: “1”,
“type”: “active”
},
{
“key”: “2”,
“value”: “2”,
“type”: “active”
},
{
“key”: “3”,
“value”: “3”,
“type”: “active”
},
{
“key”: “4”,
“value”: “4”,
“type”: “active”
}
]
}
]
}
],
“automation”: {
“conditions”: [
{
“component”: “main”,
“capability”: “switch”,
“version”: 1,
“list”: {
“alternatives”: [
{
“key”: “0”,
“value”: “___PO_CODE_CAPABILITY.SMARTTHINGS.FANSPEED_DEFAULT_COMMANDS_SETFANSPEED_SPEED_0”,
“type”: “inactive”
},
{
“key”: “1”,
“value”: “1”,
“type”: “active”
},
{
“key”: “2”,
“value”: “2”,
“type”: “active”
},
{
“key”: “3”,
“value”: “3”,
“type”: “active”
},
{
“key”: “4”,
“value”: “4”,
“type”: “active”
}
]
},
“exclusion”:
},
{
“component”: “main”,
“capability”: “fanSpeed”,
“version”: 1,
“exclusion”:
}
],
“actions”: [
{
“component”: “main”,
“capability”: “switch”,
“version”: 1,
“exclusion”:
},
{
“component”: “main”,
“capability”: “fanSpeed”,
“version”: 1,
“list”: {
“alternatives”: [
{
“key”: “0”,
“value”: “___PO_CODE_CAPABILITY.SMARTTHINGS.FANSPEED_DEFAULT_COMMANDS_SETFANSPEED_SPEED_0”,
“type”: “inactive”
},
{
“key”: “1”,
“value”: “1”,
“type”: “active”
},
{
“key”: “2”,
“value”: “2”,
“type”: “active”
},
{
“key”: “3”,
“value”: “3”,
“type”: “active”
},
{
“key”: “4”,
“value”: “4”,
“type”: “active”
}
]
},
“exclusion”:
}
]
},
“migration”: true,
“isAutoUpdateRequired”: true
}

Hi, @Patate!

You should try applying those changes following this example:

{
    "type": "profile",
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "idx": 0,
                "group": "main",
                "values": [],
                "composite": true
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "component": "main",
            "capability": "temperatureMeasurement",
            "version": 1,
            "values": [],
            "patch": []
        },
        {
            "component": "main",
            "capability": "fanSpeed",
            "version": 1,
            "values": [
                {
                    "key": "fanSpeed.value",
                    "enabledValues": [
                        "0",
                        "1",
                        "2",
                        "3",
                        "4"
                    ]
                }
            ],
            "patch": [
                {
                    "op": "replace",
                    "path": "/0/slider/alternatives",
                    "value": [
                        {
                            "key": "0",
                            "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                            "type": "inactive"
                        },
                        {
                            "key": "1",
                            "value": "1",
                            "type": "active"
                        },
                        {
                            "key": "2",
                            "value": "2",
                            "type": "active"
                        },
                        {
                            "key": "3",
                            "value": "3",
                            "type": "active"
                        },
                        {
                            "key": "4",
                            "value": "4",
                            "type": "active"
                        }
                    ]
                }
            ],
            "exclusion": []
        }
    ],
    "automation": {
        "conditions": [
            {
                "component": "main",
                "capability": "temperatureMeasurement",
                "version": 1,
                "values": [],
                "patch": [],
                "exclusion": []
            },
            {
                "component": "main",
                "capability": "fanSpeed",
                "version": 1,
                "values": [
                    {
                        "key": "fanSpeed.value",
                        "enabledValues": [
                            "0",
                            "1",
                            "2",
                            "3",
                            "4"
                        ]
                    }
                ],
                "patch": [
                    {
                        "op": "replace",
                        "path": "/0/list/alternatives",
                        "value": [
                            {
                                "key": "0",
                                "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                                "type": "inactive"
                            },
                            {
                                "key": "1",
                                "value": "1",
                                "type": "active"
                            },
                            {
                                "key": "2",
                                "value": "2",
                                "type": "active"
                            },
                            {
                                "key": "3",
                                "value": "3",
                                "type": "active"
                            },
                            {
                                "key": "4",
                                "value": "4",
                                "type": "active"
                            }
                        ]
                    }
                ],
                "exclusion": []
            }
        ],
        "actions": [
        {
            "component": "main",
            "capability": "fanSpeed",
            "version": 1,
            "values": [
                {
                    "key": "fanSpeed.value",
                    "enabledValues": [
                        "0",
                        "1",
                        "2",
                        "3",
                        "4"
                    ]
                }
            ],
            "patch": [
                {
                    "op": "replace",
                    "path": "/0/list/alternatives",
                    "value": [
                        {
                            "key": "0",
                            "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                            "type": "inactive"
                        },
                        {
                            "key": "1",
                            "value": "1",
                            "type": "active"
                        },
                        {
                            "key": "2",
                            "value": "2",
                            "type": "active"
                        },
                        {
                            "key": "3",
                            "value": "3",
                            "type": "active"
                        },
                        {
                            "key": "4",
                            "value": "4",
                            "type": "active"
                        }
                    ]
                }
            ],
            "exclusion": []
        }
        ]
    }
}

I just made a test and it works correctly as shown in the pictures below:


Thank you so much for your answer!
Before I try it, is there any way to change the Fan speed label to Switch level In every label section?
Because it’s a dimming device that’s more suitable for step control than % control, so I’m using fanSpeed as a substitute for SwitchLevel.
If possible, I would like to use it as a label provided by Smartthings by default,
for example, ___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT.

In the past, when I put it like that, the basic label of the switch level came out instead of the answer in the detail view, but now it seems to come out on its own. “___PO_CODE_CAPABILITY.SMARTTHINGS.SWITCHLEVEL_DEFAULT”

I’ll ask the engineering team about this as I see the same behavior.
However, I’m not sure this is a bug. Please, consider that if you want to certify this device, you can’t use a capability for a different purpose than the one it was created for. So, if you have a dimmer device, you cannot use a fanSpeed capability to change its brightness.

This is because the certification team applies the tests for the capabilities based on their purpose, if they have a different one, it would be like having a custom capability, the team won’t be able to guess the behavior expected.

2 Likes

I understand what you mean, but the switchLevel is only % adjustable, so it doesn’t fit my dimmer device. My dimmer device can only be adjusted to brightness in four stages, and even if I look at the original app on my dimmer device, it only moves in 4 steps. I used this because it exactly matches fanSpeed. It actually works well.

I just want to get and use the label only switchLevel one from fanSpeed. Is this possible?

No, the engineering team mentioned the reference “___PO_CODE…” is converted code from the i18n notation by an internal service logic, and it can’t be reverse referenced to the corresponding “i18n.label”, especially from another capability.
So, they suggested using a custom capability or use a plain text label.

An option is to modify the switchLevel capability instead by changing the range and/or the steps defined for the slider. I made two different examples in a single presentation:

reference VID: 3f79f831-4539-3e4b-a47f-9de7068d7113

  1. Change the range to 0-4 and the step is still 1.
//detail view and automation.conditions
{
  "component": "main",
  "capability": "switchLevel",
  "version": 1,
  "values": [
      {
        "key": "level.value",
        "range": [
          0,
          4
        ],
        "step": 1
      }
    ],
  "patch": []
}

//automation - actions
{
  "component": "main",
  "capability": "switchLevel",
  "version": 1,
  "values": [
      {
        "key": "setLevel",
        "range": [
          0,
          4
        ],
        "step": 1
      }
    ],
  "patch": []
}
  1. Leave the range of 0-100 and change the step to 25 (it depends on how many levels you have)
//detail view and automation - conditions
{
  "component": "switch1",
  "capability": "switchLevel",
  "version": 1,
  "values": [
      {
        "key": "setLevel",
        "range": [
          0,
          100
        ],
        "step": 25
      }
    ],
  "patch": []
}

//automation - actions
{
  "component": "switch1",
  "capability": "switchLevel",
  "version": 1,
  "values": [
      {
        "key": "setLevel",
        "range": [
          0,
          100
        ],
        "step": 25
      }
    ],
  "patch": []
}

This is how it looks:

Would it be useful in your case?

1 Like

Thank you so much for attaching the video.
Is it possible to erase % from switchLevel?
In the original app, it is as follows.

Nevertheless, it is still much more natural to operate with fanSpeed.
Then, if it is difficult to refer to “___PO_CODE…” in other capabilities for the label, is it possible to revise the translation only? Or, it’s not bad to just bring the translation.

Unfortunately changing the translation isn’t possible either, that’s something we cannot modify for stock capabilities.

I’m not quite understanding this part, could you elaborate, please?

I asked the engineering team about this because I tried to replace it without success, so, I need to check if there’s a different way of doing it.

fanSpeed Level can be modified to 1, 2, 3, and 4, but why can’t only fanSpeed label be modified?

I mean, if I can’t use the set basic word of capability, I think I can use at least translation.
I’ve never done programming before, so I asked if there would be a way.

Thank you for your help.

It can be modified but we cannot call the translation from another capability (switchLevel in this case) to replace the label. If you put a static text, that will be used instead of the translation of each language which happens for 1-4 as well but it’s not easily noticed because they’re numbers.

The engineering team mentioned you can remove the unit of switchLevel since it’s not required for its events using patch as follows:

"patch": [
    {
        "op": "remove",
        "path": "/0/slider/unit"
    }
]

So, I think this solves the problem of using “fanSpeed” instead, right? or is there anything else that prevents you from using “switchLevel” for the dimmer?

You’re right. I think I can use it in dimmer like this. Thank you very much:)

By the way, there is one more thing that I use fanSpeed other than dimmer.
I’m using it for PM sensors. It’s a structure that continuously sends request signals from the wall pad connected to the sensor to receive PM1.0, PM2.5, and PM10. However, these three things don’t come out all at once, but I can choose the request signal. For example, if I choose PM1.0, only PM1.0’s signal keeps coming out. If I choose PM10, only PM10 keeps coming out. So I’m using this as fanSpeed.

In this case, I think I can refer to what you answered above to change the key value to PM1.0, PM2.5, and PM10. By the way, I also need to change the label of fanSpeed, how can I change the label for detail view, automation, and actions?

I made some tests and I couldn’t change those values in switchLevel and I think it’s because of its displayType (slider), so, I’ll just put the sample of fanSpeed:

reference VID: faf1d617-f483-3c18-b1cf-c4d7d40b6d36

----Detail view
{
  "component": "main",
  "capability": "fanSpeed",
  "version": 1,
  "values": [
      {
          "key": "fanSpeed.value",
          "label":"newLabel",
          "enabledValues": [
              "0",
              "1",
              "2",
              "3",
              "4"
          ]
      }
  ],
  "patch": [
      {
          "op": "replace",
          "path": "/0/slider/alternatives",
          "value": [
              {
                  "key": "0",
                  "value": "{{i18n.attributes.fanSpeed.i18n.value.0.label}}",
                  "type": "inactive"
              },
              {
                  "key": "1",
                  "value": "PM1.0",
                  "type": "active"
              },
              {
                  "key": "2",
                  "value": "PM2.5",
                  "type": "active"
              },
              {
                  "key": "3",
                  "value": "PM10",
                  "type": "active"
              }
          ]
      }
  ]
}

For automation.conditions, the value in “key” is still fanSpeed.value but changes to setFanSpeed in automation.actions due to its presentation configuration.

The label change is included in the sample above, to a static text, this means it will stay that way despite the language in the user’s mobile device.

Remember you can generate the device config from a VID with the command below:
smartthings presentation:device-config vid -j -o=fileName.json

Please, let me know if you have any questions.

I fixed it except for the patch as I tried to reduce the range without changing the label of keys 0, 1, 2, and 3 without 4, but it doesn’t decrease. Is there any other way?

> 
> ----Detail view
> {
>   "component": "main",
>   "capability": "fanSpeed",
>   "version": 1,
>   "values": [
>       {
>           "key": "fanSpeed.value",
>           "label":"newLabel",
>           "enabledValues": [
>               "0",
>               "1",
>               "2",
>               "3"
>           ]
>       }
>   ],
>   "patch": []

I tried thermostatMode as well, but it didn’t work out.
There are various values but I want to use only in, asleep, manual, auto, fanonly.
Is there a way to do this?

  "component": "main",
  "capability": "thermostatMode",
  "version": 1,
  "values": [
    {
      "key": "thermostatMode.value",
      "enabledValues": [
        "in",
        "asleep",
        "manual",
        "auto",
        "fanonly"
      ]
    }
  ],
  "patch": []
},

I also have something to ask about Meter, but I will ask with a new post.

I proceeded with the 1st method you mentioned, and I set Switch Level in action and Switch Level in state on dashboard
I see 0%, 1%, 2%, 3%, 4% in the State and all became active,
can I erase % here too and make it turn off if it’s 0?

image

Sorry, I didn’t set it properly in the detail view, the property you must use to limit the possible values depends on the display type, in the case of “slider”, you need to use “range” as follows:

{
            "component": "main",
            "capability": "fanSpeed",
            "version": 1,
            "values": [
                {
                    "key": "fanSpeed.value",
                    "label":"newLabel",
                    "range": [
                        0,3
                    ]
                }
            ],
            "patch": [...]
}

The values in patch to change the label remain the same

In this case, thermostatMode has an attribute called “supportedThermostatModes” that you can use to limit the options available without having to use the device configuration. Instead, you only need to issue an event to initialize its value with the available options (it’s an array).

Yes, you need to add the patch of the sample below to the device configuration for switchLevel:

{
    "component": "main",
    "capability": "switchLevel",
    "version": 1,
    "values": [
        {
          "key": "level.value",
          "range": [
            0,
            3
          ],
          "step": 1
        }
      ],
    "patch": [//THIS
      {
        "op": "remove",
        "path": "/0/slider/unit"
      } 
    ]
}

For the dashboard view, you can replace what it’s displayed as follows:

"dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "switchLevel",
                "version": 1,
                "idx": 0,
                "group": "main",
                "values": [
                    {
                        "label": "{{level.value}}",
                        "alternatives": [
                            {
                                "key": "0",
                                "value": "Off",
                                "type": "inactive"
                            }
                        ]
                      }
                ],
                "composite": true
            }
        ],
        "actions": [],
        "basicPlus": []
    }

This removes % and will only show the current level except for 0 which shows “Off” and will show an “inactive” status thanks to the alternative type. For example:
image

Please, let me know if you have any questions

1 Like

I added patch content as you said, % disappeared. Thanks!! But the problem is, % still comes out in the History tab, what should I do to make it not come out in the History tab?

And when I checked, even though the rest of the parts (such as the label on fanSpeed) were modified, all of them are marked as original in the History tab. Is there a way to make the modified content come out in the History tab as well?

And can you take a look at this one, too?

Unfortunately, it is not possible to customize the history tab since it comes from the capability’s localization (AKA translation) and that can only be modified by the engineering team.

the dashboard has been changed in the above way. However, [actions] have changed the value according to the key value, but the label appears as Fan speed. I think we need to change the fan speed label of actions in a different way, how can I change it?

The change went well with automation. However, when I changed it, I don’t think automation needs it because it specifies the streaming method of the PM value.
Is there a way to delete the item itself from automation?

So even if I changed it as you said, the history tab will keep showing the previous content? Is there any way I can modify what’s in the History Tab? If there is no way I can change it, I think I need to change the capability. because I’m very confused with the actual FanSpeed.

The PM sensor is a method in which one of PM10, PM2.5, and PM1.0 is continuously streamed, and if the device recognizes dust and recognizes one of the three, it is continuously streamed to one of the three according to the value that is recognized and changed. I can also change it by force.
In this case, which capability is most appropriate? Could you recommend it?

I’m sorry. I have a lot of questions because I’ve never really learned programming before. I’d appreciate it if you could understand.