Add model to Teslemetry Wall Connectors (#119251)
This commit is contained in:
parent
8a0cc55278
commit
159503b8d3
4 changed files with 19 additions and 6 deletions
|
@ -211,6 +211,14 @@ class TeslemetryWallConnectorEntity(
|
||||||
"""Initialize common aspects of a Teslemetry entity."""
|
"""Initialize common aspects of a Teslemetry entity."""
|
||||||
self.din = din
|
self.din = din
|
||||||
self._attr_unique_id = f"{data.id}-{din}-{key}"
|
self._attr_unique_id = f"{data.id}-{din}-{key}"
|
||||||
|
|
||||||
|
# Find the model from the info coordinator
|
||||||
|
model: str | None = None
|
||||||
|
for wc in data.info_coordinator.data.get("components_wall_connectors", []):
|
||||||
|
if wc["din"] == din:
|
||||||
|
model = wc.get("part_name")
|
||||||
|
break
|
||||||
|
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, din)},
|
identifiers={(DOMAIN, din)},
|
||||||
manufacturer="Tesla",
|
manufacturer="Tesla",
|
||||||
|
@ -218,6 +226,7 @@ class TeslemetryWallConnectorEntity(
|
||||||
name="Wall Connector",
|
name="Wall Connector",
|
||||||
via_device=(DOMAIN, str(data.id)),
|
via_device=(DOMAIN, str(data.id)),
|
||||||
serial_number=din.split("-")[-1],
|
serial_number=din.split("-")[-1],
|
||||||
|
model=model,
|
||||||
)
|
)
|
||||||
|
|
||||||
super().__init__(data.live_coordinator, data.api, key)
|
super().__init__(data.live_coordinator, data.api, key)
|
||||||
|
|
|
@ -82,12 +82,14 @@
|
||||||
"wall_connectors": [
|
"wall_connectors": [
|
||||||
{
|
{
|
||||||
"device_id": "123abc",
|
"device_id": "123abc",
|
||||||
"din": "abc123",
|
"din": "abd-123",
|
||||||
|
"part_name": "Gen 3 Wall Connector",
|
||||||
"is_active": true
|
"is_active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"device_id": "234bcd",
|
"device_id": "234bcd",
|
||||||
"din": "bcd234",
|
"din": "bcd-234",
|
||||||
|
"part_name": "Gen 3 Wall Connector",
|
||||||
"is_active": true
|
"is_active": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -76,13 +76,15 @@
|
||||||
'components_wall_connectors': list([
|
'components_wall_connectors': list([
|
||||||
dict({
|
dict({
|
||||||
'device_id': '123abc',
|
'device_id': '123abc',
|
||||||
'din': 'abc123',
|
'din': 'abd-123',
|
||||||
'is_active': True,
|
'is_active': True,
|
||||||
|
'part_name': 'Gen 3 Wall Connector',
|
||||||
}),
|
}),
|
||||||
dict({
|
dict({
|
||||||
'device_id': '234bcd',
|
'device_id': '234bcd',
|
||||||
'din': 'bcd234',
|
'din': 'bcd-234',
|
||||||
'is_active': True,
|
'is_active': True,
|
||||||
|
'part_name': 'Gen 3 Wall Connector',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
'components_wifi_commissioning_enabled': True,
|
'components_wifi_commissioning_enabled': True,
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
'labels': set({
|
'labels': set({
|
||||||
}),
|
}),
|
||||||
'manufacturer': 'Tesla',
|
'manufacturer': 'Tesla',
|
||||||
'model': None,
|
'model': 'Gen 3 Wall Connector',
|
||||||
'name': 'Wall Connector',
|
'name': 'Wall Connector',
|
||||||
'name_by_user': None,
|
'name_by_user': None,
|
||||||
'serial_number': '123',
|
'serial_number': '123',
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
'labels': set({
|
'labels': set({
|
||||||
}),
|
}),
|
||||||
'manufacturer': 'Tesla',
|
'manufacturer': 'Tesla',
|
||||||
'model': None,
|
'model': 'Gen 3 Wall Connector',
|
||||||
'name': 'Wall Connector',
|
'name': 'Wall Connector',
|
||||||
'name_by_user': None,
|
'name_by_user': None,
|
||||||
'serial_number': '234',
|
'serial_number': '234',
|
||||||
|
|
Loading…
Add table
Reference in a new issue