Skip to content

Commit 34088ba

Browse files
committed
refactor: remove support for heating circuit 3 and update related tests
1 parent c2553b4 commit 34088ba

6 files changed

Lines changed: 15 additions & 121 deletions

File tree

tests/fixtures/state_circuit2.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"readwrite": 1,
4949
"unit": ""
5050
},
51-
"8741": {
52-
"name": "Room temperature setpoint 1",
51+
"8770": {
52+
"name": "Room temperature actual value 2",
5353
"dataType_name": "TEMP",
5454
"dataType_family": "VALS",
5555
"error": 0,
@@ -61,7 +61,7 @@
6161
"readwrite": 1,
6262
"unit": "°C"
6363
},
64-
"8750": {
64+
"8779": {
6565
"name": "Room thermostat heating circuit 2",
6666
"dataType_name": "ENUM",
6767
"dataType_family": "ENUM",

tests/test_api_validation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,7 @@ async def test_validate_api_section_hot_water_cache() -> None:
372372
"device": {},
373373
"hot_water": {"1600": "operating_mode", "1610": "nominal_setpoint"},
374374
"heating_circuit2": {},
375-
"heating_circuit3": {},
376375
"staticValues_circuit2": {},
377-
"staticValues_circuit3": {},
378376
}
379377
bsblan._api_validator = APIValidator(bsblan._api_data)
380378

tests/test_circuit.py

Lines changed: 12 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Tests for multi-circuit (HC1/HC2/HC3) heating support."""
1+
"""Tests for multi-circuit (HC1/HC2) heating support."""
22

33
# pylint: disable=protected-access
44

@@ -43,10 +43,8 @@ async def mock_bsblan_circuit() -> AsyncGenerator[BSBLAN, None]:
4343
api_validator = APIValidator(bsblan._api_data)
4444
api_validator.validated_sections.add("heating")
4545
api_validator.validated_sections.add("heating_circuit2")
46-
api_validator.validated_sections.add("heating_circuit3")
4746
api_validator.validated_sections.add("staticValues")
4847
api_validator.validated_sections.add("staticValues_circuit2")
49-
api_validator.validated_sections.add("staticValues_circuit3")
5048
bsblan._api_validator = api_validator
5149

5250
yield bsblan
@@ -292,61 +290,6 @@ async def test_thermostat_circuit2_hvac_mode(
292290
await mock_bsblan_circuit.thermostat(hvac_mode=1, circuit=2)
293291

294292

295-
@pytest.mark.asyncio
296-
async def test_thermostat_circuit3_temperature(
297-
mock_bsblan_circuit: BSBLAN,
298-
aresponses: ResponsesMockServer,
299-
) -> None:
300-
"""Test setting temperature on circuit 3."""
301-
mock_bsblan_circuit._circuit_temp_ranges[3] = {
302-
"min": 8.0,
303-
"max": 35.0,
304-
}
305-
mock_bsblan_circuit._circuit_temp_initialized.add(3)
306-
307-
expected_data = {
308-
"Parameter": "1310",
309-
"Value": "25",
310-
"Type": "1",
311-
}
312-
aresponses.add(
313-
"example.com",
314-
"/JS",
315-
"POST",
316-
create_response_handler(expected_data),
317-
)
318-
await mock_bsblan_circuit.thermostat(
319-
target_temperature="25",
320-
circuit=3,
321-
)
322-
323-
324-
@pytest.mark.asyncio
325-
async def test_thermostat_circuit3_hvac_mode(
326-
mock_bsblan_circuit: BSBLAN,
327-
aresponses: ResponsesMockServer,
328-
) -> None:
329-
"""Test setting HVAC mode on circuit 3."""
330-
mock_bsblan_circuit._circuit_temp_ranges[3] = {
331-
"min": 8.0,
332-
"max": 35.0,
333-
}
334-
mock_bsblan_circuit._circuit_temp_initialized.add(3)
335-
336-
expected_data = {
337-
"Parameter": "1300",
338-
"Value": "2",
339-
"Type": "1",
340-
}
341-
aresponses.add(
342-
"example.com",
343-
"/JS",
344-
"POST",
345-
create_response_handler(expected_data),
346-
)
347-
await mock_bsblan_circuit.thermostat(hvac_mode=2, circuit=3)
348-
349-
350293
@pytest.mark.asyncio
351294
async def test_thermostat_circuit1_still_works(
352295
mock_bsblan_circuit: BSBLAN,
@@ -416,7 +359,7 @@ async def test_invalid_circuit_number(
416359
await mock_bsblan_circuit.state(circuit=0)
417360

418361
with pytest.raises(BSBLANInvalidParameterError, match="Invalid circuit"):
419-
await mock_bsblan_circuit.state(circuit=4)
362+
await mock_bsblan_circuit.state(circuit=3)
420363

421364
with pytest.raises(BSBLANInvalidParameterError, match="Invalid circuit"):
422365
await mock_bsblan_circuit.static_values(circuit=99)
@@ -613,9 +556,6 @@ async def mock_request(
613556
# HC2 status - active
614557
if param_id == "8001":
615558
return {"8001": {"value": "114", "desc": "Heating mode Comfort"}}
616-
# HC3 operating mode - returns empty (not available)
617-
if param_id == "1300":
618-
return {"1300": {}}
619559
return {}
620560

621561
bsblan._request = AsyncMock(side_effect=mock_request) # type: ignore[method-assign]
@@ -624,38 +564,6 @@ async def mock_request(
624564
assert circuits == [1, 2]
625565

626566

627-
@pytest.mark.asyncio
628-
async def test_get_available_circuits_all_three(
629-
mock_bsblan_circuit: BSBLAN,
630-
) -> None:
631-
"""Test detecting all three available heating circuits."""
632-
bsblan = mock_bsblan_circuit
633-
634-
status_map = {
635-
"8000": {"value": "114", "desc": "Heating mode Comfort"},
636-
"8001": {"value": "140", "desc": "Heating Reduced"},
637-
"8002": {"value": "114", "desc": "Heating mode Comfort"},
638-
}
639-
640-
async def mock_request(
641-
**kwargs: Any,
642-
) -> dict[str, Any]:
643-
params = kwargs.get("params", {})
644-
param_id = params.get("Parameter", "")
645-
# Operating mode params
646-
if param_id in {"700", "1000", "1300"}:
647-
return {param_id: {"value": "1", "unit": "", "desc": "Automatic"}}
648-
# Status params - all active
649-
if param_id in status_map:
650-
return {param_id: status_map[param_id]}
651-
return {}
652-
653-
bsblan._request = AsyncMock(side_effect=mock_request) # type: ignore[method-assign]
654-
655-
circuits = await bsblan.get_available_circuits()
656-
assert circuits == [1, 2, 3]
657-
658-
659567
@pytest.mark.asyncio
660568
async def test_get_available_circuits_only_one(
661569
mock_bsblan_circuit: BSBLAN,
@@ -677,8 +585,8 @@ async def mock_request(
677585
"desc": "Heating mode Comfort",
678586
}
679587
}
680-
# HC2 and HC3 operating mode - return empty
681-
if param_id in {"1000", "1300"}:
588+
# HC2 operating mode - return empty
589+
if param_id == "1000":
682590
return {param_id: {}}
683591
return {}
684592

@@ -695,7 +603,7 @@ async def test_get_available_circuits_inactive_by_status(
695603
"""Test that circuits with status '---' are detected as inactive.
696604
697605
This is the real-world scenario: the device returns a valid operating
698-
mode for all 3 circuits, but status param shows '---' for HC2/HC3.
606+
mode for all circuits, but status param shows '---' for HC2.
699607
"""
700608
bsblan = mock_bsblan_circuit
701609

@@ -705,7 +613,7 @@ async def mock_request(
705613
params = kwargs.get("params", {})
706614
param_id = params.get("Parameter", "")
707615
# All circuits return valid operating mode
708-
if param_id in {"700", "1000", "1300"}:
616+
if param_id in {"700", "1000"}:
709617
return {param_id: {"value": "1", "unit": "", "desc": "Automatic"}}
710618
# HC1 status - active
711619
if param_id == "8000":
@@ -718,9 +626,6 @@ async def mock_request(
718626
# HC2 status - inactive (value=0, desc=---)
719627
if param_id == "8001":
720628
return {"8001": {"value": "0", "desc": "---"}}
721-
# HC3 status - inactive (value=0, desc=---)
722-
if param_id == "8002":
723-
return {"8002": {"value": "0", "desc": "---"}}
724629
return {}
725630

726631
bsblan._request = AsyncMock(side_effect=mock_request) # type: ignore[method-assign]
@@ -736,7 +641,7 @@ async def test_get_available_circuits_inactive_empty_status(
736641
"""Test that circuits with empty status response are inactive.
737642
738643
Some controllers return an empty dict for status params of circuits
739-
that don't exist (e.g., HC3 status 8002 returns {}).
644+
that don't exist (e.g., HC2 status 8001 returns {}).
740645
"""
741646
bsblan = mock_bsblan_circuit
742647

@@ -746,7 +651,7 @@ async def mock_request(
746651
params = kwargs.get("params", {})
747652
param_id = params.get("Parameter", "")
748653
# All circuits return valid operating mode
749-
if param_id in {"700", "1000", "1300"}:
654+
if param_id in {"700", "1000"}:
750655
return {param_id: {"value": "1", "unit": "", "desc": "Automatic"}}
751656
# HC1 status - active
752657
if param_id == "8000":
@@ -756,11 +661,8 @@ async def mock_request(
756661
"desc": "Heating mode Comfort",
757662
}
758663
}
759-
# HC2 status - inactive (value=0, desc=---)
664+
# HC2 status - empty response (param not supported)
760665
if param_id == "8001":
761-
return {"8001": {"value": "0", "desc": "---"}}
762-
# HC3 status - empty response (param not supported)
763-
if param_id == "8002":
764666
return {}
765667
return {}
766668

@@ -795,7 +697,7 @@ async def mock_request(
795697
"desc": "Heating mode Comfort",
796698
}
797699
}
798-
# HC2 and HC3 fail with connection error
700+
# HC2 fail with connection error
799701
msg = "Connection failed"
800702
raise BSBLANError(msg)
801703

@@ -857,8 +759,8 @@ async def mock_request(
857759
if param_id == "8000":
858760
msg = "Connection failed"
859761
raise BSBLANError(msg)
860-
# HC2/HC3 return empty
861-
if param_id in {"1000", "1300"}:
762+
# HC2 return empty
763+
if param_id == "1000":
862764
return {param_id: {}}
863765
return {}
864766

tests/test_constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ def test_api_config_structure(version: str) -> None:
153153
"sensor",
154154
"hot_water",
155155
"heating_circuit2",
156-
"heating_circuit3",
157156
"staticValues_circuit2",
158-
"staticValues_circuit3",
159157
}
160158
assert set(config.keys()) == required_sections
161159

tests/test_hotwater_state.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ async def test_hot_water_state(
4343
if k not in ["561", "562", "563", "564", "565", "566", "567", "576"]
4444
},
4545
"heating_circuit2": API_V3["heating_circuit2"].copy(),
46-
"heating_circuit3": API_V3["heating_circuit3"].copy(),
4746
"staticValues_circuit2": API_V3["staticValues_circuit2"].copy(),
48-
"staticValues_circuit3": API_V3["staticValues_circuit3"].copy(),
4947
}
5048

5149
monkeypatch.setattr(bsblan, "_api_data", test_api_v3)

tests/test_initialization.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ async def test_initialize_api_validator() -> None:
213213
"device": {},
214214
"hot_water": {},
215215
"heating_circuit2": {},
216-
"heating_circuit3": {},
217216
"staticValues_circuit2": {},
218-
"staticValues_circuit3": {},
219217
}
220218

221219
# Create a coroutine mock for _validate_api_section that returns response data

0 commit comments

Comments
 (0)