Pass the Freebox home node firmware version as a string (#184577)

This commit is contained in:
Franck Nijhof
2026-10-07 05:49:02 +00:00
parent 93f8145ea6
commit 3fe17fc4d2
2 changed files with 23 additions and 1 deletions
+3 -1
View File
@@ -36,7 +36,9 @@ class FreeboxHomeEntity(Entity):
self._attr_unique_id += "-" + sub_node["name"].strip()
self._available = True
self._firmware = node["props"].get("FwVersion")
# The Freebox reports the firmware version of home nodes as a number
firmware = node["props"].get("FwVersion")
self._firmware = str(firmware) if firmware is not None else None
self._manufacturer = "Freebox SAS"
self._model = CATEGORY_TO_MODEL.get(node["category"])
@@ -11,8 +11,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
)
from homeassistant.components.freebox import SCAN_INTERVAL
from homeassistant.components.freebox.const import DOMAIN
from homeassistant.const import ATTR_DEVICE_CLASS
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from .common import setup_platform
from .const import DATA_HOME_PIR_GET_VALUE, DATA_STORAGE_GET_RAIDS
@@ -89,3 +91,21 @@ async def test_home(
assert hass.states.get("binary_sensor.detecteur_cover").state == "on"
assert hass.states.get("binary_sensor.ouverture_porte").state == "off"
assert hass.states.get("binary_sensor.ouverture_porte_cover").state == "on"
@pytest.mark.usefixtures("router")
async def test_home_node_firmware_version(
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
device_registry: dr.DeviceRegistry,
) -> None:
"""Test the firmware version of a home node is passed as a string."""
entry = await setup_platform(hass, BINARY_SENSOR_DOMAIN)
# The PIR detector from the fixture reports its firmware version as a number
device = device_registry.async_get_device_by_identifier(
(DOMAIN, 26), entry.entry_id
)
assert device is not None
assert device.sw_version == "29871925"
assert "non-string value" not in caplog.text