File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 186186 "outdoor_temperature" : DATA ("outdoor_air_temperature" , TEMP_CELSIUS ),
187187}
188188
189+ OBSOLETE_MEASUREMENTS : Final [tuple [str , ...]] = (
190+ "central_heater_water_pressure" ,
191+ "outdoor_air_temperature" ,
192+ )
193+
189194# Known types of Smiles and Stretches
190195SMILE = namedtuple ("SMILE" , "smile_type smile_name" )
191196SMILES : Final [dict [str , SMILE ]] = {
Original file line number Diff line number Diff line change 4040 LOCATIONS ,
4141 LOGGER ,
4242 NONE ,
43+ OBSOLETE_MEASUREMENTS ,
4344 P1_LEGACY_MEASUREMENTS ,
4445 P1_MEASUREMENTS ,
4546 POWER_WATT ,
@@ -842,13 +843,16 @@ def _appliance_measurements(
842843 if self ._smile_legacy and measurement == "domestic_hot_water_state" :
843844 continue
844845
845- # Fix for Adam + Anna: there is a pressure-measurement with an unrealistic value,
846- # this measurement appears at power-on and is never updated, therefore remove.
847- if (
848- measurement == "central_heater_water_pressure"
849- and float (appl_p_loc .text ) > 3.5
850- ):
851- continue
846+ # Skip known obsolete measurements
847+ updated_date_locator = f'.//logs/point_log[type="{ measurement } "]/updated_date'
848+ if (updated_date_key := appliance .find (updated_date_locator ) is not None :
849+ if measurement in OBSOLETE_MEASUREMENTS :
850+ updated_date = updated_date_key .text .strip ("T" )
851+ t1 = dt .strptime (updated_date , "%Y-%m-%d" )
852+ t2 = dt .datetime .now ().strftime ("%Y-%m-%d" )
853+ difference = (t2 - t1 ).days
854+ if difference > 30 :
855+ continue
852856
853857 if new_name := getattr (attrs , ATTR_NAME , None ):
854858 measurement = new_name
You can’t perform that action at this time.
0 commit comments