@@ -53,7 +53,7 @@ async def test_no_op_when_no_cumulative_readings(hass: HomeAssistant) -> None:
5353 "custom_components.eac_cyprus.statistics.async_add_external_statistics"
5454 ) as mock_add :
5555 import_cumulative_history (
56- hass , "111" , "mc-30min" , "KWH-30MIN-LP-IMP" , "1 Test St" , interval_only
56+ hass , "111" , "mc-30min" , "KWH-30MIN-LP-IMP" , interval_only
5757 )
5858 mock_add .assert_not_called ()
5959
@@ -72,19 +72,18 @@ async def test_imports_cumulative_kwh_with_correct_metadata(
7272 "custom_components.eac_cyprus.statistics.async_add_external_statistics"
7373 ) as mock_add :
7474 import_cumulative_history (
75- hass , "111 " , "mc-total" , "S-KWH-24H" , "1 Test St " , rdgs
75+ hass , "863224497404 " , "mc-total" , "S-KWH-24H" , rdgs
7676 )
7777
7878 mock_add .assert_called_once ()
7979 _ , metadata , stats = mock_add .call_args .args
80- assert metadata ["statistic_id" ] == "eac_cyprus:111_mc -total"
80+ assert metadata ["statistic_id" ] == "eac_cyprus:863224497404_mc -total"
8181 assert metadata ["source" ] == DOMAIN
8282 assert metadata ["has_sum" ] is True
8383 assert metadata ["has_mean" ] is False
8484 assert metadata ["unit_of_measurement" ] == UnitOfEnergy .KILO_WATT_HOUR
85- assert "EAC" in metadata ["name" ]
86- assert "1 Test St" in metadata ["name" ]
87- assert "S-KWH-24H" in metadata ["name" ]
85+ # Short name: integration tag, last four of sp id, channel type.
86+ assert metadata ["name" ] == "EAC 7404 S-KWH-24H"
8887
8988 assert len (stats ) == 3
9089 for s , expected_reading in zip (stats , [2900.0 , 2924.0 , 2950.0 ], strict = True ):
@@ -95,17 +94,6 @@ async def test_imports_cumulative_kwh_with_correct_metadata(
9594 assert "state" not in s
9695
9796
98- async def test_imports_work_without_known_address (hass : HomeAssistant ) -> None :
99- """When the service point has no address yet, the name still makes sense."""
100- rdgs = _readings (("2026-05-01T00:00:00" , 100.0 , 5.0 ))
101- with patch (
102- "custom_components.eac_cyprus.statistics.async_add_external_statistics"
103- ) as mock_add :
104- import_cumulative_history (hass , "111" , "mc-x" , "S-KWH-24H" , "" , rdgs )
105- metadata = mock_add .call_args .args [1 ]
106- assert metadata ["name" ] == "EAC S-KWH-24H"
107-
108-
10997async def test_coordinator_pushes_stats_for_cumulative_channel_only (
11098 hass : HomeAssistant , mock_client
11199) -> None :
@@ -124,7 +112,3 @@ async def test_coordinator_pushes_stats_for_cumulative_channel_only(
124112 ]
125113 assert "mc-total-24h" in called_channels
126114 assert "mc-30min-imp" not in called_channels
127- # The address is passed through so the metadata name is meaningful.
128- for c in mock_import .call_args_list :
129- # signature: (hass, sp_id, channel_id, channel_name, address, readings)
130- assert c .args [4 ] == "1 Test St, City"
0 commit comments