1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Mobile app to use device tracker config entry (#24238)

* Mobile app to use device tracker config entry

* Lint

* Re-use device_info

* Lint
This commit is contained in:
Paulus Schoutsen
2019-05-31 23:01:45 -07:00
committed by Robbie Trencheny
parent 3076866ec6
commit b4374c8c4c
14 changed files with 318 additions and 165 deletions

View File

@@ -6,11 +6,11 @@ from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from .const import (ATTR_DEVICE_ID, ATTR_DEVICE_NAME, ATTR_MANUFACTURER,
ATTR_MODEL, ATTR_OS_VERSION, ATTR_SENSOR_ATTRIBUTES,
from .const import (ATTR_SENSOR_ATTRIBUTES,
ATTR_SENSOR_DEVICE_CLASS, ATTR_SENSOR_ICON,
ATTR_SENSOR_NAME, ATTR_SENSOR_TYPE, ATTR_SENSOR_UNIQUE_ID,
DOMAIN, SIGNAL_SENSOR_UPDATE)
from .helpers import device_info
def sensor_id(webhook_id, unique_id):
@@ -76,17 +76,7 @@ class MobileAppEntity(Entity):
@property
def device_info(self):
"""Return device registry information for this entity."""
return {
'identifiers': {
(ATTR_DEVICE_ID, self._registration[ATTR_DEVICE_ID]),
(CONF_WEBHOOK_ID, self._registration[CONF_WEBHOOK_ID])
},
'manufacturer': self._registration[ATTR_MANUFACTURER],
'model': self._registration[ATTR_MODEL],
'device_name': self._registration[ATTR_DEVICE_NAME],
'sw_version': self._registration[ATTR_OS_VERSION],
'config_entries': self._device.config_entries
}
return device_info(self._registration)
async def async_update(self):
"""Get the latest state of the sensor."""