Load HeatingAndHotWater from SiteNotes JSON 🟥

This commit is contained in:
Daniel Roth 2026-04-16 14:19:01 +00:00
parent cf0a9a6326
commit 29f9a664a5
2 changed files with 79 additions and 0 deletions

View file

@ -10,11 +10,15 @@ from datatypes.epc.surveys.pashub_rdsap_site_notes import (
FloorConstruction,
FloorMeasurement,
General,
HeatingAndHotWater,
MainBuildingConstruction,
MainBuildingMeasurements,
MainHeating,
PasHubRdSapSiteNotes,
RoofSpace,
RoofSpaceDetail,
SecondaryHeating,
WaterHeating,
Window,
)
@ -278,6 +282,9 @@ class PasHubRdSapSiteNotesExtractor:
return windows
def extract_heating_and_hot_water(self) -> HeatingAndHotWater:
raise NotImplementedError
def _parse_window(self, window_id: int, data: List[str]) -> Window:
height_raw = self._get_in(data, "Window height:")
width_raw = self._get_in(data, "Window width:")

View file

@ -13,11 +13,15 @@ from datatypes.epc.surveys.pashub_rdsap_site_notes import (
FloorConstruction,
FloorMeasurement,
General,
HeatingAndHotWater,
MainBuildingConstruction,
MainBuildingMeasurements,
MainHeating,
PasHubRdSapSiteNotes,
RoofSpace,
RoofSpaceDetail,
SecondaryHeating,
WaterHeating,
)
FIXTURES = os.path.join(os.path.dirname(__file__), "fixtures")
@ -336,3 +340,71 @@ class TestWindows:
width_m=2.3,
orientation="North West",
)
class TestHeatingAndHotWater:
@pytest.fixture
def hhw(self) -> HeatingAndHotWater:
return PasHubRdSapSiteNotesExtractor(
load_text_fixture()
).extract_heating_and_hot_water()
def test_product_id_parses_to_int(self, hhw: HeatingAndHotWater) -> None:
assert hhw.main_heating.product_id == 16839
def test_summer_efficiency_parses_to_float(self, hhw: HeatingAndHotWater) -> None:
assert hhw.main_heating.summer_efficiency == 0.0
def test_condensing_true(self, hhw: HeatingAndHotWater) -> None:
assert hhw.main_heating.condensing is True
def test_fghrs_false(self, hhw: HeatingAndHotWater) -> None:
# multi-line label
assert hhw.main_heating.flue_gas_heat_recovery_system is False
def test_secondary_fuel(self, hhw: HeatingAndHotWater) -> None:
assert hhw.secondary_heating.secondary_fuel == "No Secondary Heating"
def test_water_heating_no_cylinder(self, hhw: HeatingAndHotWater) -> None:
assert hhw.water_heating.cylinder_size == "No Cylinder"
assert hhw.water_heating.insulation_type is None
assert hhw.water_heating.has_thermostat is None
def test_full_heating_and_hot_water(self, hhw: HeatingAndHotWater) -> None:
assert hhw == HeatingAndHotWater(
main_heating=MainHeating(
selection_method="PCDF Search",
system_type="Boiler with radiators or underfloor heating",
product_id=16839,
manufacturer="Vaillant",
model="ecoTEC pro 28",
orig_manufacturer="Vaillant",
fuel="Mains gas",
summer_efficiency=0.0,
type="Combi",
condensing=True,
year="2005 - 2015",
mount="Wall",
open_flue="Room-sealed",
fan_assist=True,
status="Normal status for an actual product",
central_heating_pump_age="Unknown",
controls="Programmer, room thermostat and TRVs",
flue_gas_heat_recovery_system=False,
weather_compensator=False,
emitter="Radiators",
emitter_temperature="Unknown",
),
secondary_heating=SecondaryHeating(
secondary_fuel="No Secondary Heating",
),
water_heating=WaterHeating(
type="Regular",
system="From main heating 1",
cylinder_size="No Cylinder",
cylinder_measured_heat_loss=None,
insulation_type=None,
insulation_thickness_mm=None,
has_thermostat=None,
),
)