diff --git a/blog/2024-07-16-device-info-model-id.md b/blog/2024-07-16-device-info-model-id.md new file mode 100644 index 00000000..714ec934 --- /dev/null +++ b/blog/2024-07-16-device-info-model-id.md @@ -0,0 +1,10 @@ +--- +author: Joost Lekkerkerker +authorURL: https://github.com/joostlek +authorImageURL: https://avatars.githubusercontent.com/u/7083755?v=4 +title: "model_id added to DeviceInfo" +--- + +Starting from 2024.8, you can now add a model identifier to the `DeviceInfo` class. This identifier can be used to identify the device model in integrations and the frontend. + +For example, the Philips Hue ambiance spot was previously listed as "Hue ambiance spot (LTG002)". This can now be split up, where the `model` is "Hue ambiance spot" and the `model_id` is "LTG002". \ No newline at end of file diff --git a/docs/device_registry_index.md b/docs/device_registry_index.md index 305cb9c3..9e09f405 100644 --- a/docs/device_registry_index.md +++ b/docs/device_registry_index.md @@ -23,27 +23,28 @@ Although not currently available, we could consider offering an option to users ## Device properties -| Attribute | Description | -| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| area_id | The Area which the device is placed in. | -| config_entries | Config entries that are linked to this device. | -| configuration_url | A URL on which the device or service can be configured, linking to paths inside the Home Assistant UI can be done by using `homeassistant://`. | +| Attribute | Description | +|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| area_id | The Area which the device is placed in. | +| config_entries | Config entries that are linked to this device. | +| configuration_url | A URL on which the device or service can be configured, linking to paths inside the Home Assistant UI can be done by using `homeassistant://`. | | connections | A set of tuples of `(connection_type, connection identifier)`. Connection types are defined in the device registry module. Each item in the set uniquely defines a device entry, meaning another device can't have the same connection. | -| default_manufacturer | The manufacturer of the device, will be overridden if `manufacturer` is set. Useful for example for an integration showing all devices on the network. | -| default_model | The model of the device, will be overridden if `model` is set. Useful for example for an integration showing all devices on the network. | -| default_name | Default name of this device, will be overridden if `name` is set. Useful for example for an integration showing all devices on the network. | -| entry_type | The type of entry. Possible values are `None` and `DeviceEntryType` enum members (only `service`). | -| hw_version | The hardware version of the device. | -| id | Unique ID of device (generated by Home Assistant) | +| default_manufacturer | The manufacturer of the device, will be overridden if `manufacturer` is set. Useful for example for an integration showing all devices on the network. | +| default_model | The model of the device, will be overridden if `model` is set. Useful for example for an integration showing all devices on the network. | +| default_name | Default name of this device, will be overridden if `name` is set. Useful for example for an integration showing all devices on the network. | +| entry_type | The type of entry. Possible values are `None` and `DeviceEntryType` enum members (only `service`). | +| hw_version | The hardware version of the device. | +| id | Unique ID of device (generated by Home Assistant) | | identifiers | Set of `(DOMAIN, identifier)` tuples. Identifiers identify the device in the outside world. An example is a serial number. Each item in the set uniquely defines a device entry, meaning another device can't have the same identifier. | -| name | Name of this device | -| name_by_user | The user configured name of the device. | -| manufacturer | The manufacturer of the device. | -| model | The model of the device. | -| serial_number | The serial number of the device. Unlike a serial number in the `identifiers` set, this does not need to be unique. | -| suggested_area | The suggested name for the area where the device is located. | -| sw_version | The firmware version of the device. | -| via_device | Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant. | +| name | Name of this device | +| name_by_user | The user configured name of the device. | +| manufacturer | The manufacturer of the device. | +| model | The model name of the device. | +| model_id | The model identifier of the device. | +| serial_number | The serial number of the device. Unlike a serial number in the `identifiers` set, this does not need to be unique. | +| suggested_area | The suggested name for the area where the device is located. | +| sw_version | The firmware version of the device. | +| via_device | Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant. | ## Defining devices @@ -68,6 +69,7 @@ class HueLight(LightEntity): name=self.name, manufacturer=self.light.manufacturername, model=self.light.productname, + model_id=self.light.modelid, sw_version=self.light.swversion, via_device=(hue.DOMAIN, self.api.bridgeid), ) @@ -92,7 +94,8 @@ device_registry.async_get_or_create( manufacturer="Signify", suggested_area="Kitchen", name=config.name, - model=config.modelid, + model=config.modelname, + model_id=config.modelid, sw_version=config.swversion, hw_version=config.hwversion, )