@@ -269,7 +269,7 @@ async def test_update_entity_sleep(
269269 zen_31 : Node ,
270270 integration : MockConfigEntry ,
271271) -> None :
272- """Test update occurs when device is asleep after it wakes up ."""
272+ """Test update occurs when device is asleep."""
273273 event = Event (
274274 "sleep" ,
275275 data = {"source" : "node" , "event" : "sleep" , "nodeId" : zen_31 .node_id },
@@ -283,29 +283,13 @@ async def test_update_entity_sleep(
283283 await hass .async_block_till_done ()
284284
285285 # Two nodes in total, the controller node and the zen_31 node.
286- # The zen_31 node is asleep,
287- # so we should only check for updates for the controller node.
288- assert client .async_send_command .call_count == 1
289- args = client .async_send_command .call_args [0 ][0 ]
290- assert args ["command" ] == "controller.get_available_firmware_updates"
291- assert args ["nodeId" ] == 1
292-
293- client .async_send_command .reset_mock ()
294-
295- event = Event (
296- "wake up" ,
297- data = {"source" : "node" , "event" : "wake up" , "nodeId" : zen_31 .node_id },
298- )
299- zen_31 .receive_event (event )
300- await hass .async_block_till_done ()
301-
302- # Now that the zen_31 node is awake we can check for updates for it.
303- # The controller node has already been checked,
304- # so won't get another check now.
305- assert client .async_send_command .call_count == 1
306- args = client .async_send_command .call_args [0 ][0 ]
307- assert args ["command" ] == "controller.get_available_firmware_updates"
308- assert args ["nodeId" ] == 94
286+ # We should check for updates for both nodes, including the sleeping one
287+ # since the firmware check no longer requires device communication first.
288+ assert client .async_send_command .call_count == 2
289+ # Check calls were made for both nodes
290+ call_args = [call [0 ][0 ] for call in client .async_send_command .call_args_list ]
291+ assert any (args ["nodeId" ] == 1 for args in call_args ) # Controller node
292+ assert any (args ["nodeId" ] == 94 for args in call_args ) # zen_31 node
309293
310294
311295async def test_update_entity_dead (
@@ -1158,28 +1142,3 @@ async def test_update_entity_no_latest_version(
11581142 assert state .state == STATE_OFF
11591143 assert state .attributes [ATTR_SKIPPED_VERSION ] is None
11601144 assert state .attributes [ATTR_LATEST_VERSION ] == latest_version
1161-
1162-
1163- async def test_update_entity_unload_asleep_node (
1164- hass : HomeAssistant ,
1165- client : MagicMock ,
1166- wallmote_central_scene : Node ,
1167- integration : MockConfigEntry ,
1168- ) -> None :
1169- """Test unloading config entry after attempting an update for an asleep node."""
1170- config_entry = integration
1171- assert client .async_send_command .call_count == 0
1172-
1173- client .async_send_command .reset_mock ()
1174- client .async_send_command .return_value = {"updates" : []}
1175-
1176- async_fire_time_changed (hass , dt_util .utcnow () + timedelta (minutes = 5 , days = 1 ))
1177- await hass .async_block_till_done ()
1178-
1179- # Once call completed for the (awake) controller node.
1180- assert client .async_send_command .call_count == 1
1181- assert len (wallmote_central_scene ._listeners ["wake up" ]) == 1
1182-
1183- await hass .config_entries .async_unload (config_entry .entry_id )
1184- assert client .async_send_command .call_count == 1
1185- assert len (wallmote_central_scene ._listeners ["wake up" ]) == 0
0 commit comments