hass-core/homeassistant/components/juicenet/entity.py
Marc Mueller f92f0bb87b
Use EntityDescription - juicenet (#54362)
* Use EntityDescription - juicenet

* Move part of icon to EntityDescription

* Remove default values

* Remove name override to use the _attr_name

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2021-08-10 14:25:22 +12:00

29 lines
833 B
Python

"""Adapter to wrap the pyjuicenet api for home assistant."""
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN
class JuiceNetDevice(CoordinatorEntity):
"""Represent a base JuiceNet device."""
def __init__(self, device, sensor_type, coordinator):
"""Initialise the sensor."""
super().__init__(coordinator)
self.device = device
self.type = sensor_type
@property
def unique_id(self):
"""Return a unique ID."""
return f"{self.device.id}-{self.type}"
@property
def device_info(self):
"""Return device information about this JuiceNet Device."""
return {
"identifiers": {(DOMAIN, self.device.id)},
"name": self.device.name,
"manufacturer": "JuiceNet",
}