From 0e625d1b9dc6512d037cb7d4b6dcfd34e374499d Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sat, 13 Nov 2021 15:52:29 -0500 Subject: [PATCH 1/4] Add unit sets for meters --- zwave_js_server/const/command_class/meter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/zwave_js_server/const/command_class/meter.py b/zwave_js_server/const/command_class/meter.py index 09341ef7e..a86d3bbda 100644 --- a/zwave_js_server/const/command_class/meter.py +++ b/zwave_js_server/const/command_class/meter.py @@ -102,3 +102,21 @@ class HeatingScale(IntEnum): WaterScale.US_GALLON, WaterScale.PULSE_COUNT, } + +KILOWATT_HOUR = { + ElectricScale.KILOWATT_HOUR, + HeatingScale.KILOWATT_HOUR, + CoolingScale.KILOWATT_HOUR, +} +KILOVOLT_AMPERE_HOUR = {ElectricScale.KILOVOLT_AMPERE_HOUR} +WATT = {ElectricScale.WATT} +PULSE_COUNT = {ElectricScale.PULSE_COUNT} +VOLT = {ElectricScale.VOLT} +AMPERE = {ElectricScale.AMPERE} +POWER_FACTOR = {ElectricScale.POWER_FACTOR} +KILOVOLT_AMPERE_REACTIVE = {ElectricScale.KILOVOLT_AMPERE_REACTIVE} +KILOVOLT_AMPERE_REACTIVE_HOUR = {ElectricScale.KILOVOLT_AMPERE_REACTIVE_HOUR} +CUBIC_METER = {GasScale.CUBIC_METER, WaterScale.CUBIC_METER} +CUBIC_FEET = {GasScale.CUBIC_FEET, WaterScale.CUBIC_FEET} +US_GALLON = {WaterScale.US_GALLON} +PULSE_COUNT = {GasScale.PULSE_COUNT, WaterScale.PULSE_COUNT} From aca27e99e30d30ab7bfd9e322984ca670a48b002 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sat, 13 Nov 2021 15:56:00 -0500 Subject: [PATCH 2/4] Prepend UNIT_ on constants to be more consistent --- zwave_js_server/const/command_class/meter.py | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/zwave_js_server/const/command_class/meter.py b/zwave_js_server/const/command_class/meter.py index a86d3bbda..f8e71e200 100644 --- a/zwave_js_server/const/command_class/meter.py +++ b/zwave_js_server/const/command_class/meter.py @@ -108,15 +108,15 @@ class HeatingScale(IntEnum): HeatingScale.KILOWATT_HOUR, CoolingScale.KILOWATT_HOUR, } -KILOVOLT_AMPERE_HOUR = {ElectricScale.KILOVOLT_AMPERE_HOUR} -WATT = {ElectricScale.WATT} -PULSE_COUNT = {ElectricScale.PULSE_COUNT} -VOLT = {ElectricScale.VOLT} -AMPERE = {ElectricScale.AMPERE} -POWER_FACTOR = {ElectricScale.POWER_FACTOR} -KILOVOLT_AMPERE_REACTIVE = {ElectricScale.KILOVOLT_AMPERE_REACTIVE} -KILOVOLT_AMPERE_REACTIVE_HOUR = {ElectricScale.KILOVOLT_AMPERE_REACTIVE_HOUR} -CUBIC_METER = {GasScale.CUBIC_METER, WaterScale.CUBIC_METER} -CUBIC_FEET = {GasScale.CUBIC_FEET, WaterScale.CUBIC_FEET} -US_GALLON = {WaterScale.US_GALLON} -PULSE_COUNT = {GasScale.PULSE_COUNT, WaterScale.PULSE_COUNT} +UNIT_KILOVOLT_AMPERE_HOUR = {ElectricScale.KILOVOLT_AMPERE_HOUR} +UNIT_WATT = {ElectricScale.WATT} +UNIT_PULSE_COUNT = {ElectricScale.PULSE_COUNT} +UNIT_VOLT = {ElectricScale.VOLT} +UNIT_AMPERE = {ElectricScale.AMPERE} +UNIT_POWER_FACTOR = {ElectricScale.POWER_FACTOR} +UNIT_KILOVOLT_AMPERE_REACTIVE = {ElectricScale.KILOVOLT_AMPERE_REACTIVE} +UNIT_KILOVOLT_AMPERE_REACTIVE_HOUR = {ElectricScale.KILOVOLT_AMPERE_REACTIVE_HOUR} +UNIT_CUBIC_METER = {GasScale.CUBIC_METER, WaterScale.CUBIC_METER} +UNIT_CUBIC_FEET = {GasScale.CUBIC_FEET, WaterScale.CUBIC_FEET} +UNIT_US_GALLON = {WaterScale.US_GALLON} +UNIT_PULSE_COUNT = {GasScale.PULSE_COUNT, WaterScale.PULSE_COUNT} From e876d46da194ae52d2694f098fd08a05d48eac5a Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:00:05 -0500 Subject: [PATCH 3/4] Add types --- .../generate_multilevel_sensor_constants.py | 4 +- zwave_js_server/const/command_class/meter.py | 33 +-- .../const/command_class/multilevel_sensor.py | 193 +++++++++++------- 3 files changed, 139 insertions(+), 91 deletions(-) diff --git a/scripts/generate_multilevel_sensor_constants.py b/scripts/generate_multilevel_sensor_constants.py index b6fe6b0c1..50f459be5 100644 --- a/scripts/generate_multilevel_sensor_constants.py +++ b/scripts/generate_multilevel_sensor_constants.py @@ -146,7 +146,7 @@ def generate_int_enum_class_definition( "# ----------------------------------------------------------------------------------- #", "", "from enum import IntEnum", - "from typing import Dict, Type, Union", + "from typing import Dict, Set, Type, Union", 'CC_SPECIFIC_SCALE = "scale"', 'CC_SPECIFIC_SENSOR_TYPE = "sensorType"', ] @@ -199,7 +199,7 @@ def generate_int_enum_class_definition( lines.append("") for unit_name, unit_enums in unit_name_to_enum_map.items(): - lines.append(f"UNIT_{unit_name} = {{{','.join(sorted(unit_enums))}}}") + lines.append(f"UNIT_{unit_name}: Set[MultilevelSensorScaleType] = {{{','.join(sorted(unit_enums))}}}") lines.extend( [ diff --git a/zwave_js_server/const/command_class/meter.py b/zwave_js_server/const/command_class/meter.py index f8e71e200..ed8e791f9 100644 --- a/zwave_js_server/const/command_class/meter.py +++ b/zwave_js_server/const/command_class/meter.py @@ -103,20 +103,27 @@ class HeatingScale(IntEnum): WaterScale.PULSE_COUNT, } -KILOWATT_HOUR = { +UNIT_KILOWATT_HOUR: Set[MeterScaleType] = { ElectricScale.KILOWATT_HOUR, HeatingScale.KILOWATT_HOUR, CoolingScale.KILOWATT_HOUR, } -UNIT_KILOVOLT_AMPERE_HOUR = {ElectricScale.KILOVOLT_AMPERE_HOUR} -UNIT_WATT = {ElectricScale.WATT} -UNIT_PULSE_COUNT = {ElectricScale.PULSE_COUNT} -UNIT_VOLT = {ElectricScale.VOLT} -UNIT_AMPERE = {ElectricScale.AMPERE} -UNIT_POWER_FACTOR = {ElectricScale.POWER_FACTOR} -UNIT_KILOVOLT_AMPERE_REACTIVE = {ElectricScale.KILOVOLT_AMPERE_REACTIVE} -UNIT_KILOVOLT_AMPERE_REACTIVE_HOUR = {ElectricScale.KILOVOLT_AMPERE_REACTIVE_HOUR} -UNIT_CUBIC_METER = {GasScale.CUBIC_METER, WaterScale.CUBIC_METER} -UNIT_CUBIC_FEET = {GasScale.CUBIC_FEET, WaterScale.CUBIC_FEET} -UNIT_US_GALLON = {WaterScale.US_GALLON} -UNIT_PULSE_COUNT = {GasScale.PULSE_COUNT, WaterScale.PULSE_COUNT} +UNIT_KILOVOLT_AMPERE_HOUR: Set[MeterScaleType] = {ElectricScale.KILOVOLT_AMPERE_HOUR} +UNIT_WATT: Set[MeterScaleType] = {ElectricScale.WATT} +UNIT_PULSE_COUNT: Set[MeterScaleType] = { + ElectricScale.PULSE_COUNT, + GasScale.PULSE_COUNT, + WaterScale.PULSE_COUNT, +} +UNIT_VOLT: Set[MeterScaleType] = {ElectricScale.VOLT} +UNIT_AMPERE: Set[MeterScaleType] = {ElectricScale.AMPERE} +UNIT_POWER_FACTOR: Set[MeterScaleType] = {ElectricScale.POWER_FACTOR} +UNIT_KILOVOLT_AMPERE_REACTIVE: Set[MeterScaleType] = { + ElectricScale.KILOVOLT_AMPERE_REACTIVE +} +UNIT_KILOVOLT_AMPERE_REACTIVE_HOUR: Set[MeterScaleType] = { + ElectricScale.KILOVOLT_AMPERE_REACTIVE_HOUR +} +UNIT_CUBIC_METER: Set[MeterScaleType] = {GasScale.CUBIC_METER, WaterScale.CUBIC_METER} +UNIT_CUBIC_FEET: Set[MeterScaleType] = {GasScale.CUBIC_FEET, WaterScale.CUBIC_FEET} +UNIT_US_GALLON: Set[MeterScaleType] = {WaterScale.US_GALLON} diff --git a/zwave_js_server/const/command_class/multilevel_sensor.py b/zwave_js_server/const/command_class/multilevel_sensor.py index a9e3ab7c2..19f764317 100644 --- a/zwave_js_server/const/command_class/multilevel_sensor.py +++ b/zwave_js_server/const/command_class/multilevel_sensor.py @@ -6,7 +6,7 @@ # ----------------------------------------------------------------------------------- # from enum import IntEnum -from typing import Dict, Type, Union +from typing import Dict, Set, Type, Union CC_SPECIFIC_SCALE = "scale" CC_SPECIFIC_SENSOR_TYPE = "sensorType" @@ -681,68 +681,97 @@ class WeightScale(IntEnum): MultilevelSensorType.WEIGHT: WeightScale, } -UNIT_ABSOLUTE_HUMIDITY = {HumidityScale.ABSOLUTE_HUMIDITY} -UNIT_ACIDITY = {AcidityScale.ACIDITY} -UNIT_AMPERE = {CurrentScale.AMPERE} -UNIT_A_WEIGHTED_DECIBELS = {LoudnessScale.A_WEIGHTED_DECIBELS} -UNIT_BEATS_PER_MINUTE = {HeartRateScale.BEATS_PER_MINUTE} -UNIT_BECQUEREL_PER_CUBIC_METER = {RadonConcentrationScale.BECQUEREL_PER_CUBIC_METER} -UNIT_BODY_MASS_INDEX = {BodyMassIndexScale.BODY_MASS_INDEX} -UNIT_BODY_WAVE = {SeismicMagnitudeScale.BODY_WAVE} -UNIT_BREATHS_PER_MINUTE = {RespiratoryRateScale.BREATHS_PER_MINUTE} -UNIT_BTU_H = {PowerScale.BTU_H} -UNIT_CELSIUS = {TemperatureScale.CELSIUS} -UNIT_CENTIMETER = {DistanceScale.CENTIMETER} -UNIT_CUBIC_FEET_PER_MINUTE = {AirFlowScale.CUBIC_FEET_PER_MINUTE} -UNIT_CUBIC_METER = {TankCapacityScale.CUBIC_METER} -UNIT_CUBIC_METER_PER_HOUR = {AirFlowScale.CUBIC_METER_PER_HOUR} -UNIT_DECIBEL = {LoudnessScale.DECIBEL} -UNIT_DEGREES = {DirectionScale.DEGREES} -UNIT_DEGREES_RELATIVE_TO_NORTH_POLE_OF_STANDING_EYE_VIEW = { - AnglePositionScale.DEGREES_RELATIVE_TO_NORTH_POLE_OF_STANDING_EYE_VIEW +UNIT_ABSOLUTE_HUMIDITY: Set[MultilevelSensorScaleType] = { + HumidityScale.ABSOLUTE_HUMIDITY } -UNIT_DEGREES_RELATIVE_TO_SOUTH_POLE_OF_STANDING_EYE_VIEW = { - AnglePositionScale.DEGREES_RELATIVE_TO_SOUTH_POLE_OF_STANDING_EYE_VIEW +UNIT_ACIDITY: Set[MultilevelSensorScaleType] = {AcidityScale.ACIDITY} +UNIT_AMPERE: Set[MultilevelSensorScaleType] = {CurrentScale.AMPERE} +UNIT_A_WEIGHTED_DECIBELS: Set[MultilevelSensorScaleType] = { + LoudnessScale.A_WEIGHTED_DECIBELS } -UNIT_DENSITY = {DensityScale.DENSITY} -UNIT_DIASTOLIC = {BloodPressureScale.DIASTOLIC} -UNIT_DIMENSIONLESS_VALUE = {GeneralPurposeScale.DIMENSIONLESS_VALUE} -UNIT_EUROPEAN_MACROSEISMIC = {SeismicIntensityScale.EUROPEAN_MACROSEISMIC} -UNIT_FAHRENHEIT = {TemperatureScale.FAHRENHEIT} -UNIT_FEET = {DistanceScale.FEET, TideLevelScale.FEET} -UNIT_GALLONS = {TankCapacityScale.GALLONS} -UNIT_HERTZ = {FrequencyScale.HERTZ, RotationScale.HERTZ} -UNIT_IMPEDANCE = {MoistureScale.IMPEDANCE} -UNIT_INCHES_OF_MERCURY = {AirPressureScale.INCHES_OF_MERCURY} -UNIT_INCHES_PER_HOUR = {RainRateScale.INCHES_PER_HOUR} -UNIT_JOULE = {BasisMetabolicRateScale.JOULE} -UNIT_KILOGRAM = {MassScale.KILOGRAM, WeightScale.KILOGRAM} -UNIT_KILOHERTZ = {FrequencyScale.KILOHERTZ} -UNIT_KILOPASCAL = { +UNIT_BEATS_PER_MINUTE: Set[MultilevelSensorScaleType] = { + HeartRateScale.BEATS_PER_MINUTE +} +UNIT_BECQUEREL_PER_CUBIC_METER: Set[MultilevelSensorScaleType] = { + RadonConcentrationScale.BECQUEREL_PER_CUBIC_METER +} +UNIT_BODY_MASS_INDEX: Set[MultilevelSensorScaleType] = { + BodyMassIndexScale.BODY_MASS_INDEX +} +UNIT_BODY_WAVE: Set[MultilevelSensorScaleType] = {SeismicMagnitudeScale.BODY_WAVE} +UNIT_BREATHS_PER_MINUTE: Set[MultilevelSensorScaleType] = { + RespiratoryRateScale.BREATHS_PER_MINUTE +} +UNIT_BTU_H: Set[MultilevelSensorScaleType] = {PowerScale.BTU_H} +UNIT_CELSIUS: Set[MultilevelSensorScaleType] = {TemperatureScale.CELSIUS} +UNIT_CENTIMETER: Set[MultilevelSensorScaleType] = {DistanceScale.CENTIMETER} +UNIT_CUBIC_FEET_PER_MINUTE: Set[MultilevelSensorScaleType] = { + AirFlowScale.CUBIC_FEET_PER_MINUTE +} +UNIT_CUBIC_METER: Set[MultilevelSensorScaleType] = {TankCapacityScale.CUBIC_METER} +UNIT_CUBIC_METER_PER_HOUR: Set[MultilevelSensorScaleType] = { + AirFlowScale.CUBIC_METER_PER_HOUR +} +UNIT_DECIBEL: Set[MultilevelSensorScaleType] = {LoudnessScale.DECIBEL} +UNIT_DEGREES: Set[MultilevelSensorScaleType] = {DirectionScale.DEGREES} +UNIT_DEGREES_RELATIVE_TO_NORTH_POLE_OF_STANDING_EYE_VIEW: Set[ + MultilevelSensorScaleType +] = {AnglePositionScale.DEGREES_RELATIVE_TO_NORTH_POLE_OF_STANDING_EYE_VIEW} +UNIT_DEGREES_RELATIVE_TO_SOUTH_POLE_OF_STANDING_EYE_VIEW: Set[ + MultilevelSensorScaleType +] = {AnglePositionScale.DEGREES_RELATIVE_TO_SOUTH_POLE_OF_STANDING_EYE_VIEW} +UNIT_DENSITY: Set[MultilevelSensorScaleType] = {DensityScale.DENSITY} +UNIT_DIASTOLIC: Set[MultilevelSensorScaleType] = {BloodPressureScale.DIASTOLIC} +UNIT_DIMENSIONLESS_VALUE: Set[MultilevelSensorScaleType] = { + GeneralPurposeScale.DIMENSIONLESS_VALUE +} +UNIT_EUROPEAN_MACROSEISMIC: Set[MultilevelSensorScaleType] = { + SeismicIntensityScale.EUROPEAN_MACROSEISMIC +} +UNIT_FAHRENHEIT: Set[MultilevelSensorScaleType] = {TemperatureScale.FAHRENHEIT} +UNIT_FEET: Set[MultilevelSensorScaleType] = {DistanceScale.FEET, TideLevelScale.FEET} +UNIT_GALLONS: Set[MultilevelSensorScaleType] = {TankCapacityScale.GALLONS} +UNIT_HERTZ: Set[MultilevelSensorScaleType] = {FrequencyScale.HERTZ, RotationScale.HERTZ} +UNIT_IMPEDANCE: Set[MultilevelSensorScaleType] = {MoistureScale.IMPEDANCE} +UNIT_INCHES_OF_MERCURY: Set[MultilevelSensorScaleType] = { + AirPressureScale.INCHES_OF_MERCURY +} +UNIT_INCHES_PER_HOUR: Set[MultilevelSensorScaleType] = {RainRateScale.INCHES_PER_HOUR} +UNIT_JOULE: Set[MultilevelSensorScaleType] = {BasisMetabolicRateScale.JOULE} +UNIT_KILOGRAM: Set[MultilevelSensorScaleType] = { + MassScale.KILOGRAM, + WeightScale.KILOGRAM, +} +UNIT_KILOHERTZ: Set[MultilevelSensorScaleType] = {FrequencyScale.KILOHERTZ} +UNIT_KILOPASCAL: Set[MultilevelSensorScaleType] = { AirPressureScale.KILOPASCAL, PressureScale.KILOPASCAL, WaterPressureScale.KILOPASCAL, } -UNIT_LIEDU = {SeismicIntensityScale.LIEDU} -UNIT_LITER = {TankCapacityScale.LITER} -UNIT_LITER_PER_HOUR = {WaterFlowScale.LITER_PER_HOUR} -UNIT_LOCAL = {SeismicMagnitudeScale.LOCAL} -UNIT_LUX = {IlluminanceScale.LUX} -UNIT_MERCALLI = {SeismicIntensityScale.MERCALLI} -UNIT_METER = {DistanceScale.METER, TideLevelScale.METER} -UNIT_METER_PER_SQUARE_SECOND = {AccelerationScale.METER_PER_SQUARE_SECOND} -UNIT_MICROGRAM_PER_CUBIC_METER = { +UNIT_LIEDU: Set[MultilevelSensorScaleType] = {SeismicIntensityScale.LIEDU} +UNIT_LITER: Set[MultilevelSensorScaleType] = {TankCapacityScale.LITER} +UNIT_LITER_PER_HOUR: Set[MultilevelSensorScaleType] = {WaterFlowScale.LITER_PER_HOUR} +UNIT_LOCAL: Set[MultilevelSensorScaleType] = {SeismicMagnitudeScale.LOCAL} +UNIT_LUX: Set[MultilevelSensorScaleType] = {IlluminanceScale.LUX} +UNIT_MERCALLI: Set[MultilevelSensorScaleType] = {SeismicIntensityScale.MERCALLI} +UNIT_METER: Set[MultilevelSensorScaleType] = {DistanceScale.METER, TideLevelScale.METER} +UNIT_METER_PER_SQUARE_SECOND: Set[MultilevelSensorScaleType] = { + AccelerationScale.METER_PER_SQUARE_SECOND +} +UNIT_MICROGRAM_PER_CUBIC_METER: Set[MultilevelSensorScaleType] = { ParticulateMatter10Scale.MICROGRAM_PER_CUBIC_METER, ParticulateMatter25Scale.MICROGRAM_PER_CUBIC_METER, } -UNIT_MILLIAMPERE = {CurrentScale.MILLIAMPERE} -UNIT_MILLIGRAM_PER_LITER = {WaterChlorineLevelScale.MILLIGRAM_PER_LITER} -UNIT_MILLIMETER_HOUR = {RainRateScale.MILLIMETER_HOUR} -UNIT_MILLIVOLT = { +UNIT_MILLIAMPERE: Set[MultilevelSensorScaleType] = {CurrentScale.MILLIAMPERE} +UNIT_MILLIGRAM_PER_LITER: Set[MultilevelSensorScaleType] = { + WaterChlorineLevelScale.MILLIGRAM_PER_LITER +} +UNIT_MILLIMETER_HOUR: Set[MultilevelSensorScaleType] = {RainRateScale.MILLIMETER_HOUR} +UNIT_MILLIVOLT: Set[MultilevelSensorScaleType] = { VoltageScale.MILLIVOLT, WaterOxidationReductionPotentialScale.MILLIVOLT, } -UNIT_MOLE_PER_CUBIC_METER = { +UNIT_MOLE_PER_CUBIC_METER: Set[MultilevelSensorScaleType] = { CarbonMonoxideLevelScale.MOLE_PER_CUBIC_METER, FormaldehydeLevelScale.MOLE_PER_CUBIC_METER, MethaneDensityScale.MOLE_PER_CUBIC_METER, @@ -751,17 +780,17 @@ class WeightScale(IntEnum): SoilSalinityScale.MOLE_PER_CUBIC_METER, VolatileOrganicCompoundLevelScale.MOLE_PER_CUBIC_METER, } -UNIT_MOMENT = {SeismicMagnitudeScale.MOMENT} -UNIT_MPH = {VelocityScale.MPH} -UNIT_M_S = {VelocityScale.M_S} -UNIT_NEWTON = {AppliedForceOnTheSensorScale.NEWTON} -UNIT_OHM_METER = {ElectricalResistivityScale.OHM_METER} -UNIT_PARTS_MILLION = { +UNIT_MOMENT: Set[MultilevelSensorScaleType] = {SeismicMagnitudeScale.MOMENT} +UNIT_MPH: Set[MultilevelSensorScaleType] = {VelocityScale.MPH} +UNIT_M_S: Set[MultilevelSensorScaleType] = {VelocityScale.M_S} +UNIT_NEWTON: Set[MultilevelSensorScaleType] = {AppliedForceOnTheSensorScale.NEWTON} +UNIT_OHM_METER: Set[MultilevelSensorScaleType] = {ElectricalResistivityScale.OHM_METER} +UNIT_PARTS_MILLION: Set[MultilevelSensorScaleType] = { CarbonDioxideLevelScale.PARTS_MILLION, CarbonMonoxideLevelScale.PARTS_MILLION, VolatileOrganicCompoundLevelScale.PARTS_MILLION, } -UNIT_PERCENTAGE_VALUE = { +UNIT_PERCENTAGE_VALUE: Set[MultilevelSensorScaleType] = { AnglePositionScale.PERCENTAGE_VALUE, GeneralPurposeScale.PERCENTAGE_VALUE, HumidityScale.PERCENTAGE_VALUE, @@ -769,24 +798,36 @@ class WeightScale(IntEnum): MoistureScale.PERCENTAGE_VALUE, PercentageScale.PERCENTAGE_VALUE, } -UNIT_PICOCURIES_PER_LITER = {RadonConcentrationScale.PICOCURIES_PER_LITER} -UNIT_POUNDS = {WeightScale.POUNDS} -UNIT_POUND_PER_SQUARE_INCH = {PressureScale.POUND_PER_SQUARE_INCH} -UNIT_POWER_LEVEL = {RfSignalStrengthScale.POWER_LEVEL} -UNIT_REVOLUTIONS_PER_MINUTE = {RotationScale.REVOLUTIONS_PER_MINUTE} -UNIT_RSSI = {RfSignalStrengthScale.RSSI} -UNIT_SECOND = {TimeScale.SECOND} -UNIT_SHINDO = {SeismicIntensityScale.SHINDO} -UNIT_SIEMENS_PER_METER = {ElectricalConductivityScale.SIEMENS_PER_METER} -UNIT_SURFACE_WAVE = {SeismicMagnitudeScale.SURFACE_WAVE} -UNIT_SYSTOLIC = {BloodPressureScale.SYSTOLIC} -UNIT_UNITLESS = {UnitlessScale.UNITLESS} -UNIT_UV_INDEX = {UltravioletScale.UV_INDEX} -UNIT_VOLT = {VoltageScale.VOLT} -UNIT_VOLUME_WATER_CONTENT = {MoistureScale.VOLUME_WATER_CONTENT} -UNIT_WATER_ACTIVITY = {MoistureScale.WATER_ACTIVITY} -UNIT_WATT = {PowerScale.WATT} -UNIT_WATT_PER_SQUARE_METER = {SolarRadiationScale.WATT_PER_SQUARE_METER} +UNIT_PICOCURIES_PER_LITER: Set[MultilevelSensorScaleType] = { + RadonConcentrationScale.PICOCURIES_PER_LITER +} +UNIT_POUNDS: Set[MultilevelSensorScaleType] = {WeightScale.POUNDS} +UNIT_POUND_PER_SQUARE_INCH: Set[MultilevelSensorScaleType] = { + PressureScale.POUND_PER_SQUARE_INCH +} +UNIT_POWER_LEVEL: Set[MultilevelSensorScaleType] = {RfSignalStrengthScale.POWER_LEVEL} +UNIT_REVOLUTIONS_PER_MINUTE: Set[MultilevelSensorScaleType] = { + RotationScale.REVOLUTIONS_PER_MINUTE +} +UNIT_RSSI: Set[MultilevelSensorScaleType] = {RfSignalStrengthScale.RSSI} +UNIT_SECOND: Set[MultilevelSensorScaleType] = {TimeScale.SECOND} +UNIT_SHINDO: Set[MultilevelSensorScaleType] = {SeismicIntensityScale.SHINDO} +UNIT_SIEMENS_PER_METER: Set[MultilevelSensorScaleType] = { + ElectricalConductivityScale.SIEMENS_PER_METER +} +UNIT_SURFACE_WAVE: Set[MultilevelSensorScaleType] = {SeismicMagnitudeScale.SURFACE_WAVE} +UNIT_SYSTOLIC: Set[MultilevelSensorScaleType] = {BloodPressureScale.SYSTOLIC} +UNIT_UNITLESS: Set[MultilevelSensorScaleType] = {UnitlessScale.UNITLESS} +UNIT_UV_INDEX: Set[MultilevelSensorScaleType] = {UltravioletScale.UV_INDEX} +UNIT_VOLT: Set[MultilevelSensorScaleType] = {VoltageScale.VOLT} +UNIT_VOLUME_WATER_CONTENT: Set[MultilevelSensorScaleType] = { + MoistureScale.VOLUME_WATER_CONTENT +} +UNIT_WATER_ACTIVITY: Set[MultilevelSensorScaleType] = {MoistureScale.WATER_ACTIVITY} +UNIT_WATT: Set[MultilevelSensorScaleType] = {PowerScale.WATT} +UNIT_WATT_PER_SQUARE_METER: Set[MultilevelSensorScaleType] = { + SolarRadiationScale.WATT_PER_SQUARE_METER +} # ----------------------------------------------------------------------------------- # # **END OF AUTOGENERATED CONTENT** (DO NOT EDIT/REMOVE THIS COMMENT BLOCK AND DO NOT # From 2c30dafe84a41f12aeb0e6488102c759bbf5f0c0 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sat, 13 Nov 2021 16:02:10 -0500 Subject: [PATCH 4/4] black --- scripts/generate_multilevel_sensor_constants.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/generate_multilevel_sensor_constants.py b/scripts/generate_multilevel_sensor_constants.py index 50f459be5..ec6ae12a1 100644 --- a/scripts/generate_multilevel_sensor_constants.py +++ b/scripts/generate_multilevel_sensor_constants.py @@ -199,7 +199,9 @@ def generate_int_enum_class_definition( lines.append("") for unit_name, unit_enums in unit_name_to_enum_map.items(): - lines.append(f"UNIT_{unit_name}: Set[MultilevelSensorScaleType] = {{{','.join(sorted(unit_enums))}}}") + lines.append( + f"UNIT_{unit_name}: Set[MultilevelSensorScaleType] = {{{','.join(sorted(unit_enums))}}}" + ) lines.extend( [