mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add device class attribute to tado humidity sensor state (#45084)
* add device class attribute to humidity sensor state * * explict return none * use const for device class value * removed unnecessary icon definitions
This commit is contained in:
parent
ec038bc6ea
commit
ff3a1f2050
@ -2,7 +2,12 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
|
from homeassistant.const import (
|
||||||
|
DEVICE_CLASS_HUMIDITY,
|
||||||
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
|
PERCENTAGE,
|
||||||
|
TEMP_CELSIUS,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
@ -126,12 +131,13 @@ class TadoZoneSensor(TadoZoneEntity, Entity):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self):
|
def device_class(self):
|
||||||
"""Icon for the sensor."""
|
"""Return the device class."""
|
||||||
if self.zone_variable == "temperature":
|
|
||||||
return "mdi:thermometer"
|
|
||||||
if self.zone_variable == "humidity":
|
if self.zone_variable == "humidity":
|
||||||
return "mdi:water-percent"
|
return DEVICE_CLASS_HUMIDITY
|
||||||
|
if self.zone_variable == "temperature":
|
||||||
|
return DEVICE_CLASS_TEMPERATURE
|
||||||
|
return None
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_update_callback(self):
|
def _async_update_callback(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user