Add has_firmware_update_cc bool to zwave_js/node_status cmd (#87310)

* Add `has_firmware_update_cc` bool to zwave_js/node_status cmd

* fix test

* Switch order of equality check
This commit is contained in:
Raman Gupta 2023-02-10 00:49:09 -05:00 committed by GitHub
parent 8cd5106c15
commit 8aa64c8008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View file

@ -518,7 +518,7 @@ class NodeEvents:
# Create a firmware update entity for each non-controller device that
# supports firmware updates
if not node.is_controller_node and any(
CommandClass.FIRMWARE_UPDATE_MD.value == cc.id
cc.id == CommandClass.FIRMWARE_UPDATE_MD.value
for cc in node.command_classes
):
await self.controller_events.driver_events.async_setup_platform(

View file

@ -374,6 +374,10 @@ def node_status(node: Node) -> dict[str, Any]:
"zwave_plus_version": node.zwave_plus_version,
"highest_security_class": node.highest_security_class,
"is_controller_node": node.is_controller_node,
"has_firmware_update_cc": any(
cc.id == CommandClass.FIRMWARE_UPDATE_MD.value
for cc in node.command_classes
),
}

View file

@ -319,6 +319,7 @@ async def test_node_status(hass, multisensor_6, integration, hass_ws_client):
assert result["zwave_plus_version"] == 1
assert result["highest_security_class"] == SecurityClass.S0_LEGACY
assert not result["is_controller_node"]
assert not result["has_firmware_update_cc"]
# Test getting non-existent node fails
await ws_client.send_json(