rgc99 / irrigation_unlimited

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

No further adjustments after adjustment is giving 00:00:00 #72

Closed strehlma closed 2 years ago

strehlma commented 2 years ago

Version of the custom_component

Configuration

irrigation_unlimited:
  controllers:
    zones:
      - name: "Garten vorne"
        entity_id: "switch.sprinkler_1"
        show:
          timeline: true
      - name: "Garten mitte"
        entity_id: "switch.sprinkler_3"
        show:
          timeline: true
      - name: "Garten hinten"
        entity_id: "switch.sprinkler_2"
        show:
          timeline: true
    sequences:
      - name: Garten
        delay: "00:01"
        schedules:
          - name: "Abends"
            time: "19:00"
        zones:
          - zone_id: 3
            duration: "00:40"
          - zone_id: 2
            duration: "00:15"
          - zone_id: 1
            duration: "00:15"
  - alias: "Irrigation adjustment - vorne"
    id: "irrigation_adjustment_garten_vorne"
    description: Adjust watering times based on smart irrigation calculations
    trigger:
      - platform: time
        at: "23:30"
    action:
      - service: irrigation_unlimited.adjust_time
        data:
          entity_id: binary_sensor.irrigation_unlimited_c1_z1
          actual: >
            {% set t = states('sensor.smart_irrigation_vorne_daily_adjusted_run_time') | int(-1) %}
            {% if t != -1 %}
              {{ '{:02d}:{:02d}:{:02d}'.format((t // 3600) % 24, (t % 3600) // 60, (t % 3600) % 60) }}
            {% else %}
              {{ "00:00:00" }}
            {% endif %}
    mode: single

  - alias: "Irrigation adjustment - mitte"
    id: "irrigation_adjustment_garten_mitte"
    description: Adjust watering times based on smart irrigation calculations
    trigger:
      - platform: time
        at: "23:30"
    action:
      - service: irrigation_unlimited.adjust_time
        data:
          entity_id: binary_sensor.irrigation_unlimited_c1_z2
          actual: >
            {% set t = states('sensor.smart_irrigation_mitte_daily_adjusted_run_time') | int(-1) %}
            {% if t != -1 %}
              {{ '{:02d}:{:02d}:{:02d}'.format((t // 3600) % 24, (t % 3600) // 60, (t % 3600) % 60) }}
            {% else %}
              {{ "00:00:00" }}
            {% endif %}
    mode: single

  - alias: "Irrigation adjustment - hinten"
    id: "irrigation_adjustment_garten_hinten"
    description: Adjust watering times based on smart irrigation calculations
    trigger:
      - platform: time
        at: "23:30"
    action:
      - service: irrigation_unlimited.adjust_time
        data:
          entity_id: binary_sensor.irrigation_unlimited_c1_z3
          actual: >
            {% set t = states('sensor.smart_irrigation_hinten_daily_adjusted_run_time') | int(-1) %}
            {% if t != -1 %}
              {{ '{:02d}:{:02d}:{:02d}'.format((t // 3600) % 24, (t % 3600) // 60, (t % 3600) % 60) }}
            {% else %}
              {{ "00:00:00" }}
            {% endif %}
    mode: single

  - alias: "Smart Irrigation reset bucket"
    id: "smart_irrigation_reset_bucket"
    description: Resets the Smart Irrigation bucket after watering
    trigger:
      - platform: state
        entity_id:
          # Add Irrigation Unlimited sensors here
          - binary_sensor.irrigation_unlimited_c1_m
        from: "on"
        to: "off"
    action:
      - service: smart_irrigation.smart_irrigation_vorne_reset_bucket
      - service: smart_irrigation.smart_irrigation_mitte_reset_bucket
      - service: smart_irrigation.smart_irrigation_hinten_reset_bucket

Add your logs here.

Describe the bug

It seems, that there are no new adjustments to the duration after the adjustment was set to 00:00:00 once. The reset bucket automation isn't triggered any more. Probably because the controller is no set to 'on' and back to 'off' which should trigger the automation. Is this normal, that the controller isn't starting when the duration is set to 00:00:00?

Debug log


Add your logs here.
rgc99 commented 2 years ago

It is normal that the controller will not operate when the time is set to zero. The fact that it never comes out it suggests the sensor sensor.smart_irrigation_vorne_daily_adjusted_run_time does not exist or not operating correctly. It should not be necessary to reset the bucket when the time is zero and the system has not run. The examples provided by the author of HAsmartirrigation do not, they all have a condition that checks the sensor is above zero (actually might be a good idea to add this condition in as well).

This is quite possibly related to issue #67. In that case HAsmartirrigation had not been installed but the automation assumed it was. The automation has been updated and now checks the sensor is available.