rgc99 / irrigation_unlimited

♒Irrigation controller for Home Assistant
MIT License
332 stars 49 forks source link

Request or clarification - Pad start time based off smart-irrigation run times #32

Closed subcritical71 closed 1 year ago

subcritical71 commented 3 years ago

First, thanks for the great effort you have put in with this customization. It really completes my HAsmartirrigation installation.

Is your feature request related to a problem? Please describe. I came from the home bridge world where I used homebridge-smart-irrigation (https://github.com/MTry/homebridge-smart-irrigation) and particularly like the feature where the irrigation start time would be sunrise (minus) the total of the calculated runtimes of the days zones. This system also used the evaporative calculation that HAsmartirrigation uses. In my case I have 11 zones which have a maximum runtime of 30 min for 5.5 hrs total in the maximum case. So since I want the irrigation to finish up at sunrise I subtract the 5.5 hrs and it starts usually just after midnight. But sometimes there is a very low amount of watering needed and if the system starts at just after midnight it is finished by 2am so there will be several hours before sunrise.

Describe the solution you'd like Is there an action that would allow me to specify a dynamic adjustment of the start time based off of the sum of the zones to be watered (from HAsmartirrigation)? Right now your component fires at 23:30 and automatically adjusts the runtimes. This would be a (probably large) effort to get the sum of that runtime inserted into the controller -> sequences -> schedule -> time -> sun event options. I guess it could also be applied to a fixed time option as well.

Describe alternatives you've considered None.

Additional context None.

Thanks again for your component.

rgc99 commented 3 years ago

The time (fixed or solar) specified in the schedule is interpreted as the start time. It would be an elegant solution if this could instead be the finish time. A flag in the schedule object would determine the meaning of the time parameter, start or finish. That's the easy part. I would need to look at the feasibility.

rgc99 commented 3 years ago

This is looking promising. A new parameter in the schedule anchor that takes start (default) or finish determines the meaning of the time setting. Just one consideration regarding the timing of adjustments and how to deal with one that would make the start time historical. For example to finish at 06:00 and the maximum run time is 5 hours means it could start anywhere from 01:00. You have an adjustment in place that makes the start time 04:00, it is now 03:00 and another adjustment is made that changes the start time to 02:00. Without a TARDIS I am not sure how any system would deal with this. It could possibly be detected and ignored, logged, error. It could come down to a big fat warning. Don't make adjustment calls during the run window which in this case would be between 01:00 and 06:00.

subcritical71 commented 3 years ago

I see you have modified some of the code. Do you think it is at a state that is ready to test?

rgc99 commented 3 years ago

Yes, go for it if you are ok with a manual install. If nothing else surfaces I will release next week. Just need to tidy up the documentation. The bit you really need to know is:

irrigation_unlimited:
  controllers:
    zones:
      - entity_id: 'switch.my_switch_1'
      - entity_id: 'switch.my_switch_2'
      - entity_id: 'switch.my_switch_3'
      - entity_id: 'switch.my_switch_4'
    sequences:
      - name: 'My watering run'
        duration: '00:30'
        delay: '00:01'
        schedules:
          - name: 'Before dawn'
            time:
              sun: 'sunrise'
              before: '00:20'
            anchor: finish
        zones:
          - zone_id: 1
          - zone_id: 2
          - zone_id: 3
          - zone_id: 4

Note the 'anchor' parameter in the schedule.

subcritical71 commented 3 years ago

I finally implemented this last night, but it seems HAsmartirrigation (HAsi) is having some problems on my end so I have not yet had success. I will report back when I get this going. In the mean time a quick question, since I am using HAsi to set the irrigation times should I also set 'duration' in the irrigation_unlimited configuration at some default value? The HAsi calculations run at 23:00 and I have irrigation_unlimited running at 23:05 so I would think that putting a default 'duration' value would override the 23:00 HAsi calculations(?).

rgc99 commented 3 years ago

Set duration to a nominal value. The adjustment service call to irrigation_unlimited will effectively override this value.

subcritical71 commented 3 years ago

Well, I had 6 zones run last night using the anchor: finish option (as well as specifying the duration: '00:30'). The irrigation system ran according to the HAsi calculated times as expected, but the padding seemed to use the 30 minute duration instead of the HAsi values (basically acted as an anchor: start).

Also, something a little strange is the calculated start time vs actual start time. I'm not worried about minutes but just noticed they don't match.

Screen Shot 2021-09-08 at 8 44 32 AM

Here are the back yard zone run times (as calculated by HAsi) and some other data;

Sunrise: 06:46
Zone: Runtime - Start time
Zone 1: 00:30:00 - Start time: 03:37
Zone 2: 00:30:00 - Start time: 04:07
Zone 3: 00:30:00 - Start time: 04:37
Zone 4: 00:17:20 - Start time: 05:07
Zone 5: 00:14:10 - Start time: 05:24
Zone 6: 00:11:10 - Start time: 05:38 - **End Time 5:49**

So, sunrise (minus) the 10 minute padding should have stopped irrigation at 6:36.

Here is my configuration;

granularity: 10
refresh_interval: 1
testing:
  enabled: false
  show_log: true
  output_events: true
  speed: 60.0
  times:
    - name: 'Test 1'
      start: '2021-08-12 23:00'
      end: '2021-08-13 07:30'
    - name: 'Test 2'
      start: '2021-08-13 23:00'
      end: '2021-08-14 07:30'

controllers:
  - name: 'ELK M1 Controller 1'
    zones:
      - name: 'Zone 1'
        entity_id: 'switch.elkm1_output_sprinklerzone01'
      - name: 'Zone 2'
        entity_id: 'switch.elkm1_output_sprinklerzone02'
      - name: 'Zone 3'
        entity_id: 'switch.elkm1_output_sprinklerzone03'
      - name: 'Zone 4'
        entity_id: 'switch.elkm1_output_sprinklerzone04'
      - name: 'Zone 5'
        entity_id: 'switch.elkm1_output_sprinklerzone05'
    sequences:
      - name: 'Front Lawn'
        duration: '00:30' 
        schedules:
          - name: 'Normal Schedule C1'
            time:
              sun: 'sunrise'
              before: '00:10'
            weekday: [tue, thu, sat]
            month: [may, jun, jul, aug, sep, oct]
            duration: '00:30'
            anchor: finish
        zones:
          - zone_id: 1
          - zone_id: 2
          - zone_id: 3
          - zone_id: 4
          - zone_id: 5
    all_zones_config:
      maximum: '00:30'
  - name: 'Elk M1 Controller 2'
    zones:
      - name: 'Zone 6'
        entity_id: 'switch.elkm1_output_sprinklerzone06'
      - name: 'Zone 7'
        entity_id: 'switch.elkm1_output_sprinklerzone07'
      - name: 'Zone 8'
        entity_id: 'switch.elkm1_output_sprinklerzone08'
      - name: 'Zone 9'
        entity_id: 'switch.elkm1_output_sprinklerzone09'
      - name: 'Zone 10'
        entity_id: 'switch.elkm1_output_sprinklerzone10'
      - name: 'Zone 11'
        entity_id: 'switch.elkm1_output_sprinklerzone11'
    sequences:
      - name: 'Back Lawn'
        duration: '00:30'
        schedules:
          - name: 'Normal Schedule C2'
            time:
              sun: 'sunrise'
              before: '00:10'
            weekday: [mon, wed, fri]
            month: [may, jun, jul, aug, sep, oct]
            anchor: finish
        zones:
          - zone_id: 1
          - zone_id: 2
          - zone_id: 3
          - zone_id: 4
          - zone_id: 5
          - zone_id: 6
    all_zones_config:
      maximum: '00:30'
rgc99 commented 3 years ago

Try this on for size. Basically I have added duration parameters to each zone in the sequence (controller 2).

irrigation_unlimited:
  granularity: 10
  refresh_interval: 10
  controllers:
    - name: 'ELK M1 Controller 1'
      zones:
        - name: 'Zone 1'
          entity_id: 'switch.elkm1_output_sprinklerzone01'
        - name: 'Zone 2'
          entity_id: 'switch.elkm1_output_sprinklerzone02'
        - name: 'Zone 3'
          entity_id: 'switch.elkm1_output_sprinklerzone03'
        - name: 'Zone 4'
          entity_id: 'switch.elkm1_output_sprinklerzone04'
        - name: 'Zone 5'
          entity_id: 'switch.elkm1_output_sprinklerzone05'
      sequences:
        - name: 'Front Lawn'
          duration: '00:30'
          schedules:
            - name: 'Normal Schedule C1'
              time:
                sun: 'sunrise'
                before: '00:10'
              weekday: [tue, thu, sat]
              month: [may, jun, jul, aug, sep, oct]
              duration: '00:30'
              anchor: finish
          zones:
            - zone_id: 1
            - zone_id: 2
            - zone_id: 3
            - zone_id: 4
            - zone_id: 5

      all_zones_config:
        maximum: '00:30'
    - name: 'Elk M1 Controller 2'
      zones:
        - name: 'Zone 6'
          entity_id: 'switch.elkm1_output_sprinklerzone06'
        - name: 'Zone 7'
          entity_id: 'switch.elkm1_output_sprinklerzone07'
        - name: 'Zone 8'
          entity_id: 'switch.elkm1_output_sprinklerzone08'
        - name: 'Zone 9'
          entity_id: 'switch.elkm1_output_sprinklerzone09'
        - name: 'Zone 10'
          entity_id: 'switch.elkm1_output_sprinklerzone10'
        - name: 'Zone 11'
          entity_id: 'switch.elkm1_output_sprinklerzone11'
      sequences:
        - name: 'Back Lawn'
          duration: '00:30'
          schedules:
            - name: 'Normal Schedule C2'
              time:
                sun: 'sunrise'
                before: '00:10'
              weekday: [mon, wed, fri]
              month: [may, jun, jul, aug, sep, oct]
              anchor: finish
          zones:
            - zone_id: 1
              duration: "0:30:00"
            - zone_id: 2
              duration: "0:30:00"
            - zone_id: 3
              duration: "0:30:00"
            - zone_id: 4
              duration: "0:17:20"
            - zone_id: 5
              duration: "0:14:10"
            - zone_id: 6
              duration: "0:11:10"
      all_zones_config:
        maximum: '00:30'

Now make the service call. This is targeted at controller 2 (Elk M1 Controller 2), the first sequence (Back Lawn). The time should be the entire sequence (2:12:40 for this day). Here's the trick, the next day HAsi might calculate 3 hours in which case will proportionally adjust each zone in the sequence.

      - service: irrigation_unlimited.adjust_time
        data:
          entity_id: binary_sensor.irrigation_unlimited_c2_m
          sequence_id: 1
          actual: "2:12:40"

Note: You could do the same with one controller and two sequences. No big deal either way.

irrigation_unlimited:
  granularity: 10
  refresh_interval: 10
  controllers:
    - name: 'ELK M1 Controller 1'
      zones:
        - entity_id: 'switch.elkm1_output_sprinklerzone01'
        - entity_id: 'switch.elkm1_output_sprinklerzone02'
        - entity_id: 'switch.elkm1_output_sprinklerzone03'
        - entity_id: 'switch.elkm1_output_sprinklerzone04'
        - entity_id: 'switch.elkm1_output_sprinklerzone05'
        - entity_id: 'switch.elkm1_output_sprinklerzone06'
        - entity_id: 'switch.elkm1_output_sprinklerzone07'
        - entity_id: 'switch.elkm1_output_sprinklerzone08'
        - entity_id: 'switch.elkm1_output_sprinklerzone09'
        - entity_id: 'switch.elkm1_output_sprinklerzone10'
        - entity_id: 'switch.elkm1_output_sprinklerzone11'
      sequences:
        - name: 'Front Lawn'
          schedules:
            - name: 'Normal Schedule C1'
              time:
                sun: 'sunrise'
                before: '00:10'
              weekday: [tue, thu, sat]
              month: [may, jun, jul, aug, sep, oct]
              duration: '00:30'
              anchor: finish
          zones:
            - zone_id: 1
            - zone_id: 2
            - zone_id: 3
            - zone_id: 4
            - zone_id: 5
        - name: 'Back Lawn'
          schedules:
            - name: 'Normal Schedule C2'
              time:
                sun: 'sunrise'
                before: '00:10'
              weekday: [mon, wed, fri]
              month: [may, jun, jul, aug, sep, oct]
              anchor: finish
          zones:
            - zone_id: 6
              duration: "0:30:00"
            - zone_id: 7
              duration: "0:30:00"
            - zone_id: 8
              duration: "0:30:00"
            - zone_id: 9
              duration: "0:17:20"
            - zone_id: 10
              duration: "0:14:10"
            - zone_id: 11
              duration: "0:11:10"
      all_zones_config:
        maximum: '00:30'
subcritical71 commented 3 years ago

Great. So, in your example. The first day is 'forced' to '02:12:40'. If the following day requests 3 hours, will the finish time still be at sunrise?

I was thinking that with the finish time anchored to sunrise that the 23:15 update would take the sum of the zones in the scheduled run, 'irrigation_unlimited.adjust_time' times for the day and subtract from sunset (with applicable delays factored in).

- alias: Smart Irrigation adjustment
  description: Adjust watering times based on smart irrigation calculations
  trigger:
    - platform: time
      at: "23:15"
  action:
    - service: irrigation_unlimited.adjust_time
      data:
        entity_id: binary_sensor.irrigation_unlimited_c1_z1
        actual: >
          {% set t = states('sensor.smart_irrigation_z01_daily_adjusted_run_time') | int %}
          {{ '{:02d}:{:02d}:{:02d}'.format((t // 3600) % 24, (t % 3600) // 60, (t % 3600) % 60) }}
...
rgc99 commented 3 years ago

All schedules can be anchored either individual zones or sequences. Adjustments can also be made on zones or sequences. When adjusting a sequence the entire sequence is stretched or contracted. Zone adjustments are independent of each other and ignored if a sequence adjustment is in play. I think what you are asking is to create a sequence, make adjustments to individual zones and then tally these, ignoring any sequence duration settings along the way. Currently there is no way to adjust the individual zone durations in a sequence, they must be done as a group. Not out of the question though.

Best way forward is to create a sequence, work out the relative percentage of each zone within the string and enter these as individual duration's. Adjust the sequence with the total irrigation time.

rmeekers commented 3 years ago

Just wanted to thank you for this new feature @rgc99. Really great to have this!

rgc99 commented 3 years ago

Implementing adjustments on sequence zone durations. This will give greater control over individual timings within the sequence. Couple of issues to work through but should be straight forward. Stay tuned...

rgc99 commented 3 years ago

Ready to road test, code in repository. Need to know bits, there is a zones: parameter in the adjust_time service call which will adjust a specific zone within a sequence.

      - service: irrigation_unlimited.adjust_time
        data:
          entity_id: binary_sensor.irrigation_unlimited_c1_m
          sequence_id: 1
          zones: 1
          actual: "00:30"

This will adjust the first zone in the first sequence. The entity must be a controller, zone entity adjustments are only for non-sequence setups. A couple of tricks; zones: 0 will change all zones in the sequence and the parameter can take a list `zones: [1,2,3]. Adjustments to the entire sequence (zones parameter missing) will still work on top of the adjustments to its child zones so if you adjust all the zones to %50 and then adjust the entire sequence to %200 you will get exactly what you started with, they will cancel each other out. Let me know

rmeekers commented 3 years ago

What's wrong with this sequence config?

        - name: "Lawn - Summer mornings zone 2"
          delay: "00:00:20"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [tue]
              month: [apr, may, jun, jul, aug, sep, oct]
          zones:
            - zone_id: 2
              duration: "00:00"

It's scheduled now to start 10 minutes before sun is up (instead of finishing by then)

rgc99 commented 3 years ago

You have the duration set to "00:00". Also, I assume there are two zones in the system. This works:

irrigation_unlimited:
  granularity: 20
  controllers:
    - name: Test controller
      zones:
        - name: Zone 1
        - name: Zone 2
      sequences:
        - name: "Lawn - Summer mornings zone 2"
          delay: "00:00:20"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [tue]
              month: [apr, may, jun, jul, aug, sep, oct]
          zones:
            - zone_id: 2
              duration: "00:10"
rmeekers commented 3 years ago

I've set the duration to 0:00 because I use HAsmartirrigation to set the duration. And if HAsmartirrigation doesn't set a duration, I don't want it to run. Is there a better way to accomplish this?

This is my complete config:

irrigation_unlimited:
  granularity: 10
  refresh_interval: 20
  controllers:
    - name: 'Rain Bird'
      zones:
        - name: "Lawn Front (zone 1)"
          entity_id: "switch.rain_valve_1"
          maximum: "01:30"
        - name: "Lawn Back (zone 2)"
          entity_id: "switch.rain_valve_2"
          maximum: "06:00"
        - name: "Lawn Side (zone 3)"
          entity_id: "switch.rain_valve_3"
          maximum: "01:30"
        - name: "Irrigation around house (zone 1)"
          entity_id: "switch.irrigation_valve_1"
          maximum: "04:00"
        - name: "Irrigation vegetable garden (zone 2)"
          entity_id: "switch.irrigation_valve_2"
          maximum: "04:00"
        - name: "Irrigation rhododendron (zone 3)"
          entity_id: "switch.irrigation_valve_3"
          maximum: "04:00"
      sequences:
        - name: "Lawn - Summer mornings zone 1 & 3"
          delay: "00:00:30"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [mon]
              month: [apr, may, jun, jul, aug, sep, oct]
          zones:
            - zone_id: 1
              duration: "00:00"
            - zone_id: 3
              duration: "00:00"
        - name: "Lawn - Summer mornings zone 2"
          delay: "00:00:20"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [tue]
              month: [apr, may, jun, jul, aug, sep, oct]
          zones:
            - zone_id: 2
              duration: "00:00"
        - name: "Borders - Summer mornings around house"
          delay: "00:00:20"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [fri]
              month: [apr, may, jun, jul, aug, sep, oct]
          zones:
            - zone_id: 4
              duration: "04:00"
        - name: "Vegetable garden - Summer mornings"
          delay: "00:00:20"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [wed,sun]
              month: [may, jun, jul, aug, sep]
          zones:
            - zone_id: 5
              duration: "01:00"
        - name: "Borders - Summer mornings rhododendron"
          delay: "00:00:20"
          schedules:
            - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
              weekday: [thu]
              month: [apr, may, jun, jul, aug, sep, oct]
          zones:
            - zone_id: 6
              duration: "04:00"

The sequences set to 0:00 are the ones set via an automation by HAsmartirrigation

rgc99 commented 3 years ago

Flying blind here, things going on I can't see. Need to add some chicken tracks. Take five while I add some logging.

rgc99 commented 3 years ago

Logging has been added and code now in the repository. Set the logging level to debug.

logger:
  default: info
  logs:
    custom_components.irrigation_unlimited: debug

This will catch events, service calls and some other useful bits and pieces.

subcritical71 commented 3 years ago

I'm still having issues with the anchor - finish setting. It will only anchor to the duration specified in the irrigation_unlimited.yaml. It does not take into account the values that populate the zones from HAsi. I've let it run several days and get the same results. I have updated my code to match your latest up to and including today so it will be interesting to see the additional logging. Is there an easier way to update to non-released code except to manually edit?

Screen Shot 2021-09-15 at 10 26 40 AM
rgc99 commented 3 years ago

If I can't sort it with the information gathered here then I will create a development branch that can be installed via HACS. Got a feeling it's the timing or the way the service calls are made. We will see, thanks for your help.

rmeekers commented 3 years ago

fyi:

          - time:
                sun: "sunrise"
                before: "00:10"
              anchor: finish
rgc99 commented 3 years ago

Thanks for the information, I will dig into it.

Would like to get a log file for this produced from the latest code in the repository. This would give some real world data for testing.

subcritical71 commented 3 years ago

I'm trying to support as much as possible, but I am currently between jobs and moving, so needless to say I'm swamped. Anyway, here is my log file from yesterday. I don't know if this is enough information. It appears the zone times are correctly imported from HAsi, but I don't see any padding calls(?)

2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 1, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z1', 'actual': datetime.timedelta(seconds=1008)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 2, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z2', 'actual': datetime.timedelta(seconds=1144)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 3, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z3', 'actual': datetime.timedelta(seconds=1144)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 4, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z4', 'actual': datetime.timedelta(seconds=1138)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 5, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z5', 'actual': datetime.timedelta(seconds=1096)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 6, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z6', 'actual': datetime.timedelta(seconds=1800)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 7, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z7', 'actual': datetime.timedelta(seconds=1800)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 8, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z8', 'actual': datetime.timedelta(seconds=1800)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 9, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z9', 'actual': datetime.timedelta(seconds=1080)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 10, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z10', 'actual': datetime.timedelta(seconds=879)}"
2021-09-19 23:15:00 DEBUG (MainThread) [custom_components.irrigation_unlimited] CALL [2021-09-19 23:15:00] service: adjust_time, controller: 1, zone: 11, data: "{'entity_id': 'binary_sensor.irrigation_unlimited_c1_z11', 'actual': datetime.timedelta(seconds=693)}"
2021-09-20 03:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 03:15:20] Controller 1 Master is on
2021-09-20 03:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 03:15:20] controller: 1, zone: 0, state: 1
2021-09-20 03:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 03:15:20] Controller 1 Zone 6 is on [6.1.2.1.1]
2021-09-20 03:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 03:15:20] controller: 1, zone: 6, state: 1, data: 6.1.2.1.1
2021-09-20 03:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 03:45:20] Controller 1 Zone 6 is off
2021-09-20 03:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 03:45:20] controller: 1, zone: 6, state: 0
2021-09-20 03:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 03:45:20] Controller 1 Zone 7 is on [7.1.2.2.2]
2021-09-20 03:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 03:45:20] controller: 1, zone: 7, state: 1, data: 7.1.2.2.2
2021-09-20 04:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 04:15:20] Controller 1 Zone 7 is off
2021-09-20 04:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 04:15:20] controller: 1, zone: 7, state: 0
2021-09-20 04:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 04:15:20] Controller 1 Zone 8 is on [8.1.2.3.3]
2021-09-20 04:15:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 04:15:20] controller: 1, zone: 8, state: 1, data: 8.1.2.3.3
2021-09-20 04:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 04:45:20] Controller 1 Zone 8 is off
2021-09-20 04:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 04:45:20] controller: 1, zone: 8, state: 0
2021-09-20 04:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 04:45:20] Controller 1 Zone 9 is on [9.1.2.4.4]
2021-09-20 04:45:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 04:45:20] controller: 1, zone: 9, state: 1, data: 9.1.2.4.4
2021-09-20 05:03:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 05:03:20] Controller 1 Zone 9 is off
2021-09-20 05:03:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 05:03:20] controller: 1, zone: 9, state: 0
2021-09-20 05:03:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 05:03:20] Controller 1 Zone 10 is on [10.1.2.5.5]
2021-09-20 05:03:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 05:03:20] controller: 1, zone: 10, state: 1, data: 10.1.2.5.5
2021-09-20 05:17:50 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 05:17:50] Controller 1 Zone 10 is off
2021-09-20 05:17:50 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 05:17:50] controller: 1, zone: 10, state: 0
2021-09-20 05:17:50 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 05:17:50] Controller 1 Zone 11 is on [11.1.2.6.6]
2021-09-20 05:17:50 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 05:17:50] controller: 1, zone: 11, state: 1, data: 11.1.2.6.6
2021-09-20 05:29:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 05:29:20] Controller 1 Zone 11 is off
2021-09-20 05:29:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 05:29:20] controller: 1, zone: 11, state: 0
2021-09-20 05:29:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] [2021-09-20 05:29:20] Controller 1 Master is off
2021-09-20 05:29:20 DEBUG (MainThread) [custom_components.irrigation_unlimited] EVENT [2021-09-20 05:29:20] controller: 1, zone: 0, state: 0
rgc99 commented 3 years ago

Perfect and thanks for your help. All the information I need. Hope your move goes well.

rgc99 commented 3 years ago

If you are adjusting a sequence then the entity_id must be the controller/master (binary_sensor.irrigation_unlimited_c1_m). See if this makes sense, it is a bare bones setup and has examples of how to manipulate various points. I will flesh it out a bit and roll it into the documentation. Please let me know if you spot any problems.

# Configuration setup for a two controller, two zone system with various sequences
irrigation_unlimited:
  controllers:
    - name: "Controller 1"
      zones:
        - name: "Controller 1, Zone 1"
        - name: "Controller 1, Zone 2"
      sequences:
        - name: "Controller 1, Sequence 1"
          duration: "01:00" # Change this example 1
          schedules:
            - time: "06:00"
          zones:
            - zone_id: [1, 2]
              # Controller 1, Sequence 1, Zone 1
              duration: "00:10" # Change this example 2
            - zone_id: 2
              # Controller 1, Sequence 1, Zone 2
              duration: "00:10" # Change this example 3
        - name: "Controller 1, Sequence 2"
          duration: "01:00" # Change this example 4
          schedules:
            - time: "07:00"
          zones:
            - zone_id: 2
              # Controller 1, Sequence 2, Zone 1
              duration: "00:10" # Change this example 5
    - name: "Controller 2"
      zones:
        - name: "Controller 2, Zone 1"
        - name: "Controller 2, Zone 2"
      sequences:
        - name: "Controller 2, Sequence 1"
          duration: "01:00" # Change this example 6
          schedules:
            - time: "09:00"
          zones:
            - zone_id: 1
              # Controller 2, Sequence 1, Zone 1
              duration: "00:10" # Change this example 7
            - zone_id: 1
              # Controller 2, Sequence 1, Zone 2
              duration: "00:10" # Change this example 8
        - name: "Controller 2, Sequence 2"
          duration: "01:00" # Change this example 9
          schedules:
            - time: "09:00"
          zones:
            - zone_id: 1
              # Controller 2, Sequence 2, Zone 1
              duration: "00:10" # Change this example 10
            - zone_id: 1
              # Controller 2, Sequence 2, Zone 2
              duration: "00:10" # Change this example 11

# Service call parameters for the above configuration
# Example 1 - Controller 1, Sequence 1 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c1_m
    sequence_id: 1
    actual: "00:20"

# Example 2 - Controller 1, Sequence 1, Zone 1 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c1_m
    sequence_id: 1
    zones: 1
    actual: "00:20"

# Example 3 - Controller 1, Sequence 1, Zone 2 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c1_m
    sequence_id: 1
    zones: 2
    actual: "00:20"

# Example 4 - Controller 1, Sequence 2 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c1_m
    sequence_id: 2
    actual: "00:20"

# Example 5 - Controller 1, Sequence 2, Zone 1 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c1_m
    sequence_id: 2
    zones: 1
    actual: "00:20"

# Example 6 - Controller 2, Sequence 1 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c2_m
    sequence_id: 1
    actual: "00:20"

# Example 7 - Controller 2, Sequence 1, Zone 1 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c2_m
    sequence_id: 1
    zones: 1
    actual: "00:20"

# Example 8 - Controller 2, Sequence 1, Zone 2 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c2_m
    sequence_id: 1
    zones: 2
    actual: "00:20"

# Example 9 - Controller 2, Sequence 2 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c2_m
    sequence_id: 2
    actual: "00:20"

# Example 10 - Controller 2, Sequence 2, Zone 2 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c2_m
    sequence_id: 2
    zones: 2
    actual: "00:20"

# Example 11 - Controller 2, Sequence 2, Zone 2 -> duration
- service: irrigation_unlimited.adjust_time
  data:
    entity_id: binary_sensor.irrigation_unlimited_c2_m
    sequence_id: 2
    zones: 2
    actual: "00:20"
rmeekers commented 3 years ago

Thanks for the clarification. Little question:

image

And the zone_id is referring to the id's I've set here?

image
rgc99 commented 3 years ago

Not necessarily although it doesn't really make any practical sense. You are correct the zone_id in the sequence refers back to the zone_id in the actual zone. I did this deliberately to show the zone_id has nothing to do with the service call zones parameter. The zones parameter refers to the first, second, third... item in the list of zones within the sequence. Hint, you can specify 0 which will change all zones in the sequence. Another hint, it also takes a list zones: [1,3,5]

rmeekers commented 3 years ago

If you are adjusting a sequence then the entity_id must be the controller/master (binary_sensor.irrigation_unlimited_c1_m)

When I use this, like in example 2 or 3, the time isn't adjusted. If I take a look to the service call, the zones parameter isn't present:

image

Conclusion: I can't get the new anchor: finish parameter working

rgc99 commented 3 years ago

How are you getting on with this issue? I believe it was the parameters to the service calls. The latest release has some checking and warnings in place. Documentation has a new section on making service calls to hit the right spot. If still stuck then please post a log.

rmeekers commented 3 years ago

@rgc99 no changes since my last post. What kind of log do you need? I'll need to see if I can get it from 2 months ago. Because it's winter right now and the sprinklers aren't running anymore since 6 weeks.

rgc99 commented 3 years ago

No problems, I will leave the issue open. We can pick it up again next irrigation season.

rgc99 commented 1 year ago

Stale issue.