Skip to content

Commit 2955304

Browse files
committed
Use different unit names
Signed-off-by: Ian Brown <[email protected]>
1 parent ff75b03 commit 2955304

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

custom_components/sensus_analytics/config_flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def async_step_user(self, user_input=None) -> FlowResult:
5050
vol.Required(CONF_PASSWORD): str,
5151
vol.Required(CONF_ACCOUNT_NUMBER): str,
5252
vol.Required(CONF_METER_NUMBER): str,
53-
vol.Required("unit_type", default="CF"): vol.In(["CF", "G"]),
53+
vol.Required("unit_type", default="CCF"): vol.In(["CCF", "gal"]),
5454
vol.Optional("tier1_gallons"): cv.positive_float,
5555
vol.Required("tier1_price", default=0.0128): cv.positive_float,
5656
vol.Optional("tier2_gallons"): cv.positive_float,
@@ -129,8 +129,8 @@ async def async_step_init(self, user_input=None) -> FlowResult:
129129
): str,
130130
vol.Required(
131131
"unit_type",
132-
default=current_data.get("unit_type", "CF"),
133-
): vol.In(["CF", "G"]),
132+
default=current_data.get("unit_type", "CCF"),
133+
): vol.In(["CCF", "gal"]),
134134
vol.Optional(
135135
"tier1_gallons",
136136
default=current_data.get("tier1_gallons"),

custom_components/sensus_analytics/coordinator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import logging
44
from datetime import datetime, timedelta
5-
from urllib.parse import urljoin # Import urljoin
5+
from urllib.parse import urljoin
66

77
import requests
88
from homeassistant.core import HomeAssistant
99
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
10-
from homeassistant.util import dt as dt_util # Import HA's datetime utilities
10+
from homeassistant.util import dt as dt_util
1111

1212
from .const import CONF_ACCOUNT_NUMBER, CONF_BASE_URL, CONF_METER_NUMBER, CONF_PASSWORD, CONF_USERNAME, DOMAIN
1313

@@ -119,7 +119,7 @@ def _retrieve_hourly_data(self, session: requests.Session, target_date: datetime
119119

120120
try:
121121
response = session.get(usage_url, params=params, timeout=10)
122-
response.raise_for_status() # Ensure the request was successful
122+
response.raise_for_status()
123123
hourly_data = response.json()
124124
_LOGGER.debug("Hourly data response: %s", hourly_data)
125125

@@ -177,7 +177,7 @@ def _process_hourly_data_response(self, hourly_data):
177177
return None
178178

179179
# The first element contains units
180-
units = usage_list[0] # ["CF", "INCHES", "FAHRENHEIT", "CF"]
180+
units = usage_list[0] # ["CCF", "INCHES", "FAHRENHEIT", "gal"]
181181
usage_unit = units[0]
182182
rain_unit = units[1]
183183
temp_unit = units[2]

custom_components/sensus_analytics/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "sensus_analytics",
33
"name": "Sensus Analytics Integration",
4-
"version": "1.6.7",
4+
"version": "1.6.8",
55
"documentation": "https://github.com/zestysoft/sensus_analytics_integration",
66
"dependencies": [],
77
"codeowners": ["@zestysoft"],

custom_components/sensus_analytics/sensor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(self, coordinator, entry):
115115
self._attr_name = f"{DEFAULT_NAME} Daily Usage"
116116
self._attr_unique_id = f"{self._unique_id}_daily_usage"
117117
self._attr_icon = "mdi:water"
118-
self._attr_device_class = SensorDeviceClass.WATER # Set device class to water
118+
self._attr_device_class = SensorDeviceClass.WATER
119119

120120
@property
121121
def native_value(self):
@@ -240,7 +240,7 @@ def __init__(self, coordinator, entry):
240240
self._attr_name = f"{DEFAULT_NAME} Meter Odometer"
241241
self._attr_unique_id = f"{self._unique_id}_meter_odometer"
242242
self._attr_icon = "mdi:water"
243-
self._attr_device_class = SensorDeviceClass.WATER # Set device class to water
243+
self._attr_device_class = SensorDeviceClass.WATER
244244

245245
@property
246246
def native_value(self):
@@ -258,7 +258,7 @@ def __init__(self, coordinator, entry):
258258
self._attr_name = f"{DEFAULT_NAME} Billing Usage"
259259
self._attr_unique_id = f"{self._unique_id}_billing_usage"
260260
self._attr_icon = "mdi:water"
261-
self._attr_device_class = SensorDeviceClass.WATER # Set device class to water
261+
self._attr_device_class = SensorDeviceClass.WATER
262262

263263
@property
264264
def native_value(self):
@@ -385,7 +385,7 @@ def __init__(self, coordinator, entry):
385385
self._attr_name = f"{DEFAULT_NAME} Last Hour Usage"
386386
self._attr_unique_id = f"{self._unique_id}_last_hour_usage"
387387
self._attr_icon = "mdi:water"
388-
self._attr_device_class = SensorDeviceClass.WATER # Set device class to water
388+
self._attr_device_class = SensorDeviceClass.WATER
389389

390390
@property
391391
def native_value(self):

custom_components/sensus_analytics/strings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"password": "Password",
1111
"account_number": "Account Number",
1212
"meter_number": "Meter Number",
13-
"unit_type": "Unit Type (CF or G)",
13+
"unit_type": "Unit Type (CCF or gal)",
1414
"tier1_gallons": "Tier 1 Gallons",
1515
"tier1_price": "Tier 1 Price",
1616
"tier2_gallons": "Tier 2 Gallons",
@@ -37,7 +37,7 @@
3737
"password": "Password",
3838
"account_number": "Account Number",
3939
"meter_number": "Meter Number",
40-
"unit_type": "Unit Type (CF or G)",
40+
"unit_type": "Unit Type (CCF or gal)",
4141
"tier1_gallons": "Tier 1 Gallons",
4242
"tier1_price": "Tier 1 Price",
4343
"tier2_gallons": "Tier 2 Gallons",

0 commit comments

Comments
 (0)