Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pour issue #442 #443

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom_components/hilo/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
# Note ic-dev21: we'll stay at 300 until proper fix
EVENT_SCAN_INTERVAL_REDUCTION = 300
NOTIFICATION_SCAN_INTERVAL = 1800
MAX_SUB_INTERVAL = 120
MIN_SCAN_INTERVAL = 60
REWARD_SCAN_INTERVAL = 7200

Expand Down
2 changes: 1 addition & 1 deletion custom_components/hilo/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"iot_class": "cloud_push",
"issue_tracker": "https://github.com/dvd-dev/hilo/issues",
"requirements": ["python-hilo>=2024.6.1"],
"version": "2024.6.2"
"version": "2024.7.1"
}
36 changes: 26 additions & 10 deletions custom_components/hilo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
UnitOfPower,
UnitOfSoundPressure,
UnitOfTemperature,
__short_version__ as current_version,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceInfo
Expand All @@ -32,6 +33,7 @@
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.util import Throttle, slugify
import homeassistant.util.dt as dt_util
from packaging.version import Version
from pyhilo.const import UNMONITORED_DEVICES
from pyhilo.device import HiloDevice
from pyhilo.event import Event
Expand All @@ -55,6 +57,7 @@
HILO_ENERGY_TOTAL,
HILO_SENSOR_CLASSES,
LOG,
MAX_SUB_INTERVAL,
NOTIFICATION_SCAN_INTERVAL,
REWARD_SCAN_INTERVAL,
TARIFF_LIST,
Expand Down Expand Up @@ -292,16 +295,29 @@ def __init__(self, hilo, device):
identifiers={(DOMAIN, self._device.identifier)},
)

super().__init__(
integration_method=METHOD_LEFT,
name=self._attr_name,
round_digits=2,
source_entity=self._source,
unique_id=self._attr_unique_id,
unit_prefix="k",
unit_time="h",
device_info=self._device_info,
)
if Version(current_version) >= Version("2024.7"):
super().__init__(
integration_method=METHOD_LEFT,
max_sub_interval=timedelta(seconds=MAX_SUB_INTERVAL),
name=self._attr_name,
round_digits=2,
source_entity=self._source,
unique_id=self._attr_unique_id,
unit_prefix="k",
unit_time="h",
device_info=self._device_info,
)
else:
super().__init__(
integration_method=METHOD_LEFT,
name=self._attr_name,
round_digits=2,
source_entity=self._source,
unique_id=self._attr_unique_id,
unit_prefix="k",
unit_time="h",
device_info=self._device_info,
)
self._unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR
self._suggested_display_precision = 2

Expand Down