Skip to content

Commit

Permalink
Merge pull request #39 from sh00t2kill/change-start-watering-service-…
Browse files Browse the repository at this point in the history
…to-seconds

Change start watering service to seconds
  • Loading branch information
sh00t2kill authored Mar 4, 2024
2 parents 6086600 + 3da89eb commit bb543a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions custom_components/linktap/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ pause_valve:
domain: valve

start_watering:
name: Start Watering
name: Start Watering for X seconds
description: Turn on a valve for a set time
fields:
minutes:
name: Minutes
example: 1439
description: Duration in minutes
seconds:
name: Seconds
example: 900
description: Duration in seconds
target:
entity:
integration: linktap
Expand Down
10 changes: 5 additions & 5 deletions custom_components/linktap/valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ async def _pause_tap(self, hours=False):
await self.coordinator.tap_api.pause_tap(gw_id, self.tap_id, hours)
await self.coordinator.async_request_refresh()

async def _start_watering(self, minutes=False):
if not minutes or minutes == 0:
minutes = 1439
_LOGGER.debug(f"Starting watering via service call for {minutes} minutes")
async def _start_watering(self, seconds=False):
if not seconds or seconds == 0:
seconds = 1439 * 60
_LOGGER.debug(f"Starting watering via service call for {seconds} seconds")
gw_id = self.coordinator.get_gw_id()
await self.coordinator.tap_api.turn_on(gw_id, self.tap_id, minutes)
await self.coordinator.tap_api.turn_on(gw_id, self.tap_id, seconds)
await self.coordinator.async_request_refresh()

0 comments on commit bb543a0

Please sign in to comment.