rgc99 / irrigation_unlimited

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

Adjustment properties remain empty #153

Open f1ren opened 12 months ago

f1ren commented 12 months ago

Background

I love Irrigation Unlimited ❤️ It's great! Thank you so much!

Describe the bug

After calling

service: irrigation_unlimited.adjust_time
data:
  entity_id: binary_sensor.irrigation_unlimited_front_eastern_lawn
  actual: "00:05:00"

The Next adjustment of binary_sensor.irrigation_unlimited_front_eastern_lawn remains empty:

Next adjustment                             <- Empty!!!
Next schedule                             1
Next name                    Before sunrise
Next start  November 21, 2023 at 5:12:32 AM
Next duration                       0:30:00

In addition, when evaluating the following template, the result is empty:

{{ (state_attr('binary_sensor.irrigation_unlimited_front_eastern_lawn', 'next_adjustment')) }}

Version of the custom_component

2023.11.0

Configuration


rename_entities: true
controllers:
  - name: "Front"
    controller_id: "front"
    entity_id: "switch.garden_tap_x2_right"
    preamble: -00:00:02
    postamble: -00:00:02
    zones:
      - entity_id: "switch.garden_tap_x4_l1"
        name: "Mock" # Bug workaround: the schedule of the first zone is always unknown :(
        enabled: false
        zone_id: "mock"
      - entity_id: "switch.garden_tap_x4_l2"
        name: "Eastern lawn"
        zone_id: "eastern_lawn"
        minimum: "00:00"
        maximum: "50:00"
        future_span: 7
      - entity_id: "switch.garden_tap_x4_l1"
        name: "Western lawn"
        zone_id: "western_lawn"
        minimum: "00:00"
        maximum: "50:00"
        future_span: 7
      - entity_id: "switch.garden_tap_x4_l3"
        name: "Planting bed"
        zone_id: "planting_bed"
        minimum: "00:00:00"
        maximum: "01:30:00"
      - entity_id: "switch.garden_tap_x4_l4"
        name: "Trees"
        zone_id: "trees"
        minimum: "00:00:00"
        maximum: "01:30:00"
    sequences:
      - name: "Lawns"
        delay: "00:01"
        schedules:
          - name: "Before sunrise"
            schedule_id: "before_sunrise_first"
            time:
              sun: "sunrise"
              before: "00:01"
            anchor: finish
            weekday: [tue]
        zones:
          - zone_id: "eastern_lawn"
            duration: "00:30"
          - zone_id: "western_lawn"
            duration: "00:30"
      - name: "Trees and plants"
        delay: "00:01"
        duration: "00:10"
        schedules:
          - name: "After sunrise"
            schedule_id: "after_sunrise"
            time:
              sun: "sunrise"
              after: "00:01"
            weekday: [sun, tue, thu]
        zones:
          - zone_id: "planting_bed"
            duration: "00:15"
          - zone_id: "trees"
            duration: "00:10"

Tried with different entity_id and actual values. Same problem.

Debug log


2023-11-20 17:01:56.462 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=irrigation_unlimited, service=adjust_time, service_data=entity_id=binary_sensor.irrigation_unlimited_front_eastern_lawn, actual=00:05:00>
2023-11-20 17:01:56.465 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=irrigation_unlimited.coordinator, old_state=<state irrigation_unlimited.coordinator=ok; controller_count=1, configuration={"version": "1.0.0", "controllers": [{"index": 0, "name": "Front", "controller_id": "front", "entity_base": "front", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:water-off", "status": "off", "zones": [{"index": 0, "name": "Mock", "state": "off", "enabled": false, "suspended": null, "icon": "mdi:circle-off-outline", "zone_id": "mock", "entity_base": "front_mock", "status": "disabled", "adjustment": "=0:00:00", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l1"]}, {"index": 1, "name": "Eastern lawn", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "eastern_lawn", "entity_base": "front_eastern_lawn", "status": "off", "adjustment": "=0:01:00", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l2"]}, {"index": 2, "name": "Western lawn", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "western_lawn", "entity_base": "front_western_lawn", "status": "off", "adjustment": "", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l1"]}, {"index": 3, "name": "Planting bed", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "planting_bed", "entity_base": "front_planting_bed", "status": "off", "adjustment": "", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l3"]}, {"index": 4, "name": "Trees", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "trees", "entity_base": "front_trees", "status": "off", "adjustment": "", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l4"]}], "sequences": [{"index": 0, "name": "Lawns", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "default_duration": null, "default_delay": 60, "duration_factor": 1.0, "total_delay": 60, "total_duration": 3600, "adjusted_duration": 3600, "current_duration": 0, "adjustment": "", "schedules": [{"time": {"sun": "sunrise", "before": 60}, "anchor": "finish", "duration": null, "name": "Before sunrise", "enabled": true, "weekday": ["tue"]}], "sequence_zones": [{"index": 0, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 1800, "adjusted_duration": 1800, "final_duration": 1800, "zones": [2], "current_duration": 0, "adjustment": ""}, {"index": 1, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 1800, "adjusted_duration": 1800, "final_duration": 1800, "zones": [3], "current_duration": 0, "adjustment": ""}]}, {"index": 1, "name": "Trees and plants", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "default_duration": 600, "default_delay": 60, "duration_factor": 1.0, "total_delay": 60, "total_duration": 1500, "adjusted_duration": 1500, "current_duration": 0, "adjustment": "", "schedules": [{"time": {"sun": "sunrise", "after": 60}, "anchor": "start", "duration": null, "name": "After sunrise", "enabled": true, "weekday": ["sun", "tue", "thu"]}], "sequence_zones": [{"index": 0, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 900, "adjusted_duration": 900, "final_duration": 900, "zones": [4], "current_duration": 0, "adjustment": ""}, {"index": 1, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 600, "adjusted_duration": 600, "final_duration": 600, "zones": [5], "current_duration": 0, "adjustment": ""}]}]}]}, icon=mdi:zodiac-aquarius, friendly_name=Irrigation Unlimited Coordinator @ 2023-11-11T14:59:16.381553+02:00>, new_state=<state irrigation_unlimited.coordinator=ok; controller_count=1, configuration={"version": "1.0.0", "controllers": [{"index": 0, "name": "Front", "controller_id": "front", "entity_base": "front", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:water-off", "status": "off", "zones": [{"index": 0, "name": "Mock", "state": "off", "enabled": false, "suspended": null, "icon": "mdi:circle-off-outline", "zone_id": "mock", "entity_base": "front_mock", "status": "disabled", "adjustment": "=0:00:00", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l1"]}, {"index": 1, "name": "Eastern lawn", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "eastern_lawn", "entity_base": "front_eastern_lawn", "status": "off", "adjustment": "=0:05:00", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l2"]}, {"index": 2, "name": "Western lawn", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "western_lawn", "entity_base": "front_western_lawn", "status": "off", "adjustment": "", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l1"]}, {"index": 3, "name": "Planting bed", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "planting_bed", "entity_base": "front_planting_bed", "status": "off", "adjustment": "", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l3"]}, {"index": 4, "name": "Trees", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:valve-closed", "zone_id": "trees", "entity_base": "front_trees", "status": "off", "adjustment": "", "current_duration": 0, "schedules": [], "switch_entity_id": ["switch.garden_tap_x4_l4"]}], "sequences": [{"index": 0, "name": "Lawns", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "default_duration": null, "default_delay": 60, "duration_factor": 1.0, "total_delay": 60, "total_duration": 3600, "adjusted_duration": 3600, "current_duration": 0, "adjustment": "", "schedules": [{"time": {"sun": "sunrise", "before": 60}, "anchor": "finish", "duration": null, "name": "Before sunrise", "enabled": true, "weekday": ["tue"]}], "sequence_zones": [{"index": 0, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 1800, "adjusted_duration": 1800, "final_duration": 1800, "zones": [2], "current_duration": 0, "adjustment": ""}, {"index": 1, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 1800, "adjusted_duration": 1800, "final_duration": 1800, "zones": [3], "current_duration": 0, "adjustment": ""}]}, {"index": 1, "name": "Trees and plants", "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "default_duration": 600, "default_delay": 60, "duration_factor": 1.0, "total_delay": 60, "total_duration": 1500, "adjusted_duration": 1500, "current_duration": 0, "adjustment": "", "schedules": [{"time": {"sun": "sunrise", "after": 60}, "anchor": "start", "duration": null, "name": "After sunrise", "enabled": true, "weekday": ["sun", "tue", "thu"]}], "sequence_zones": [{"index": 0, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 900, "adjusted_duration": 900, "final_duration": 900, "zones": [4], "current_duration": 0, "adjustment": ""}, {"index": 1, "state": "off", "enabled": true, "suspended": null, "icon": "mdi:stop-circle-outline", "status": "off", "delay": 60, "base_duration": 600, "adjusted_duration": 600, "final_duration": 600, "zones": [5], "current_duration": 0, "adjustment": ""}]}]}]}, icon=mdi:zodiac-aquarius, friendly_name=Irrigation Unlimited Coordinator @ 2023-11-11T14:59:16.381553+02:00>>
rgc99 commented 11 months ago

It does appear to update the entity.

INFO:custom_components.irrigation_unlimited:CALL [2023-11-20 17:00:00] service: adjust_time, controller: 1, zone: 2, data: {"entity_id": ["binary_sensor.irrigation_unlimited_front_eastern_lawn"], "actual": "0:05:00"}

Print of entity attributes

{'zone_id': 'eastern_lawn', 'index': 1, 'enabled': True, 'suspended': None, 'status': 'off', 'schedule_count': 0, 'schedules': '', 'adjustment': '=0:05:00', 'current_schedule': None, 'percent_complete': 0, 'next_adjustment': '=0:05:00', 'next_schedule': 1, 'next_name': 'Before sunrise', 'next_start': datetime.datetime(2023, 11, 21, 5, 47, 50, tzinfo=zoneinfo.ZoneInfo(key='US/Pacific')), 'next_duration': '0:05:00', 'today_total': 0.0, 'volume': None, 'flow_rate': None, 'icon': 'mdi:valve-closed', 'friendly_name': 'Eastern lawn'}

Make sure there is no adjustment on the sequence as it will take priority over the zone.