Add device info for Logi Circle camera and sensor entities (#23373)

This commit is contained in:
Evan Bruhn 2019-04-26 08:21:05 +10:00 committed by Paulus Schoutsen
parent 9d67c9feb6
commit 7a6acca6bb
2 changed files with 29 additions and 2 deletions

View file

@ -11,7 +11,7 @@ from homeassistant.const import (
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import (
ATTRIBUTION, DOMAIN as LOGI_CIRCLE_DOMAIN, LED_MODE_KEY,
ATTRIBUTION, DEVICE_BRAND, DOMAIN as LOGI_CIRCLE_DOMAIN, LED_MODE_KEY,
RECORDING_MODE_KEY, SIGNAL_LOGI_CIRCLE_RECONFIGURE,
SIGNAL_LOGI_CIRCLE_RECORD, SIGNAL_LOGI_CIRCLE_SNAPSHOT)
@ -98,6 +98,19 @@ class LogiCam(Camera):
"""Logi Circle camera's support turning on and off ("soft" switch)."""
return SUPPORT_ON_OFF
@property
def device_info(self):
"""Return information about the device."""
return {
'name': self._camera.name,
'identifiers': {
(LOGI_CIRCLE_DOMAIN, self._camera.id)
},
'model': self._camera.model_name,
'sw_version': self._camera.firmware,
'manufacturer': DEVICE_BRAND
}
@property
def device_state_attributes(self):
"""Return the state attributes."""

View file

@ -9,7 +9,8 @@ from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util.dt import as_local
from .const import (
ATTRIBUTION, DOMAIN as LOGI_CIRCLE_DOMAIN, LOGI_SENSORS as SENSOR_TYPES)
ATTRIBUTION, DEVICE_BRAND, DOMAIN as LOGI_CIRCLE_DOMAIN,
LOGI_SENSORS as SENSOR_TYPES)
_LOGGER = logging.getLogger(__name__)
@ -66,6 +67,19 @@ class LogiSensor(Entity):
"""Return the state of the sensor."""
return self._state
@property
def device_info(self):
"""Return information about the device."""
return {
'name': self._camera.name,
'identifiers': {
(LOGI_CIRCLE_DOMAIN, self._camera.id)
},
'model': self._camera.model_name,
'sw_version': self._camera.firmware,
'manufacturer': DEVICE_BRAND
}
@property
def device_state_attributes(self):
"""Return the state attributes."""