File tree Expand file tree Collapse file tree 4 files changed +79
-54
lines changed
Expand file tree Collapse file tree 4 files changed +79
-54
lines changed Original file line number Diff line number Diff line change 22
33## Ongoing
44
5+ - Improve handling of obsolete sensors (solution for [ HA Core issue #100306 ] ( https://github.com/home-assistant/core/issues/100306 )
56- Improve handling of invalid actuator xml-data (partial solution for [ HA Core issue #99372 ] ( https://github.com/home-assistant/core/issues/99372 )
67
78## v0.32.3 Improve quality by extended testing, bugfix
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,19 @@ 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 = (
848+ f'.//logs/point_log[type="{ measurement } "]/updated_date'
849+ )
850+ if measurement in OBSOLETE_MEASUREMENTS :
851+ if (
852+ updated_date_key := appliance .find (updated_date_locator )
853+ ) is not None :
854+ updated_date = updated_date_key .text .split ("T" )[0 ]
855+ date_1 = dt .datetime .strptime (updated_date , "%Y-%m-%d" )
856+ date_2 = dt .datetime .now ()
857+ if int ((date_2 - date_1 ).days ) > 7 :
858+ continue
852859
853860 if new_name := getattr (attrs , ATTR_NAME , None ):
854861 measurement = new_name
You can’t perform that action at this time.
0 commit comments