added heating and hot water consumption per property to db

This commit is contained in:
Khalim Conn-Kowlessar 2024-08-13 18:28:38 +01:00
parent 89241f9ae3
commit 1e16babab3
2 changed files with 8 additions and 29 deletions

View file

@ -174,7 +174,7 @@ class Property:
self.solar_pv_percentage = None
self.current_energy_consumption = None
self.expected_adjusted_energy = None
self.current_energy_consumption_heating_hotwater = None
self.current_energy_bill = None
self.expected_energy_bill = None
@ -724,13 +724,6 @@ class Property:
"appliances": float(appliances_kwh)
}
adjusted_kwh_estimates = {
k: AnnualBillSavings.adjust_energy_to_metered(
epc_energy=v,
current_epc_rating=self.data["current-energy-rating"],
) for k, v in unadjusted_kwh_estimates.items()
}
unadjusted_heating_costs = {
"heating": None,
"hot_water": None,
@ -738,18 +731,13 @@ class Property:
"appliances": float(appliances_kwh) * AnnualBillSavings.ELECTRICITY_PRICE_CAP
}
adjusted_heating_costs = {
k: AnnualBillSavings.adjust_energy_to_metered(
epc_energy=v,
current_epc_rating=self.data["current-energy-rating"],
) for k, v in unadjusted_heating_costs.items() if v is not None
}
# Sum up the adjusted kwh figures
self.current_energy_consumption = sum(list(unadjusted_kwh_estimates.values()))
self.current_energy_consumption_heating_hotwater = (
unadjusted_kwh_estimates["heating"] + unadjusted_kwh_estimates["hot_water"]
)
self.energy_cost_estimates = {
# "adjusted": adjusted_heating_costs,
"unadjusted": unadjusted_heating_costs,
"epc": {
"heating": float(self.data["heating-cost-current"]),
@ -759,7 +747,6 @@ class Property:
}
self.energy_consumption_estimates = {
# "adjusted": adjusted_kwh_estimates,
"unadjusted": unadjusted_kwh_estimates
}
@ -899,7 +886,8 @@ class Property:
"energy_tariff": self.data["energy-tariff"],
"primary_energy_consumption": self.energy["primary_energy_consumption"],
"co2_emissions": self.energy["co2_emissions"],
# "adjusted_energy_consumption": self.current_adjusted_energy,
"current_energy_demand": self.current_energy_consumption,
"current_energy_demand_heating_hotwater": self.current_energy_consumption_heating_hotwater,
"estimated": self.data.get("estimated", False),
}
@ -1097,16 +1085,6 @@ class Property:
return component_data
def set_adjusted_energy(
self, expected_adjusted_energy, expected_energy_bill
):
"""
Stores these values for usage later
"""
self.expected_adjusted_energy = expected_adjusted_energy
self.expected_energy_bill = expected_energy_bill
def set_windows_count(self):
"""
Using the estimate_windows function, this method will set the number of windows in the property

View file

@ -168,7 +168,8 @@ class PropertyDetailsEpcModel(Base):
energy_tariff = Column(Text)
primary_energy_consumption = Column(Float)
co2_emissions = Column(Float)
adjusted_energy_consumption = Column(Float)
current_energy_demand = Column(Float)
current_energy_demand_heating_hotwater = Column(Float)
estimated = Column(Boolean, default=False)