# Filename: irrigation_unlimited_smart_irrigation.yaml
#
# Verion: 1.0.3
#
# Description: Example automation for HAsmartirrigation integration
# (smart_irrigation)[https://github.com/jeroenterheerdt/HAsmartirrigation]
#
# This file is a package and should be located in the config/packages
# folder. If you do not have a packages folder then create it and add
# the following to configuration.yaml
#
# homeassistant:
#  packages: !include_dir_named packages
#
# More information on packages can be found at https://www.home-assistant.io/docs/configuration/packages
#
# automation:
#   - id: "IU1653097957047"
#     alias: Smart Irrigation adjustment
#     description: Adjust watering times based on smart irrigation calculations
#     trigger:
#       - platform: time
#         at: "23:30"
#     condition:
#       condition: and
#       conditions:
#         - "{{ states('sensor.smart_irrigation_daily_adjusted_run_time') | float(-1) >= 0 }}"
#     action:
#       - service: irrigation_unlimited.adjust_time
#         data:
#           actual: "{{ timedelta(seconds=states('sensor.smart_irrigation_daily_adjusted_run_time') | int(0)) }}"
#           # -------------------------------------------------------------------
#           # Please see documentation regarding the adjust_time service call.
#           # Choose an option below. Comment out/delete as needed. This will NOT work as is.
#           # 1. Adjust a single zone. Change the zone as required
#           # entity_id: binary_sensor.irrigation_unlimited_c1_z1
#           # 2. Adjust a sequence. Change the sequence_id as required
#           # entity_id: binary_sensor.irrigation_unlimited_c1_m
#           # sequence_id: 1
#           # -------------------------------------------------------------------
#     mode: single

#   - id: "IU1653098247170"
#     alias: 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"
#     condition:
#       - condition: numeric_state
#         above: "0"
#         entity_id: sensor.smart_irrigation_daily_adjusted_run_time
#     action:
#       - delay:
#           hours: 0
#           minutes: 0

#       #- service: smart_irrigation.smart_irrigation_reset_bucket
