mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use new enums in neurio_energy (#61953)
This commit is contained in:
parent
39590f9917
commit
c4c9dc8cee
@ -10,17 +10,11 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
STATE_CLASS_MEASUREMENT,
|
SensorDeviceClass,
|
||||||
STATE_CLASS_TOTAL_INCREASING,
|
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import CONF_API_KEY, ENERGY_KILO_WATT_HOUR, POWER_WATT
|
||||||
CONF_API_KEY,
|
|
||||||
DEVICE_CLASS_ENERGY,
|
|
||||||
DEVICE_CLASS_POWER,
|
|
||||||
ENERGY_KILO_WATT_HOUR,
|
|
||||||
POWER_WATT,
|
|
||||||
)
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
@ -148,12 +142,12 @@ class NeurioEnergy(SensorEntity):
|
|||||||
|
|
||||||
if sensor_type == ACTIVE_TYPE:
|
if sensor_type == ACTIVE_TYPE:
|
||||||
self._unit_of_measurement = POWER_WATT
|
self._unit_of_measurement = POWER_WATT
|
||||||
self._attr_device_class = DEVICE_CLASS_POWER
|
self._attr_device_class = SensorDeviceClass.POWER
|
||||||
self._attr_state_class = STATE_CLASS_MEASUREMENT
|
self._attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
elif sensor_type == DAILY_TYPE:
|
elif sensor_type == DAILY_TYPE:
|
||||||
self._unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
self._unit_of_measurement = ENERGY_KILO_WATT_HOUR
|
||||||
self._attr_device_class = DEVICE_CLASS_ENERGY
|
self._attr_device_class = SensorDeviceClass.ENERGY
|
||||||
self._attr_state_class = STATE_CLASS_TOTAL_INCREASING
|
self._attr_state_class = SensorStateClass.TOTAL_INCREASING
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user