Skip to content

Commit

Permalink
Implemented suggested_display_precision
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsverkoyen committed Feb 28, 2023
1 parent e21d006 commit 1c4857a
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoElectricityClampCentralmeter, hub, gatew
self._attr_native_value = self._device.electrical_power
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoElectricityClampCentralmeter, hub, gatew
self._attr_native_value = self._device.electrical_power
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoElectricityClampCentralmeter, hub, gatew
self._attr_native_value = self._device.electrical_power
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericEnergyhome, hub, gateway):
self._attr_native_value = self._device.electrical_power_consumption
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 3

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericEnergyhome, hub, gateway):
self._attr_native_value = self._device.electrical_power_from_grid
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 3

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericEnergyhome, hub, gateway):
self._attr_native_value = self._device.electrical_power_production
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 3

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericEnergyhome, hub, gateway):
self._attr_native_value = self._device.electrical_power_self_consumption
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 3

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericEnergyhome, hub, gateway):
self._attr_native_value = self._device.electrical_power_to_grid
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 3

@property
def name(self) -> str:
Expand Down
1 change: 1 addition & 0 deletions custom_components/nhc2/entities/generic_fan_co2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericFan, hub, gateway):
self._attr_native_value = self._device.co2
self._attr_native_unit_of_measurement = CONCENTRATION_PARTS_PER_MILLION
self._attr_state_class = None
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
1 change: 1 addition & 0 deletions custom_components/nhc2/entities/generic_fan_humidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericFan, hub, gateway):
self._attr_native_value = self._device.humidity
self._attr_native_unit_of_measurement = PERCENTAGE
self._attr_state_class = None
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoGenericSmartplug, hub, gateway):
self._attr_native_value = self._device.electrical_power
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoHvacthermostatHvac, hub, gateway):
self._attr_native_value = self._device.overrule_setpoint
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_state_class = None
self._attr_suggested_display_precision = 1

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoHvacthermostatHvac, hub, gateway):
self._attr_native_value = self._device.setpoint_temperature
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_state_class = None
self._attr_suggested_display_precision = 1

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoNasoSmartplug, hub, gateway):
self._attr_native_value = self._device.electrical_power
self._attr_native_unit_of_measurement = UnitOfPower.WATT
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_suggested_display_precision = 0

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoThermostatHvac, hub, gateway):
self._attr_native_value = self._device.overrule_setpoint
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_state_class = None
self._attr_suggested_display_precision = 1

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoThermostatHvac, hub, gateway):
self._attr_native_value = self._device.setpoint_temperature
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_state_class = None
self._attr_suggested_display_precision = 1

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoThermostatThermostat, hub, gateway):
self._attr_native_value = self._device.overrule_setpoint
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_state_class = None
self._attr_suggested_display_precision = 1

@property
def name(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device_instance: CocoThermostatThermostat, hub, gateway):
self._attr_native_value = self._device.setpoint_temperature
self._attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS
self._attr_state_class = None
self._attr_suggested_display_precision = 1

@property
def name(self) -> str:
Expand Down

0 comments on commit 1c4857a

Please sign in to comment.