File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -842,7 +842,7 @@ def get_power_data_from_location(self, loc_id):
842842 peak_list = ["nl_peak" , "nl_offpeak" ]
843843
844844 # meter_string = ".//{}[type='{}']/"
845- for measurement in HOME_MEASUREMENTS :
845+ for measurement , attrs in HOME_MEASUREMENTS . items () :
846846 for log_type in log_list :
847847 for peak_select in peak_list :
848848 locator = (
@@ -869,7 +869,13 @@ def get_power_data_from_location(self, loc_id):
869869 key_string = f"{ measurement } _{ peak } _{ log_found } "
870870 net_string = f"net_electricity_{ log_found } "
871871 val = loc_logs .find (locator ).text
872- f_val = format_measure (val , None )
872+ if all (
873+ item in key_string
874+ for item in ['electricity' , 'cumulative' ]
875+ ):
876+ f_val = format_measure (val , ENERGY_KILO_WATT_HOUR )
877+ else :
878+ f_val = format_measure (val , attrs [ATTR_UNIT_OF_MEASUREMENT ])
873879 if "gas" in measurement :
874880 key_string = f"{ measurement } _{ log_found } "
875881 f_val = float (f"{ round (float (val ), 3 ):.3f} " )
You can’t perform that action at this time.
0 commit comments