Skip to content
Snippets Groups Projects
Commit 782eee91 authored by jkerdreu's avatar jkerdreu
Browse files

Switch to DeviceClass.XX



git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@3142 b32b6428-25c9-4566-ad07-03861ab6144f
parent d55e6f47
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity, STATE_CLASS_MEASUREMENT
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity, SensorStateClass
from homeassistant import const
from homeassistant import util
......@@ -36,7 +36,7 @@ async def async_setup_entry(hass: HomeAssistant,
class XAALSensorEntity(XAALEntity, SensorEntity):
_attr_state_class = STATE_CLASS_MEASUREMENT
_attr_state_class = SensorStateClass.MEASUREMENT
@property
def native_value(self) -> Any:
......@@ -77,13 +77,13 @@ class PowerMeter(XAALSensorEntity):
class CurrentMeter(XAALSensorEntity):
_attr_device_class = SensorDeviceClass.CURRENT
_attr_native_unit_of_measurement = const.ELECTRIC_CURRENT_AMPERE
_attr_native_unit_of_measurement = const.UnitOfElectricCurrent.AMPERE
_xaal_attribute = 'current'
class VoltMeter(XAALSensorEntity):
_attr_device_class = SensorDeviceClass.VOLTAGE
_attr_native_unit_of_measurement = const.ELECTRIC_POTENTIAL_VOLT
_attr_native_unit_of_measurement = const.UnitOfElectricPotential.VOLT
_xaal_attribute = 'voltage'
......
......@@ -3,7 +3,7 @@ import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.components.switch import SwitchEntity, DEVICE_CLASS_OUTLET
from homeassistant.components.switch import SwitchEntity, SwitchDeviceClass
from .bridge import XAALEntity, async_setup_factory
......@@ -19,7 +19,7 @@ async def async_setup_entry(hass: HomeAssistant,
class PowerRelay(XAALEntity, SwitchEntity):
_attr_device_class = DEVICE_CLASS_OUTLET
_attr_device_class = SwitchDeviceClass.OUTLET
@property
def is_on(self) -> bool | None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment