diff --git a/homeassistant/components/zha/core/const.py b/homeassistant/components/zha/core/const.py index bf778812453..3fbb62f8433 100644 --- a/homeassistant/components/zha/core/const.py +++ b/homeassistant/components/zha/core/const.py @@ -18,6 +18,7 @@ ATTR_CLUSTER_ID = "cluster_id" ATTR_CLUSTER_TYPE = "cluster_type" ATTR_COMMAND = "command" ATTR_COMMAND_TYPE = "command_type" +ATTR_DEVICE_TYPE = "device_type" ATTR_ENDPOINT_ID = "endpoint_id" ATTR_IEEE = "ieee" ATTR_LAST_SEEN = "last_seen" diff --git a/homeassistant/components/zha/core/device.py b/homeassistant/components/zha/core/device.py index 634a06f7f58..5c3b3578c12 100644 --- a/homeassistant/components/zha/core/device.py +++ b/homeassistant/components/zha/core/device.py @@ -32,6 +32,7 @@ from .const import ( ATTR_CLUSTER_ID, ATTR_COMMAND, ATTR_COMMAND_TYPE, + ATTR_DEVICE_TYPE, ATTR_ENDPOINT_ID, ATTR_IEEE, ATTR_LAST_SEEN, @@ -57,6 +58,7 @@ from .const import ( POWER_BATTERY_OR_UNKNOWN, POWER_MAINS_POWERED, SIGNAL_AVAILABLE, + UNKNOWN, UNKNOWN_MANUFACTURER, UNKNOWN_MODEL, ) @@ -160,6 +162,12 @@ class ZHADevice(LogMixin): """Return true if device is mains powered.""" return self._zigpy_device.node_desc.is_mains_powered + @property + def device_type(self): + """Return the logical device type for the device.""" + device_type = self._zigpy_device.node_desc.logical_type + return device_type.name if device_type else UNKNOWN + @property def power_source(self): """Return the power source for the device.""" @@ -281,6 +289,7 @@ class ZHADevice(LogMixin): ATTR_RSSI: self.rssi, ATTR_LAST_SEEN: update_time, ATTR_AVAILABLE: self.available, + ATTR_DEVICE_TYPE: self.device_type, } def add_cluster_channel(self, cluster_channel):