kappa_sdk.UnitConverter#
- class kappa_sdk.UnitConverter(unit_dto)[source]#
Units converter is a static helper that converts a given value from and to
internal units. Internal units are the ones that are used when data is returned by the KAPPA Automate or written back to. :param __units: list of dictionary of the different available units in KAPPA AutomateMethods
UnitConverter.convert_from_internal(unit, value)Converts a given value from internal units.
UnitConverter.convert_to_internal(unit, value)Converts a given value to internal units.
- Parameters:
unit_dto (UnitSystemsDto)
- convert_to_internal(unit, value)[source]#
Converts a given value to internal units.
Use this method (if needed) before writing data to the KAPPA Automate.
- Parameters:
unit (UnitEnum) – Unit to convert from.
value (float | None) – Value to convert.
- Returns:
float– Converted value.- Return type:
float | None
- convert_from_internal(unit, value)[source]#
Converts a given value from internal units.
Use this method (if needed) before using data after reading it from the KAPPA Automate.
- Parameters:
unit (UnitEnum) – Unit to convert to.
value (float | None) – Value to convert.
- Returns:
float– Converted value.- Return type:
float