Use enums in ondilo_ico (#62081)
This commit is contained in:
parent
859bcb6eb4
commit
b28c821bc3
1 changed files with 12 additions and 14 deletions
|
@ -7,15 +7,13 @@ import logging
|
||||||
from ondilo import OndiloError
|
from ondilo import OndiloError
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
STATE_CLASS_MEASUREMENT,
|
SensorDeviceClass,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEVICE_CLASS_BATTERY,
|
|
||||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
ELECTRIC_POTENTIAL_MILLIVOLT,
|
ELECTRIC_POTENTIAL_MILLIVOLT,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
|
@ -35,8 +33,8 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
icon=None,
|
icon=None,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="orp",
|
key="orp",
|
||||||
|
@ -44,7 +42,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_MILLIVOLT,
|
native_unit_of_measurement=ELECTRIC_POTENTIAL_MILLIVOLT,
|
||||||
icon="mdi:pool",
|
icon="mdi:pool",
|
||||||
device_class=None,
|
device_class=None,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="ph",
|
key="ph",
|
||||||
|
@ -52,7 +50,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
native_unit_of_measurement=None,
|
native_unit_of_measurement=None,
|
||||||
icon="mdi:pool",
|
icon="mdi:pool",
|
||||||
device_class=None,
|
device_class=None,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="tds",
|
key="tds",
|
||||||
|
@ -60,23 +58,23 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
||||||
icon="mdi:pool",
|
icon="mdi:pool",
|
||||||
device_class=None,
|
device_class=None,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="battery",
|
key="battery",
|
||||||
name="Battery",
|
name="Battery",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
icon=None,
|
icon=None,
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="rssi",
|
key="rssi",
|
||||||
name="RSSI",
|
name="RSSI",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
icon=None,
|
icon=None,
|
||||||
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="salt",
|
key="salt",
|
||||||
|
@ -84,7 +82,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
native_unit_of_measurement="mg/L",
|
native_unit_of_measurement="mg/L",
|
||||||
icon="mdi:pool",
|
icon="mdi:pool",
|
||||||
device_class=None,
|
device_class=None,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue