Skip to content

Commit bbcd619

Browse files
committed
Pass through native unit in lowercase if gal is chosen in config and native unit is GAL
Signed-off-by: Ian Brown <[email protected]>
1 parent 9d98143 commit bbcd619

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

custom_components/sensus_analytics/sensor.py

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def _convert_usage(self, usage, usage_unit=None):
6161
return round(float(usage) / CF_TO_GALLON)
6262
except (ValueError, TypeError):
6363
return None
64+
elif usage_unit == "GAL" and config_unit_type == "gal":
65+
return usage
6466
return usage
6567

6668
def _get_usage_unit(self):
@@ -72,6 +74,8 @@ def _get_usage_unit(self):
7274
return "gal"
7375
elif usage_unit == "GAL" and config_unit_type == "CF":
7476
return "CF"
77+
elif usage_unit == "GAL" and config_unit_type == "gal":
78+
return "gal"
7579
return usage_unit
7680

7781

0 commit comments

Comments
 (0)