sh00t2kill / linktap_local_http_component

A Custom Component that uses the linktap local HTTP API
26 stars 3 forks source link

Batch watering #17

Closed sentience closed 3 months ago

sentience commented 8 months ago

Although I agree that managing Linktap schedules via Home Assistant, I'd like to be able to start/stop batch watering programs that I've configured in the Linktap app from Home Assistant. Is that available via the API?

sh00t2kill commented 8 months ago

You can set and modify schedules, but it's clunky and doesn't sync with what's configured in the linktap app.

So I don't think that's possible, but I will double check the API documentation.

sh00t2kill commented 8 months ago

@sentience Ive had a look through the local API documentation and there's no way to perform that action via the local HTTP API, or via MQTT. The local API generally makes the assumption that the linktap ecosystem is no longer in control of the taps themselves, which i totally understand from a design perspective.

Unfortunately most actions performed locally do not sync with the app (eg schedules, pause state etc) Ive not used batch watering but it actually looks super helpful. It appears that its the cloud environment/app itself providing that functionality, and not the gateway.

You could perform something similar with a script, but that might be a little clunky. A potential solution might be using an input boolean and some automations. automation 1

if its turned on
turn on tap 1.

automation 2

if tap 1 turns off
and if the inout boolean is on
turn on tap 2

etc

clunky but should work.

Its likely possible via the Cloud / App API, although its not mentioned as part of their cloud API documentation, but that likely negates the point of this -- ie local control.

sh00t2kill commented 7 months ago

@sentience FWIW i added a node red flow to do "batch watering" -- happy to share this with you if you use node red and would find it useful.

the flow creates a switch in HA, when the switch is triggered, it starts watering tap by tap until that tap finishes (so -- for the duration its configured for at the time of starting) and then turns the switch off at the end.

turning the switch off during the batch watering flow will also stop anything currently watering.

I am thinking about making the integration do this but it would be hard to do anything other than "turn on all my taps 1 by 1"

sh00t2kill commented 7 months ago

@sentience just working though in my head what i think this might look like.

These are the options ive been throwing around in my head:

1) a service that accepts a list of taps and runs then 1 by 1 for whatever the duration configured is 2) a service that accepts a duration, and waters all taps for the duration specified, regardless of what is configured for the tap 3) a service that accepts a list of taps, and a duration for each tap, and runs those taps for that duration. This is the most flexible, but also the most work to implement.

bradkemper commented 4 months ago

Couldn't you just create automations that are triggered by times, with conditions that the be on certain days of the week? You could also add conditions regarding rain forecast, I think.

The UI/UX and graphic design of the app is soooooo terrible that I generally try to avoid opening it, and would rather do everything from HA.

bradkemper commented 4 months ago

It looks like this should be able to integrate well with https://github.com/petergridge/Irrigation-V5, which has a custom card, and which in tern integrates with https://github.com/petergridge/openweathremaphistory so that you don't water when there has been, or will be, enough rain to do the job.

sh00t2kill commented 4 months ago

@bradkemper Yeah this is why i haven't implemented any sort of of scheduling within HA, because there are a myriad of other ways to do it.

I did start looking at a service which could do something similar to the batch watering, available in the Linktap app, but I just don't see a whole lot of value in it, and it does not persist past a HA restart.

sh00t2kill commented 3 months ago

Im going to close this because I dont think its something I will ever implement. I dont like how HA deals with scheduled events -- its basically just an asyncio wait, so it doesnt persist on a restart.