diff --git a/tests/components/dyson/test_air_quality.py b/tests/components/dyson/test_air_quality.py index ab068823d64..1c7947fd621 100644 --- a/tests/components/dyson/test_air_quality.py +++ b/tests/components/dyson/test_air_quality.py @@ -86,8 +86,11 @@ async def test_purecool_aiq_update_state(devices, login, hass): device.environmental_state = \ DysonEnvironmentalSensorV2State(json.dumps(event)) - callback = device.add_message_listener.call_args_list[2][0][0] - callback(device.environmental_state) + for call in device.add_message_listener.call_args_list: + callback = call[0][0] + if type(callback.__self__) == dyson.DysonAirSensor: + callback(device.environmental_state) + await hass.async_block_till_done() fan_state = hass.states.get("air_quality.living_room") attributes = fan_state.attributes diff --git a/tests/components/dyson/test_fan.py b/tests/components/dyson/test_fan.py index 09622e4d36d..07c919c6e90 100644 --- a/tests/components/dyson/test_fan.py +++ b/tests/components/dyson/test_fan.py @@ -680,8 +680,11 @@ async def test_purecool_update_state(devices, login, hass): "osau": "0095", "ancp": "CUST"}} device.state = DysonPureCoolV2State(json.dumps(event)) - callback = device.add_message_listener.call_args_list[3][0][0] - callback(device.state) + for call in device.add_message_listener.call_args_list: + callback = call[0][0] + if type(callback.__self__) == dyson.DysonPureCoolDevice: + callback(device.state) + await hass.async_block_till_done() fan_state = hass.states.get("fan.living_room") attributes = fan_state.attributes