mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Add device info for LIFX (#17330)
* Add device info for LIFX * Address review comments
This commit is contained in:
parent
9718a17351
commit
1a5048baaf
@ -27,6 +27,7 @@ from homeassistant.components.lifx import (
|
|||||||
from homeassistant.const import ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import ATTR_ENTITY_ID, EVENT_HOMEASSISTANT_STOP
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
import homeassistant.helpers.device_registry as dr
|
||||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||||
from homeassistant.helpers.service import extract_entity_ids
|
from homeassistant.helpers.service import extract_entity_ids
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
@ -397,6 +398,26 @@ class LIFXLight(Light):
|
|||||||
self.postponed_update = None
|
self.postponed_update = None
|
||||||
self.lock = asyncio.Lock()
|
self.lock = asyncio.Lock()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
"""Return information about the device."""
|
||||||
|
info = {
|
||||||
|
'identifiers': {
|
||||||
|
(LIFX_DOMAIN, self.unique_id)
|
||||||
|
},
|
||||||
|
'name': self.name,
|
||||||
|
'connections': {
|
||||||
|
(dr.CONNECTION_NETWORK_MAC, self.bulb.mac_addr)
|
||||||
|
},
|
||||||
|
'manufacturer': 'LIFX',
|
||||||
|
}
|
||||||
|
|
||||||
|
model = aiolifx().products.product_map.get(self.bulb.product)
|
||||||
|
if model is not None:
|
||||||
|
info['model'] = model
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
"""Return the availability of the bulb."""
|
"""Return the availability of the bulb."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user