rgc99 / irrigation_unlimited

â™’Irrigation controller for Home Assistant
MIT License
329 stars 49 forks source link

Why is `time` required in `manual_run`? #71

Closed zanna-37 closed 1 year ago

zanna-37 commented 2 years ago

Is your feature request related to a problem? Please describe. I don't understand why the time parameter is mandatory in the manual_run service. Wouldn't it be possibile to use the default durations? The ones specified in the configuration as there was a schedule set to now.

Describe the solution you'd like I would like to manually start irrigation using the default durations.

Describe alternatives you've considered Manually put the total time as time parameter, but it does not follow the DRY principle.

rgc99 commented 2 years ago

Actually not a bad idea but raises a few questions. Manual runs are usually performed as an exception otherwise why not schedule them. The durations themselves can be continually adjusted by weather based automations, soil moisture probes, algorithms like HAsmartirrigation and so on. Should the length be the prevailing time or the base duration.

Most often the use of a manual run is a captains call because of an unexpected weather event. Therefore it would stand to reason the duration would be a gut feeling. I am interested in the conditions where it is required and could it be addressed with better scheduling or adjustments.

It is my goal to never use the manual run facility. A totally autonomous system that adjusts itself to the weather conditions, past, present and future - has it been raining, is it raining and is it likely to rain. I know, a dream. So we have the manual run question.

zanna-37 commented 2 years ago

In my use case, I don't have a fixed scheduled. I prefer to have a flexible scheduling with automations (e.g., start when I'm away, or when the energy consumption is not high, etc.). In my opinion, the default length should be the one used as it was scheduled at this moment. Therefore, I would use the prevailing time unless stated otherwise.

SuperMaximus1984 commented 2 years ago

Can you make a Manual Run possible even if controller is disabled (Enabled = 0)? Quite often it's essential to have a peculiar zone irrigated when central controller is off for 2-3 days (after rain). So Manual Run could be turned on without prior turning on of the whole Controller and afterward without the necessity to switch it off again...

rgc99 commented 2 years ago

The adjust_time service call is ideal for this. Set the percentage to either 0 or 100 to act as a switch. Better yet, set up a sensor or use a weather feed to automatically handle the adjustment. There are a few automation examples in the documentation to get you started. You can target controllers, zones, sequences to fine tune which parts to turn on or off. The manual_run service will still operate as normal.

zanna-37 commented 2 years ago

@SuperMaximus1984 thanks for your suggestion, however I think that it would be more visible if you create another issue where it can be discussed properly.

Back to this issue adjust_time would not work great in my use case as the idea is, for example, to run it as soon as I go away, or in general, reacting to some external event. adjust_time is good to react to some state while keeping the same schedule. My use case is more leaned to have a dynamic starting point that depends on external (immediate) events.

luixal commented 1 year ago

Hi,

I just got into this problem. I have created two sequences, the "main" one which runs twice a day (different durations for each zone) and a "short" one, that irrigates each zone for 3mins, which I use manually only and without any auto adjustment.

Why he second one? Because:

Also, as a developer, it feels logical than if you dont provide the duration paremeter, the default in the sequence definition is taken.

Thanks for this great integration!

soeffi commented 1 year ago

+1 for this.

For similar reasons as @luixal, I'd like to manually start a program with default values, without having to remember (and to type, typically on a mobile!) a duration. In fact, I'd actually prefer a percentage adjustment to the default time (just as with adjust_time service) as an optional parameter.

So let me propose this:

rgc99 commented 1 year ago

For the brave, these changes are in the repository if someone cares to do a manual install and give feedback. It currently works on a sequence only and does take into account adjustments. Just leave off the time parameter (now optional) or in the case of the card leave it at '0:00:00'.

Manual run on a zone is a little bit more difficult as there is no default time. The duration comes from a schedule for which there can be none or many. Probably solve by adding a parameter default_duration in the zone config. This could form the base and apply adjustment for the run time.

soeffi commented 1 year ago

Wow, that's great!

I'll need to figure out how to get this installed manually.

If I may suggest, you could add a "duration" parameter to the zone config as well. This can serve as default for manual operation and can also be used as a "per-zone"-default for schedules, assuming a sane order of precedence with other "duration" parameters. I'd guess it would make sense to use:

  1. duration as configured in zone object (default) -> new
  2. duration as configured in sequence object for the current sequence, overwrites the zone default
  3. duration as configured in sequence zone object, overwrites zone default and sequence default

Thanks for a great integration!

gaaf commented 1 year ago

For the brave, these changes are in the repository if someone cares to do a manual install and give feedback. It currently works on a sequence only and does take into account adjustments. Just leave off the time parameter (now optional) or in the case of the card leave it at '0:00:00'.

This doesn't work for me on a recent checkout (5c63d4b6e5). When I start a manual run on a sequence via the card without filling the duration field (leaving the orange default of 0:00:00), I get:

Failed to call service irrigation_unlimited/manual_run. offset should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS.F' for dictionary value @ data['time']

image

If I change the duration to "0", it will start with the default duration. So it just seems to refuse the default "0:00:00".

rgc99 commented 1 year ago

The card will need a small update.

rgc99 commented 1 year ago

Card has been updated to version 2023.6.1

rgc99 commented 1 year ago

Now available in current release