Add hardware version to bond (#62256)
parent
90345b1cf2
commit
d7c5e41802
|
@ -87,6 +87,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
name=hub_name,
|
||||
model=hub.target,
|
||||
sw_version=hub.fw_ver,
|
||||
hw_version=hub.mcu_ver,
|
||||
suggested_area=hub.location,
|
||||
configuration_url=f"http://{host}",
|
||||
)
|
||||
|
|
|
@ -11,6 +11,7 @@ from aiohttp import ClientError
|
|||
from bond_api import BPUPSubscriptions
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_HW_VERSION,
|
||||
ATTR_MODEL,
|
||||
ATTR_NAME,
|
||||
ATTR_SUGGESTED_AREA,
|
||||
|
@ -78,6 +79,8 @@ class BondEntity(Entity):
|
|||
device_info[ATTR_MODEL] = self._hub.model
|
||||
if self._hub.fw_ver is not None:
|
||||
device_info[ATTR_SW_VERSION] = self._hub.fw_ver
|
||||
if self._hub.mcu_ver is not None:
|
||||
device_info[ATTR_HW_VERSION] = self._hub.mcu_ver
|
||||
else:
|
||||
model_data = []
|
||||
if self._device.branding_profile:
|
||||
|
|
|
@ -207,6 +207,11 @@ class BondHub:
|
|||
"""Return this hub firmware version."""
|
||||
return self._version.get("fw_ver")
|
||||
|
||||
@property
|
||||
def mcu_ver(self) -> str | None:
|
||||
"""Return this hub hardware version."""
|
||||
return self._version.get("mcu_ver")
|
||||
|
||||
@property
|
||||
def devices(self) -> list[BondDevice]:
|
||||
"""Return a list of all devices controlled by this hub."""
|
||||
|
|
|
@ -84,6 +84,7 @@ async def test_async_setup_entry_sets_up_hub_and_supported_domains(hass: HomeAss
|
|||
"bondid": "test-bond-id",
|
||||
"target": "test-model",
|
||||
"fw_ver": "test-version",
|
||||
"mcu_ver": "test-hw-version",
|
||||
}
|
||||
), patch_setup_entry("cover") as mock_cover_async_setup_entry, patch_setup_entry(
|
||||
"fan"
|
||||
|
@ -107,6 +108,7 @@ async def test_async_setup_entry_sets_up_hub_and_supported_domains(hass: HomeAss
|
|||
assert hub.manufacturer == "Olibra"
|
||||
assert hub.model == "test-model"
|
||||
assert hub.sw_version == "test-version"
|
||||
assert hub.hw_version == "test-hw-version"
|
||||
assert hub.configuration_url == "http://some host"
|
||||
|
||||
# verify supported domains are setup
|
||||
|
|
Loading…
Reference in New Issue