Show project version as `sw_version` in ESPHome (#123183)
parent
6d47a4d7e4
commit
6af1e25d7e
|
@ -654,12 +654,13 @@ def _async_setup_device_registry(
|
||||||
if device_info.manufacturer:
|
if device_info.manufacturer:
|
||||||
manufacturer = device_info.manufacturer
|
manufacturer = device_info.manufacturer
|
||||||
model = device_info.model
|
model = device_info.model
|
||||||
hw_version = None
|
|
||||||
if device_info.project_name:
|
if device_info.project_name:
|
||||||
project_name = device_info.project_name.split(".")
|
project_name = device_info.project_name.split(".")
|
||||||
manufacturer = project_name[0]
|
manufacturer = project_name[0]
|
||||||
model = project_name[1]
|
model = project_name[1]
|
||||||
hw_version = device_info.project_version
|
sw_version = (
|
||||||
|
f"{device_info.project_version} (ESPHome {device_info.esphome_version})"
|
||||||
|
)
|
||||||
|
|
||||||
suggested_area = None
|
suggested_area = None
|
||||||
if device_info.suggested_area:
|
if device_info.suggested_area:
|
||||||
|
@ -674,7 +675,6 @@ def _async_setup_device_registry(
|
||||||
manufacturer=manufacturer,
|
manufacturer=manufacturer,
|
||||||
model=model,
|
model=model,
|
||||||
sw_version=sw_version,
|
sw_version=sw_version,
|
||||||
hw_version=hw_version,
|
|
||||||
suggested_area=suggested_area,
|
suggested_area=suggested_area,
|
||||||
)
|
)
|
||||||
return device_entry.id
|
return device_entry.id
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ async def test_esphome_device_with_project(
|
||||||
)
|
)
|
||||||
assert dev.manufacturer == "mfr"
|
assert dev.manufacturer == "mfr"
|
||||||
assert dev.model == "model"
|
assert dev.model == "model"
|
||||||
assert dev.hw_version == "2.2.2"
|
assert dev.sw_version == "2.2.2 (ESPHome 1.0.0)"
|
||||||
|
|
||||||
|
|
||||||
async def test_esphome_device_with_manufacturer(
|
async def test_esphome_device_with_manufacturer(
|
||||||
|
|
Loading…
Reference in New Issue