Skip to content

Commit

Permalink
2024.4.4 fixes #350
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenterheerdt committed Apr 24, 2024
1 parent 63605ea commit bd70151
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
27 changes: 15 additions & 12 deletions custom_components/smart_irrigation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,19 +947,21 @@ def calculate_module(self, zone, weatherdata, forecastdata):
"module.calculation.explanation.duration-after-maximum-duration-is",
self.hass.config.language,
) + " {}</li>".format(round(duration))
duration = round(zone.get(const.ZONE_LEAD_TIME) + duration)
explanation += (
"<li>"
+ localize(
"module.calculation.explanation.lead-time-is-applied",
self.hass.config.language,
# add the lead time but only if duration is > 0 at this point
if duration > 0.0:
duration = round(zone.get(const.ZONE_LEAD_TIME) + duration)
explanation += (
"<li>"
+ localize(
"module.calculation.explanation.lead-time-is-applied",
self.hass.config.language,
)
+ " {}, ".format(zone.get(const.ZONE_LEAD_TIME))
)
+ " {}, ".format(zone.get(const.ZONE_LEAD_TIME))
)
explanation += localize(
"module.calculation.explanation.duration-after-lead-time-is",
self.hass.config.language,
) + " {}</li></ol>".format(duration)
explanation += localize(
"module.calculation.explanation.duration-after-lead-time-is",
self.hass.config.language,
) + " {}</li></ol>".format(duration)
else:
# no need to irrigate, set duration to 0
duration = 0
Expand Down Expand Up @@ -1312,6 +1314,7 @@ async def async_update_zone_config(self, zone_id: int = None, data: dict = {}):
new_bucket_value = res[const.ZONE_MAXIMUM_BUCKET]
data[const.ZONE_BUCKET] = new_bucket_value
data.pop(const.ATTR_SET_BUCKET)

self.store.async_update_zone(zone_id, data)
async_dispatcher_send(self.hass, const.DOMAIN + "_config_updated", zone_id)
elif const.ATTR_RESET_ALL_BUCKETS in data:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/smart_irrigation/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Store constants."""


VERSION = "v2024.4.3"
VERSION = "v2024.4.4"
NAME = "Smart Irrigation"
MANUFACTURER = "@jeroenterheerdt"

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion custom_components/smart_irrigation/frontend/src/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const VERSION = "v2024.4.3";
export const VERSION = "v2024.4.4";
export const REPO = "https://github.com/jeroenterheerdt/HASmartIrrigation;";
export const ISSUES_URL = REPO + "/issues";

Expand Down
2 changes: 1 addition & 1 deletion custom_components/smart_irrigation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/jeroenterheerdt/HASmartIrrigation/issues",
"requirements": [],
"version": "v2024.4.3"
"version": "v2024.4.4"
}
1 change: 1 addition & 0 deletions custom_components/smart_irrigation/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ def async_update_zone(self, zone_id: int, changes: dict) -> ZoneEntry:
# apply maximum bucket value
if (
ZONE_MAXIMUM_BUCKET in changes
and changes[ZONE_BUCKET] is not None
and changes[ZONE_BUCKET] > changes[ZONE_MAXIMUM_BUCKET]
):
changes[ZONE_BUCKET] = changes[ZONE_MAXIMUM_BUCKET]
Expand Down

0 comments on commit bd70151

Please sign in to comment.