TemperatureUtils

Last Updated on : 2023-10-12 08:00:24download

This topic describes the utility methods related to temperature.

Convert from Fahrenheit to Celsius

API operation name

f2c

API description

Convert the temperature from Fahrenheit to Celsius.

Request parameter

Name Data type Description Required
fah number The temperature in degree Fahrenheit (°F). Yes

Return parameter

Name Data type Description
tem number Convert from Fahrenheit to Celsius

Sample request

import { Utils } from "tuya-panel-kit"; const { f2c } = Utils.TemperatureUtils; f2c(fah); // Example: f2c(100);

Sample response

38

Convert from Celsius to Fahrenheit

API operation name

c2f

API description

Convert the temperature from Celsius to Fahrenheit.

Request parameter

Name Data type Description Required
cel number The temperature in degree Celsius (°C). Yes

Return parameter

Name Data type Description
fri number Convert from Celsius to Fahrenheit

Sample request

import { Utils } from "tuya-panel-kit"; const { c2f } = Utils.TemperatureUtils; c2f(cel); // Example: c2f(100);

Sample response

212