[ST Edge] Temperature Scale set for the location

Hi guys,

It seems only Celsius scale is supported for temperature measurement.
When I emit an event with unit=“F” the value is transformed back to “C” and it is always shown in “C” in the application.

<ZigbeeDevice: bad318ca-4d15-434f-9bc0-8632dd577599 [0x042F] (Aqara Dual Switch LLKZMK11LM Edge)> emitting event: {“attribute_id”:“temperature”,“capability_id”:“temperatureMeasurement”,“state”:{“unit”:“F”,“value”:90},“component_id”:“main”}

Thanks

Have you checked the temperature scale of your location?
Make a GET request to: https://api.smartthings.com/v1/locations/locationId
If it’s “C” and you want to change it to “F”, send a PUT request to the same endpoint with the following payload

{
  "name": "Home",
  "temperatureScale": "F"
}
1 Like

@nayelyz Thank you for a quick reply.
My location is indeed in “C”, I was hoping to override this setting for a single device by issuing temperature event in different units.
Is it supported?

Let me verify some details with the engineering team and I’ll get back to you.

1 Like

Hi @ygerlovin, the behavior is expected. If we had the option we would probably go back in time and only allow a single unit for capabilities and handle units only at the presentation layer. The alternative we considered to transforming select units would be to require drivers to be aware of the location temperature scale but this is something we believed would represent a poor separation of concerns and would result in a greater number of defects across the ecosystem.

If you really want to report temperature in another unit than what is used for the location, this could be done via a custom capability for your driver.

1 Like

Thanks @posborne ,

I was trying to create a custom capability, by basically copying temperatureMeasurement presentation, but my capability doesn’t show historical data button.
I was looking at presentation of Power, Energy and Temperature capabilities.
All of them allow not only see the current value, but also the historical data, but I can’t figure out what in presentation tells the platform to collect and/or show it.

Also, voltage measurement shows the color bar. It would be really cool to reuse it for temperature.

Could you please clarify how this could be done?
Thanks

The historical data button is part of the custom UI of those standard capabilities, up to now, we cannot edit the UI of the custom capabilities to, for example, add that option or change the design.

Thank you, @nayelyz

I’m not sure I completely understand.
Doesn’t capability presentation define how the capability looks in the App?
Or you mean there are hidden additional presentations elements for stock capabilities, that are not accessable for custom presentations?

What I basically need is to inherit the stock capability and just override units handling

Yes, those special options are not available to add to the custom capability presentation, there’s no property that we could include in the presentation to make the historical button visible.
Also, for example, the battery has a slider display type, but it changes color based on the battery level. This is considered as custom UI for the capabilities as well.

@nayelyz thanks, understood.

Could you please elaborate what are the considerations for such implementation?

Clearly, having different look and feel for stock and custom capabilities is not optimal, to say the least

Our team is working to provide a better experience using custom capabilities, when features like this become available, they are included in the announcements and newsletter so, stay tuned on that.
In the meantime, I’ll share your feedback to the corresponding team.

1 Like

@nayelyz is there also a way to change this in the ST app?

In the moment I’ve edited it in the groovy UI.

In my case the device temperature sensor can be switched between F and C and for testing this will be interesting. But in most cases this will not cause any problems, because most ST users have the locale set correctly.

No, the scale used by the ST app cannot be modified using a driver action based on the device preferences.
It depends on the scale selected for the location:

You can change the scale sent by the device but the app will convert that value automatically. It should be saved as it is in the API status.
However, capabilities like thermostatCoolingSetpoint and thermostatHeatingSetpoint will show the unit sent in the event, it means it won’t be converted (There’s already a report about that).

1 Like

@nayelyz thanks for the feedback :+1:t6:

1 Like

hello @nayelyz
I found this thread after two days struggling the way to show the historical data in custom capabilities. Now I realize there’s no way to show Hystorical data, neither to have full control of the slider presentation for custom cap.
After two years of work…was the Smartthimngs team able to release some solution to improve the UI for custom presentation?

Hi, @Roberto_Vietti
By “full control”, do you mean being able to change its design? What are you trying to achieve? because currently, you can present it as something to read-only, like a battery level (but without special colors) or to send commands (with the circle you can move from one point to another).

What do you mean by “improve”? Currently, we cannot modify its UI or use one of the custom UI from standard capabilities on them (like the Graph of historical data) but if you have a specific issue non-related to those, it would be helpful to get more info.

thanks @nayelyz for answering.
One step back: I cloned and extended the powerMeter capabilities into a custom capability to change the standard label “Power meter”, and change the range to set negative values (I’m monitoring charge/discharge power form a battery).
Now I realised there’s no way to show historical data graph and change the slider as per standard capability - I’ll get over it :wink:

You don’t need to create a new capability for these specific changes. You can change the capability’s presentation range and label using a custom device configuration.
Here are some samples:

Change the range:

{
    "component": "main",
    "capability": "thermostatHeatingSetpoint",
    "version": 1,
    "values": [
        {
            "key": "heatingSetpoint.value",
            "range": [
                15,
                75
            ],
            "step": 1
        }
    ],
    "patch": [],
    "visibleCondition": null
}

Change a standard capability’s label:

{
    "component": "main",
    "capability": "battery",
    "version": 1,
    "values": [
        {
            "key": "battery.value",
            "label": "New label"
        }
    ],
    "patch": []
}

Note: In the property key, you need to use the attributeName.value to make it work.

@nayelyz , you make my day! - Thanks for the awesome hint!!

I’m happy to help, @Roberto_Vietti. Please, let me know if you have more questions.