@camera.ui/sdk / manager / toUnitSystem
Function: toUnitSystem() ​
toUnitSystem(
value,unit,system):UnitValue
Defined in: manager/units.ts:71
Convert a reading to the unit the installation shows for its quantity, such as °C to °F for UnitSystem.Imperial. A reading already in that unit system, or in a unit without a counterpart, comes back unchanged.
Parameters ​
value ​
number
The reading.
unit ​
string
Unit of the reading, such as °C.
system ​
The installation's unit system, from coreManager.getUnitSystem().
Returns ​
The reading in the shown unit, rounded to two decimals.
Example ​
typescript
const system = await api.coreManager.getUnitSystem();
const shown = toUnitSystem(21.5, '°C', system); // { value: 70.7, unit: '°F' } for imperial