mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Add unique_id for tellduslive (#18744)
This commit is contained in:
parent
392898e694
commit
eb2e2a116e
@ -127,3 +127,8 @@ class TelldusLiveSensor(TelldusLiveEntity):
|
||||
"""Return the device class."""
|
||||
return SENSOR_TYPES[self._type][3] \
|
||||
if self._type in SENSOR_TYPES else None
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return a unique ID."""
|
||||
return "-".join(self._id[0:2])
|
||||
|
@ -9,12 +9,11 @@ import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.discovery import SERVICE_TELLDUSLIVE
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL, DEVICE_DEFAULT_NAME,
|
||||
CONF_TOKEN, CONF_HOST,
|
||||
ATTR_BATTERY_LEVEL, CONF_HOST, CONF_TOKEN, DEVICE_DEFAULT_NAME,
|
||||
EVENT_HOMEASSISTANT_START)
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.components.discovery import SERVICE_TELLDUSLIVE
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import track_point_in_utc_time
|
||||
@ -360,3 +359,8 @@ class TelldusLiveEntity(Entity):
|
||||
"""Return the last update of a device."""
|
||||
return str(datetime.fromtimestamp(self.device.lastUpdated)) \
|
||||
if self.device.lastUpdated else None
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return a unique ID."""
|
||||
return self._id
|
||||
|
Loading…
x
Reference in New Issue
Block a user