Link to device from browser mod panel
This commit is contained in:
@@ -167,6 +167,16 @@ class BrowserModBrowser:
|
||||
device = dr.async_get_device({(DOMAIN, self.browserID)})
|
||||
dr.async_remove_device(device.id)
|
||||
|
||||
def get_device_id(self, hass):
|
||||
er = entity_registry.async_get(hass)
|
||||
entities = list(self.entities.values())
|
||||
if len(entities):
|
||||
entity = entities[0]
|
||||
entry = er.async_get(entity.entity_id)
|
||||
if entry:
|
||||
return entry.device_id
|
||||
return "default"
|
||||
|
||||
@property
|
||||
def connection(self):
|
||||
"""The current websocket connections for this Browser."""
|
||||
|
||||
@@ -62,7 +62,9 @@ async def async_setup_connection(hass):
|
||||
dev.update_settings(hass, store.get_browser(browserID).asdict())
|
||||
dev.open_connection(connection, msg["id"])
|
||||
await store.set_browser(
|
||||
browserID, last_seen=datetime.now(tz=timezone.utc).isoformat()
|
||||
browserID,
|
||||
last_seen=datetime.now(tz=timezone.utc).isoformat(),
|
||||
meta=dev.get_device_id(hass),
|
||||
)
|
||||
send_update(store.asdict())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user