@@ -450,6 +450,21 @@ async def test_water_heater(
450
450
451
451
assert len (responses .calls ) == 9
452
452
453
+ # In order to call update_entity we need to setup the HA core
454
+ await async_setup_component (hass , "homeassistant" , {})
455
+
456
+ # Try to call update_entity service to trigger an update but because we just did patches
457
+ # this is a noop
458
+ await hass .services .async_call (
459
+ HA_DOMAIN ,
460
+ SERVICE_UPDATE_ENTITY ,
461
+ {ATTR_ENTITY_ID : "water_heater.altherma" },
462
+ blocking = True ,
463
+ )
464
+ await hass .async_block_till_done ()
465
+
466
+ assert len (responses .calls ) == 9
467
+
453
468
454
469
@responses .activate
455
470
async def test_climate (
@@ -933,14 +948,14 @@ async def test_climate(
933
948
assert len (responses .calls ) == 32
934
949
assert hass .states .get ("climate.werkkamer_room_temperature" ).state == HVACMode .DRY
935
950
951
+ # In order to call update_entity we need to setup the HA core
952
+ await async_setup_component (hass , "homeassistant" , {})
953
+
936
954
# We patch the scan_ignore method to zero so that the coordinator will pull again
937
955
with patch (
938
956
"custom_components.daikin_onecta.OnectaDataUpdateCoordinator.scan_ignore" ,
939
957
return_value = 0 ,
940
958
):
941
- # In order to call update_entity we need to setup the HA core
942
- await async_setup_component (hass , "homeassistant" , {})
943
-
944
959
with responses .RequestsMock () as rsps :
945
960
rsps .get (DAIKIN_API_URL + "/v1/gateway-devices" , status = 200 , json = load_fixture_json ("altherma" ))
946
961
# Call update_entity service to trigger an update
@@ -954,15 +969,3 @@ async def test_climate(
954
969
955
970
assert len (rsps .calls ) == 1
956
971
assert rsps .calls [0 ].request .url == DAIKIN_API_URL + "/v1/gateway-devices"
957
-
958
- # Try to call update_entity service to trigger an update but because we just did this it
959
- # is a noop
960
- await hass .services .async_call (
961
- HA_DOMAIN ,
962
- SERVICE_UPDATE_ENTITY ,
963
- {ATTR_ENTITY_ID : "climate.werkkamer_room_temperature" },
964
- blocking = True ,
965
- )
966
- await hass .async_block_till_done ()
967
-
968
- assert len (rsps .calls ) == 1
0 commit comments