diff --git a/custom_components/sensus_analytics/config_flow.py b/custom_components/sensus_analytics/config_flow.py index 4cc47cf..d8debcf 100644 --- a/custom_components/sensus_analytics/config_flow.py +++ b/custom_components/sensus_analytics/config_flow.py @@ -100,6 +100,9 @@ async def async_step_init(self, user_input=None) -> FlowResult: _LOGGER.debug("User updated options: %s", user_input) # Update the entry with new options self.hass.config_entries.async_update_entry(self.config_entry, data=user_input) + # Force a sensor refresh + coordinator = self.hass.data[DOMAIN][self.config_entry.entry_id] + await coordinator.async_request_refresh() return self.async_create_entry(title="", data={}) # Fetch current configuration data diff --git a/custom_components/sensus_analytics/manifest.json b/custom_components/sensus_analytics/manifest.json index 8e0c1ff..7fb8f8a 100644 --- a/custom_components/sensus_analytics/manifest.json +++ b/custom_components/sensus_analytics/manifest.json @@ -1,7 +1,7 @@ { "domain": "sensus_analytics", "name": "Sensus Analytics Integration", - "version": "1.6.8", + "version": "1.6.9", "documentation": "https://github.com/zestysoft/sensus_analytics_integration", "dependencies": [], "codeowners": ["@zestysoft"], diff --git a/custom_components/sensus_analytics/sensor.py b/custom_components/sensus_analytics/sensor.py index 5d4fe44..c408aa5 100644 --- a/custom_components/sensus_analytics/sensor.py +++ b/custom_components/sensus_analytics/sensor.py @@ -48,7 +48,7 @@ def _convert_usage(self, usage, usage_unit=None): return None if usage_unit is None: usage_unit = self.coordinator.data.get("usageUnit") - if usage_unit == "CF" and self.coordinator.config_entry.data.get("unit_type") == "G": + if usage_unit == "CCF" and self.coordinator.config_entry.data.get("unit_type") == "gal": try: return round(float(usage) * CF_TO_GALLON) except (ValueError, TypeError): @@ -75,8 +75,8 @@ def __init__(self, coordinator, entry): def _get_usage_unit(self): """Determine the unit of measurement for usage sensors.""" usage_unit = self.coordinator.data.get("usageUnit") - if usage_unit == "CF" and self.coordinator.config_entry.data.get("unit_type") == "G": - return "G" + if usage_unit == "CCF" and self.coordinator.config_entry.data.get("unit_type") == "gal": + return "gal" return usage_unit @property