Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zone schedule lost #100

Closed
koldogut opened this issue Feb 20, 2023 · 4 comments
Closed

Zone schedule lost #100

koldogut opened this issue Feb 20, 2023 · 4 comments

Comments

@koldogut
Copy link

koldogut commented Feb 20, 2023

Version of the custom_component

2023.2.1

Configuration

irrigation_unlimited:
  controllers:
    all_zones_config: # <= Add these three lines <─┐
      show: # <= to the configuration            <─┤
        timeline: true # <= for all zones        <─┘
    zones:
      - entity_id: "switch.shelly_shsw_pm_8caab505787f" #Riego Cesped
      - entity_id: "switch.shelly_shsw_1_e0980696807b" #Goteo Jazmín
      - entity_id: "switch.bomba_riego_aux" #Goteo Jardineras
      - entity_id: "switch.bomba_riego" #Goteo Romero
      
    sequences:
      - name: "Cesped"
        duration: "00:05"
        delay: "00:05"
        repeat: 2
        schedules:
          - name: "Invierno"
            time: "00:10"
            weekday: [mon, thu]
            month: [dec, jan, feb]
            duration: "00:03"
          - name: "Verano"
            time: "00:10"
            weekday: [sun, mon, tue, wed, thu, fri, sat]
            month: [jun, jul, aug, sep]
            duration: "00:05"
          - name: "Primavera y Otoño"
            time: "00:10"
            weekday: [mon, wed, fri]
            month: [mar, apr, may, oct, nov]
            duration: "00:02"
        zones:
          - zone_id: 1
          
      - name: "Jazmin"
        duration: "00:05"
        delay: "00:01"
        schedules:
          - name: "Invierno"
            time: "07:00"
            weekday: [mon, wed, fri]
            month: [dec, jan, feb]
            duration: "00:04"
          - name: "Verano"
            time: "01:00"
            weekday: [sun, mon, tue, wed, thu, fri, sat]
            month: [jun, jul, aug, sep]
            duration: "00:05"
          - name: "Primavera y Otoño"
            time: "01:00"
            weekday: [mon, thu]
            month: [mar, apr, may, oct, nov]
            duration: "00:04"
        zones:
          - zone_id: 2

      - name: "Jardineras"
        duration: "00:03"
        delay: "00:01"
        schedules:
          - name: "Invierno"
            time: "10:00"
            weekday: [mon, wed, fri]
            month: [dec, jan, feb]
            duration: "00:02"
          - name: "Verano"
            time: "08:00"
            weekday: [sun, mon, tue, wed, thu, fri, sat]
            month: [jun, jul, aug, sep]
            duration: "00:05"
          - name: "Primavera y Otoño"
            time: "09:00"
            weekday: [mon, thu]
            month: [mar, apr, may, oct, nov]
        zones:
          - zone_id: 3

      - name: "Romero"
        duration: "00:03"
        delay: "00:01"
        schedules:
          - name: "Invierno"
            time: "10:10"
            weekday: [mon, wed, fri]
            month: [dec, jan, feb]
            duration: "00:02"
          - name: "Verano"
            time: "08:10"
            weekday: [sun, mon, tue, wed, thu, fri, sat]
            month: [jun, jul, aug, sep]
            duration: "00:05"
          - name: "Primavera y Otoño"
            time: "09:10"
            weekday: [mon, thu]
            month: [mar, apr, may, oct, nov]
        zones:
          - zone_id: 4


#sensor.casa_precipitation

sensor:
  - platform: average
    name: irrigation_unlimited_rain_0
    entities:
      - sensor.casa_precipitation
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) }}"
    end: "{{ now() }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_rain_1
    entities:
      - sensor.casa_precipitation
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=1) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=1) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_rain_2
    entities:
      - sensor.casa_precipitation
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=2) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=2) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_rain_3
    entities:
      - sensor.casa_precipitation
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=3) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=3) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_rain_4
    entities:
      - sensor.casa_precipitation
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=4) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=4) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_temperature_0
    entities:
      - sensor.casa_realfeel_temperature
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) }}"
    end: "{{ now() }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_temperature_1
    entities:
      - sensor.casa_realfeel_temperature
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=1) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=1) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_temperature_2
    entities:
      - sensor.casa_realfeel_temperature
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=2) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=2) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_temperature_3
    entities:
      - sensor.casa_realfeel_temperature
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=3) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=3) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_temperature_4
    entities:
      - sensor.casa_realfeel_temperature
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=4) }}"
    end: "{{ now().replace(hour=23).replace(minute=59).replace(second=0) - timedelta(days=4) }}"
    scan_interval: 600

  - platform: average
    name: irrigation_unlimited_temperature_5_day_moving_average
    entities:
      - sensor.casa_realfeel_temperature
    precision: 1
    start: "{{ now().replace(hour=0).replace(minute=30).replace(second=0) - timedelta(days=4) }}"
    end: "{{ now() }}"
    scan_interval: 600

  # Five day weighted rain total sensor.
  # Adjust the weight values (0.7, 0.3, 0.15, 0.05) to suit your needs (0.0 = ignore that day).
  - platform: template
    sensors:
      irrigation_unlimited_rain_weighted_total:
        friendly_name: "Irrigation Unlimited Rain Weighted Total"
        unit_of_measurement: "mm"
        icon_template: "mdi:umbrella"
        value_template: >
          {% set r0 = state_attr('sensor.irrigation_unlimited_rain_0','max_value') | float(-1) %}
          {% set r1 = state_attr('sensor.irrigation_unlimited_rain_1','max_value') | float(-1) %}
          {% set r2 = state_attr('sensor.irrigation_unlimited_rain_2','max_value') | float(-1) %}
          {% set r3 = state_attr('sensor.irrigation_unlimited_rain_3','max_value') | float(-1) %}
          {% set r4 = state_attr('sensor.irrigation_unlimited_rain_4','max_value') | float(-1) %}
          {% if r0 != -1 and r1 != -1 and r2 != -1 and r3 != - 1 and r4 != -1 %}
            {% set rain_total = r0 %}
            {% set rain_total = rain_total + r1 * 0.7 %}
            {% set rain_total = rain_total + r2 * 0.3 %}
            {% set rain_total = rain_total + r3 * 0.15 %}
            {% set rain_total = rain_total + r4 * 0.05 %}
            {{ rain_total | round(1) }}
          {% else %}
            {{ -1 }}
          {% endif %}
    scan_interval: 600

Describe the bug

Zone 1 schedule is lost or at least I don't understand this behaviour. I'm using this component in combination with HASmartIrrigation and I have checked the % set according to weather conditions is fine (lets say 48% as of today) but the schedule shows "-1" as next schedule and irrigation never comes up. I've also checked removing the Smart irrigation time adjustment and reloading / rebooting but no luck so far. Here you are a picture of the card showing the schedule:

image

Debug log


Irrigation Unlimited
Version: 2023.2.1
If you have any issues with this you need to open an issue here:
https://github.com/rgc99/irrigation_unlimited/issues
-------------------------------------------------------------------
2023-02-20 15:02:02.303 DEBUG (MainThread) [custom_components.irrigation_unlimited] LOAD
2023-02-20 15:02:05.237 DEBUG (MainThread) [custom_components.irrigation_unlimited] REGISTER [2023-02-20 15:02:05] controller: 0, zone: 0, entity: irrigation_unlimited.coordinator
2023-02-20 15:02:05.238 INFO (MainThread) [custom_components.irrigation_unlimited] CALL [2023-02-20 15:02:05] service: adjust_time, controller: 1, zone: 1, data: {"percentage": 48.0}
2023-02-20 15:02:05.238 INFO (MainThread) [custom_components.irrigation_unlimited] CALL [2023-02-20 15:02:05] service: adjust_time, controller: 1, zone: 2, data: {"percentage": 100.0}
2023-02-20 15:02:05.241 INFO (MainThread) [custom_components.irrigation_unlimited] CALL [2023-02-20 15:02:05] service: adjust_time, controller: 1, zone: 3, data: {"percentage": 0.0}
2023-02-20 15:02:05.335 DEBUG (MainThread) [custom_components.irrigation_unlimited] START
2023-02-20 15:02:05.500 DEBUG (MainThread) [custom_components.irrigation_unlimited] REGISTER [2023-02-20 15:02:05] controller: 1, zone: 0, entity: binary_sensor.irrigation_unlimited_c1_m
2023-02-20 15:02:05.501 DEBUG (MainThread) [custom_components.irrigation_unlimited] REGISTER [2023-02-20 15:02:05] controller: 1, zone: 1, entity: binary_sensor.irrigation_unlimited_c1_z1
2023-02-20 15:02:05.501 DEBUG (MainThread) [custom_components.irrigation_unlimited] REGISTER [2023-02-20 15:02:05] controller: 1, zone: 2, entity: binary_sensor.irrigation_unlimited_c1_z2
2023-02-20 15:02:05.501 DEBUG (MainThread) [custom_components.irrigation_unlimited] REGISTER [2023-02-20 15:02:05] controller: 1, zone: 3, entity: binary_sensor.irrigation_unlimited_c1_z3
2023-02-20 15:02:05.501 DEBUG (MainThread) [custom_components.irrigation_unlimited] REGISTER [2023-02-20 15:02:05] controller: 1, zone: 4, entity: binary_sensor.irrigation_unlimited_c1_z4



@rgc99
Copy link
Owner

rgc99 commented Feb 21, 2023

First up, what you are seeing -1 day, 23:59:33 is a bug. A time calculation has gone negative and should have been caught. However, it remains that sequence 1 should not run and display no future schedule.

Just focusing on the Cesped sequence as everything else seems fine. The nominal run time is 5 on + 5 delay + 5 on = 15 minutes total (there is a repeat which will introduce the delay). In the Invierno schedule for example you have a run time of 3 minutes. When a duration is specified in the schedule it will attempt to alter all the zone run times to fit - the delays remains consistent. With a delay of 5 minutes this time frame cannot be achieved. It would have to be -1.5 on + 5 delay + -1.5 on. Negative on times means it does not run.

The solution is to increase the duration parameter in the schedules. The minimum value is 5 minutes below which it is effectively off.

@koldogut
Copy link
Author

koldogut commented Feb 21, 2023

Perfect! thanks for your quick answer, I've changed the schedules and now seems to work fine, haven't had the choice to test it yet but -1 schedule has dissapeared. I guess the following settings are OK according to your explanations

sequences:
  - name: "Cesped"
    duration: "00:05"
    delay: "00:05"
    repeat: 2
    schedules:
      - name: "Invierno"
        time: "00:10"
        weekday: [mon, thu]
        month: [dec, jan, feb]
        duration: "00:11" # 3 + 5delay + 3
      - name: "Verano"
        time: "00:10" 
        weekday: [sun, mon, tue, wed, thu, fri, sat]
        month: [jun, jul, aug, sep]
        duration: "00:15" # 5 + 5delay +5
      - name: "Primavera y Otoño"
        time: "00:10"
        weekday: [mon, wed, fri]
        month: [mar, apr, may, oct, nov]
        duration: "00:09" # 2 + 5delay +2
    zones:
      - zone_id: 1

`

Companion Card looks fine:

image

@rgc99
Copy link
Owner

rgc99 commented Feb 23, 2023

Looks like your on the right track.

Enjoy.

@koldogut
Copy link
Author

Works great, thanks for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants