mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use _attr for Suez water (#57278)
This commit is contained in:
parent
8275110c44
commit
3a2d6a6343
@ -11,12 +11,13 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, VOLUME_LITERS
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
CONF_COUNTER_ID = "counter_id"
|
|
||||||
|
|
||||||
SCAN_INTERVAL = timedelta(hours=12)
|
SCAN_INTERVAL = timedelta(hours=12)
|
||||||
|
|
||||||
COMPONENT_ICON = "mdi:water-pump"
|
CONF_COUNTER_ID = "counter_id"
|
||||||
COMPONENT_NAME = "Suez Water Client"
|
|
||||||
|
NAME = "Suez Water Client"
|
||||||
|
ICON = "mdi:water-pump"
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
@ -49,6 +50,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
class SuezSensor(SensorEntity):
|
class SuezSensor(SensorEntity):
|
||||||
"""Representation of a Sensor."""
|
"""Representation of a Sensor."""
|
||||||
|
|
||||||
|
_attr_name = NAME
|
||||||
|
_attr_icon = ICON
|
||||||
|
_attr_native_unit_of_measurement = VOLUME_LITERS
|
||||||
|
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
"""Initialize the data object."""
|
"""Initialize the data object."""
|
||||||
self._attributes = {}
|
self._attributes = {}
|
||||||
@ -56,31 +61,16 @@ class SuezSensor(SensorEntity):
|
|||||||
self._available = None
|
self._available = None
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the sensor."""
|
|
||||||
return COMPONENT_NAME
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self):
|
def native_value(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
|
||||||
def native_unit_of_measurement(self):
|
|
||||||
"""Return the unit of measurement."""
|
|
||||||
return VOLUME_LITERS
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
"""Return the icon of the sensor."""
|
|
||||||
return COMPONENT_ICON
|
|
||||||
|
|
||||||
def _fetch_data(self):
|
def _fetch_data(self):
|
||||||
"""Fetch latest data from Suez."""
|
"""Fetch latest data from Suez."""
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user