Convert Temperature Scale: Switch to Celsius or Fahrenheit

Last Updated on : 2023-10-12 07:59:53

A device reports the temperature either in Celsius (℃) or Fahrenheit (℉). You can configure temperature scale conversion on the UI Studio to enable the automatic conversion between ℃ and ℉ for an associated panel. For example, the temperature in ℃ is reported, but users want to show it in ℉ on the panel. In this case, with temperature scale conversion enabled, users can switch between the temperature units on the panel to check the temperature in the desired unit.

Overview

When a device reports the temperature in ℃ (or ℉), users can switch to ℉ (or ℃) on the panel. Then, the panel shows the temperature in ℉ (or ℃). You can choose More > Shift temperature scale in the top-right corner of the UI Studio to implement this feature.

Prerequisites

Before you go to the UI Studio, you must select specific data points (DPs) in the Function Definition step on the Tuya IoT Development Platform. These DPs enable switching between the temperature units.

The Unit convert DP is required. Either Temp set or Temp Set F is used. This way, the temperature scale conversion can be implemented.

Convert Temperature Scale: Switch to Celsius or Fahrenheit

Procedure

  1. Go to the UI Studio, and choose More > Shift temperature scale in the top-right corner of the page.

  2. In the dialog box that appears, set Precision and Approximate and click Save.

    • Precision: Set the precision of a target temperature value. The drop-down list includes Integer, 1 Decimal Place, 2 Decimal Places, and 3 Decimal Places.
    • Approximate: Set the logic to approximate a target temperature value. The drop-down list includes Round Up, Round Off, and Round Down.

    Convert Temperature Scale: Switch to Celsius or Fahrenheit

  3. Click Preview in the top-right corner of the UI Studio and use the Tuya Smart app to scan the QR code that appears. Then, you can test the temperature scale conversion effect in the app.

Operation result

Based on the settings for temperature scale conversion, users can switch between the temperature units in the app to show the temperature in the desired unit. Example:

Convert Temperature Scale: Switch to Celsius or Fahrenheit

Things to note

  • If the unit of the DP is invalid or not specified, the preceding settings cannot take effect. Each temperature unit is one sole character, rather than a sequence of a degree sign and a letter. The following units are supported:
    • Degree Celsius: ℃
    • Degree Fahrenheit: ℉
  • The conversion between ℃ and ℉ does not apply exact division, so a precision difference might exist in the result.