Skip to content

Commit

Permalink
bump ruffs - more attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Aug 26, 2024
1 parent 8f39667 commit 2beab8f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Integration that will calculate watering zone runtime given:

Calculations as follows:

'''
delta = rain over period - calculated ETO requirement
if delta < 0 then
# Watering required
Expand All @@ -18,4 +19,4 @@ if delta < 0 then
runtime = max zone run time * 60
else
runtime = 0

'''
2 changes: 2 additions & 0 deletions custom_components/eto_smart_zone/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from custom_components.eto_smart_zone.const import (
ATTR_ETO,
ATTR_RAIN,
ATTR_RAW_RUNTIME,
CALC_RUNTIME,
CONF_MAX_MINS,
CONF_SCALE,
Expand Down Expand Up @@ -154,6 +155,7 @@ async def calc_smart_zone(self) -> None:
reqd: float = abs(delta) / self._throughput * 60 * 60
self._calc_data[CALC_RUNTIME] = round(reqd * self._scale / 100)
_LOGGER.debug("raw runtime %s", self._calc_data[CALC_RUNTIME])
self._calc_data[ATTR_RAW_RUNTIME] = self._calc_data[CALC_RUNTIME]
if self._calc_data[CALC_RUNTIME] > (self._max_mins * 60):
# make sure not longer than max run time
self._calc_data[CALC_RUNTIME] = self._max_mins * 60
Expand Down
1 change: 1 addition & 0 deletions custom_components/eto_smart_zone/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@

ATTR_ETO = "eto"
ATTR_RAIN = "rain"
ATTR_RAW_RUNTIME = "raw_runtime"
CALC_RUNTIME = "runtime"
2 changes: 1 addition & 1 deletion custom_components/eto_smart_zone/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/dpktjf/eto-smart-zone/issues",
"requirements": [],
"version": "2024.8.6"
"version": "2024.8.7"
}
2 changes: 2 additions & 0 deletions custom_components/eto_smart_zone/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from custom_components.eto_smart_zone.const import (
ATTR_ETO,
ATTR_RAIN,
ATTR_RAW_RUNTIME,
ATTRIBUTION,
CALC_RUNTIME,
CONF_MAX_MINS,
Expand Down Expand Up @@ -130,6 +131,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
CONF_THROUGHPUT_MM_H
]
attributes[CONF_SCALE] = self._coordinator.data[CONF_SCALE]
attributes[ATTR_RAW_RUNTIME] = self._coordinator.data[ATTR_RAW_RUNTIME]
attributes[CONF_MAX_MINS] = self._coordinator.data[CONF_MAX_MINS]
except ETOApiSmartZoneError as ex:
_LOGGER.exception(ex) # noqa: TRY401
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
colorlog==6.8.2
homeassistant==2024.8.2
pip==24.2
ruff==0.6.1
ruff==0.6.2

0 comments on commit 2beab8f

Please sign in to comment.