Add model_id to device info (#2251)

This commit is contained in:
Joost Lekkerkerker 2024-07-16 15:13:21 +02:00 committed by GitHub
parent 20c58b1128
commit 9f616cd5d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 20 deletions

View File

@ -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".

View File

@ -24,7 +24,7 @@ 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://<path>`. |
@ -39,7 +39,8 @@ Although not currently available, we could consider offering an option to users
| 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. |
| 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. |
@ -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,
)