-
-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Rachio update #7922
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
Rachio update #7922
Changes from 17 commits
2d78019
461b8a5
8bd8590
f5040cf
c398b66
d2f7370
0e443bd
78540d3
8a9be6e
f3e4b69
0777cb3
f001724
e2708b8
a33bcdf
a79f1d4
4dc4a98
7ebf36b
e9f273e
b12b7b4
a19d838
85fbec6
68eafc3
cbbb15f
5c96936
5504a51
bb6fe82
b87e316
d38acfb
36eb0ce
4dbf7be
7e668ef
7906105
8a4e993
482db94
97f62cf
9bea7d7
727a22f
620197b
1e352d3
0863d50
055db05
aaaf963
c52b18d
4b767b0
a8709a6
533bb55
3464454
bfd9623
e4d100d
372169a
24a1721
c328078
a223efb
8cc759e
c2b7c93
4aef0b6
640c692
db0efc6
49d6427
a19e7ba
f2feabc
ba80d5e
b9ee5fb
1f226cf
1b1619f
9e16be3
314bce1
de0f6b7
e7de1fb
1c06b51
401309c
6e33c12
03f916e
dc45ed3
bde711a
1e1d4c2
2bf7811
843f8ce
7fae8cd
9189cbd
09fec29
bfe7490
2cf770c
ddf5f52
781d9a1
fb6230c
e979bbd
ea0b5e8
72454ef
86ce002
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,8 @@ | |
| from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA | ||
| from homeassistant.const import CONF_ACCESS_TOKEN | ||
|
|
||
| REQUIREMENTS = ['https://github.com/Klikini/rachiopy' | ||
| '/archive/2c8996fcfa97a9f361a789e0c998797ed2805281.zip' | ||
| REQUIREMENTS = ['https://github.com/rfverbruggen/rachiopy' | ||
| '/archive/989bd28ef5353be62e0eabb93b3339f74bc7ee44.zip' | ||
| '#rachiopy==0.1.1'] | ||
|
|
||
| _LOGGER = logging.getLogger(__name__) | ||
|
|
@@ -19,7 +19,7 @@ | |
| CONF_MANUAL_RUN_MINS = 'manual_run_mins' | ||
| DEFAULT_MANUAL_RUN_MINS = 10 | ||
|
|
||
| MIN_UPDATE_INTERVAL = timedelta(minutes=5) | ||
| MIN_UPDATE_INTERVAL = timedelta(seconds=5) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rachio offers an API for free but hitting it every 5 seconds is going to get us banned.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @balloob, I've been running mine with a 30 second interval and it seems to have the same desired effect, in that regardless of 5 or 30 seconds it updates the correct state on the frontend after about 30 seconds have passed. Do you think leaving timedelta at 30 seconds would be acceptable to not overload the API? |
||
| MIN_FORCED_UPDATE_INTERVAL = timedelta(seconds=1) | ||
|
|
||
| PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ | ||
|
|
@@ -30,6 +30,7 @@ | |
|
|
||
|
|
||
| # noinspection PyUnusedLocal | ||
| # noinspection PyUnresolvedLocal | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove these warnings. They are not part of linters that the project uses.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this comment. |
||
| def setup_platform(hass, config, add_devices, discovery_info=None): | ||
| """Set up the component.""" | ||
| # Get options | ||
|
|
@@ -143,6 +144,7 @@ def list_zones(self, include_disabled=False): | |
| self.update(no_throttle=True) | ||
| return [z for z in self._zones if z.is_enabled] | ||
|
|
||
| # noinspection PyUnusedLocal | ||
| @util.Throttle(MIN_UPDATE_INTERVAL, MIN_FORCED_UPDATE_INTERVAL) | ||
| def update(self, **kwargs): | ||
| """Pull updated device info from the Rachio API.""" | ||
|
|
@@ -217,14 +219,11 @@ def update(self): | |
|
|
||
| def turn_on(self): | ||
| """Start the zone.""" | ||
| # Convert minutes to seconds | ||
| seconds = self._manual_run_secs * 60 | ||
|
|
||
| # Stop other zones first | ||
| self.turn_off() | ||
|
|
||
| _LOGGER.info("Watering %s for %d sec", self.name, seconds) | ||
| self.rachio.zone.start(self.zone_id, seconds) | ||
| _LOGGER.info("Watering %s for %d s", self.name, self._manual_run_secs) | ||
| self.rachio.zone.start(self.zone_id, self._manual_run_secs) | ||
|
|
||
| def turn_off(self): | ||
| """Stop all zones.""" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Klikini I saw that you created this beautiful rachio component for home-assistant. If you need changes or help with the rachiopy library you can always send me a message!
I saw some messages to make the rachiopy component a pypi package, I'll look into that for you!Rachiopy is now a pypi package: https://pypi.python.org/pypi/RachioPy/0.1.1I use Home-Assistant myself for my home automation so I'm happy to see this implemented with my own API wrapper I once wrote.