mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Expose ESPHome project information in device information (#65466)
This commit is contained in:
parent
340146e5fb
commit
6e36bdb907
@ -343,18 +343,30 @@ def _async_setup_device_registry(
|
|||||||
sw_version = device_info.esphome_version
|
sw_version = device_info.esphome_version
|
||||||
if device_info.compilation_time:
|
if device_info.compilation_time:
|
||||||
sw_version += f" ({device_info.compilation_time})"
|
sw_version += f" ({device_info.compilation_time})"
|
||||||
|
|
||||||
configuration_url = None
|
configuration_url = None
|
||||||
if device_info.webserver_port > 0:
|
if device_info.webserver_port > 0:
|
||||||
configuration_url = f"http://{entry.data['host']}:{device_info.webserver_port}"
|
configuration_url = f"http://{entry.data['host']}:{device_info.webserver_port}"
|
||||||
|
|
||||||
|
manufacturer = "espressif"
|
||||||
|
model = device_info.model
|
||||||
|
hw_version = None
|
||||||
|
if device_info.project_name:
|
||||||
|
project_name = device_info.project_name.split(".")
|
||||||
|
manufacturer = project_name[0]
|
||||||
|
model = project_name[1]
|
||||||
|
hw_version = device_info.project_version
|
||||||
|
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
device_entry = device_registry.async_get_or_create(
|
device_entry = device_registry.async_get_or_create(
|
||||||
config_entry_id=entry.entry_id,
|
config_entry_id=entry.entry_id,
|
||||||
configuration_url=configuration_url,
|
configuration_url=configuration_url,
|
||||||
connections={(dr.CONNECTION_NETWORK_MAC, device_info.mac_address)},
|
connections={(dr.CONNECTION_NETWORK_MAC, device_info.mac_address)},
|
||||||
name=device_info.name,
|
name=device_info.name,
|
||||||
manufacturer="espressif",
|
manufacturer=manufacturer,
|
||||||
model=device_info.model,
|
model=model,
|
||||||
sw_version=sw_version,
|
sw_version=sw_version,
|
||||||
|
hw_version=hw_version,
|
||||||
)
|
)
|
||||||
return device_entry.id
|
return device_entry.id
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user