Add device_class to Tibber sensor (#41572)

This commit is contained in:
Daniel Hjelseth Høyer 2020-10-10 14:20:15 +02:00 committed by GitHub
parent 3a6c9b43ab
commit 9299f0a8b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ from random import randrange
import aiohttp
from homeassistant.components.sensor import DEVICE_CLASS_POWER
from homeassistant.const import POWER_WATT
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.entity import Entity
@ -235,3 +236,8 @@ class TibberSensorRT(TibberSensor):
def unique_id(self):
"""Return a unique ID."""
return f"{self.device_id}_rt_consumption"
@property
def device_class(self):
"""Return the device class of the sensor."""
return DEVICE_CLASS_POWER