[ { "id": "dryback_completed", "automation": "- id: dryback_completed\n alias: Dryback Completed\n description: Records a completed dryback cycle in the history\n trigger:\n - platform: state\n entity_id: sensor.dryback_last_valley_time\n condition:\n - condition: template\n value_template: '{{ trigger.to_state.state != ''unknown'' and trigger.to_state.state\n != trigger.from_state.state }}'\n - condition: template\n value_template: '{{ states(''sensor.dryback_last_percentage'') | float >= states(''input_number.cs_dryback_min_percentage'')\n | float }}'\n - condition: template\n value_template: '{{ states(''sensor.dryback_last_duration'') | float >= states(''input_number.cs_dryback_min_duration'')\n | float }}'\n action:\n - variables:\n timestamp: '{{ as_timestamp(now()) }}'\n peak_time: '{{ states(''sensor.dryback_last_peak_time'') }}'\n valley_time: '{{ states(''sensor.dryback_last_valley_time'') }}'\n peak_vwc: '{{ states(''sensor.dryback_last_peak_vwc'') }}'\n valley_vwc: '{{ states(''sensor.dryback_last_valley_vwc'') }}'\n percentage: '{{ states(''sensor.dryback_last_percentage'') }}'\n duration: '{{ states(''sensor.dryback_last_duration'') }}'\n phase: '{{ states(''input_select.crop_steering_phase'') }}'\n current_history: '{{ states(''input_text.dryback_history_json'') }}'\n - service: input_text.set_value\n target:\n entity_id: input_text.dryback_history_json\n data:\n value: \"{% if current_history is string and current_history|first == '[' %}\\n\\\n \\ {% set history = current_history | from_json(default=[]) %}\\n {% set new_entry\\\n \\ = {\\n 'timestamp': timestamp | float(0),\\n 'peak_time': peak_time,\\n\\\n \\ 'valley_time': valley_time,\\n 'peak_vwc': peak_vwc | float(0),\\n \\\n \\ 'valley_vwc': valley_vwc | float(0),\\n 'percentage': percentage | float(0),\\n\\\n \\ 'duration': duration | float(0),\\n 'phase': phase\\n } %}\\n {% set\\\n \\ updated = [new_entry] + history %}\\n {% if updated | length > 100 %}\\n\\\n \\ {% set updated = updated[:100] %}\\n {% endif %}\\n {{ updated | to_json\\\n \\ }}\\n{% else %}\\n {% set new_entry = {\\n 'timestamp': as_timestamp(now()),\\n\\\n \\ 'peak_time': peak_time,\\n 'valley_time': valley_time,\\n 'peak_vwc':\\\n \\ peak_vwc | float(0),\\n 'valley_vwc': valley_vwc | float(0),\\n 'percentage':\\\n \\ percentage | float(0),\\n 'duration': duration | float(0),\\n 'phase':\\\n \\ phase\\n } %}\\n {{ [new_entry] | to_json }}\\n{% endif %}\\n\"\n - service: persistent_notification.create\n data:\n title: Dryback Cycle Completed\n message: 'A dryback cycle has been completed:\n\n Start: {{ peak_time }} End: {{ valley_time }} Duration: {{ duration }} minutes\n Dryback: {{ percentage }}% Phase: {{ phase }}\n\n Peak VWC: {{ peak_vwc }}% Valley VWC: {{ valley_vwc }}%\n\n '\n notification_id: dryback_completed", "config": [ { "name": "dryback last valley time sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_last_valley_time", "device_id": null } }, { "name": "dryback last percentage sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_last_percentage", "device_id": null } }, { "name": "dryback last duration sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_last_duration", "device_id": null } }, { "name": "dryback min percentage input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_dryback_min_percentage", "device_id": null } }, { "name": "dryback min duration input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_dryback_min_duration", "device_id": null } }, { "name": "dryback last peak time sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_last_peak_time", "device_id": null } }, { "name": "dryback last peak vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_last_peak_vwc", "device_id": null } }, { "name": "dryback last valley vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_last_valley_vwc", "device_id": null } }, { "name": "crop steering phase select", "room": null, "type": "input_select", "id": { "entity_id": "input_select.crop_steering_phase", "device_id": null } }, { "name": "dryback history json input", "room": null, "type": "input_text", "id": { "entity_id": "input_text.dryback_history_json", "device_id": null } } ] }, { "id": "dryback_reset_potential_peak", "automation": "- id: dryback_reset_potential_peak\n alias: Reset Potential Peak\n description: Resets the potential peak detection after irrigation\n trigger:\n - platform: state\n entity_id: switch.cs_configured_pump_switch\n from: 'on'\n to: 'off'\n action:\n - service: homeassistant.update_entity\n target:\n entity_id: sensor.dryback_potential_peak\n - delay:\n seconds: 300\n - service: homeassistant.update_entity\n target:\n entity_id: sensor.dryback_potential_peak", "config": [ { "name": "dryback potential peak sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.dryback_potential_peak", "device_id": null } }, { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } } ] }, { "id": "improved_crop_steering_change_to_p0", "automation": "- id: improved_crop_steering_change_to_p0\n alias: Crop Steering - Change to P0 at lights-on\n description: Changes the crop steering phase to P0 when lights turn on\n trigger:\n - platform: time\n at: input_datetime.cs_lights_on_time\n action:\n - service: input_select.select_option\n data:\n option: P0\n target:\n entity_id: input_select.cs_crop_steering_phase\n - service: input_number.set_value\n target:\n entity_id: input_number.cs_p1_shot_count\n data:\n value: 0\n - service: input_number.set_value\n target:\n entity_id: input_number.cs_p2_shot_count\n data:\n value: 0\n - service: input_number.set_value\n target:\n entity_id: input_number.cs_p3_shot_count\n data:\n value: 0\n mode: single", "config": [ { "name": "lights on time input", "room": null, "type": "input_datetime", "id": { "entity_id": "input_datetime.cs_lights_on_time", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "p1 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_shot_count", "device_id": null } }, { "name": "p2 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p2_shot_count", "device_id": null } }, { "name": "p3 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p3_shot_count", "device_id": null } } ] }, { "id": "improved_crop_steering_p0_to_p1", "automation": "- id: improved_crop_steering_p0_to_p1\n alias: Crop Steering - P0 to P1 Transition\n description: Transitions from P0 to P1 based on dryback target or maximum wait time\n trigger:\n - platform: state\n entity_id:\n - sensor.cs_configured_avg_vwc\n - platform: template\n value_template: '{{ states(''sensor.cs_minutes_since_lights_on'') | int % 5 ==\n 0 }}'\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P0\n - condition: template\n value_template: '{{ states(''sensor.cs_minutes_since_lights_on'') | int >= states(''input_number.cs_p0_min_wait_time'')\n | int }}'\n action:\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ states(''sensor.cs_configured_avg_vwc'') | float <= states(''sensor.cs_dynamic_p0_dryback'')\n | float }}'\n sequence:\n - service: input_select.select_option\n data:\n option: P1\n target:\n entity_id: input_select.cs_crop_steering_phase\n - service: notify.mobile_app_notify\n data:\n title: Crop Steering Phase Change\n message: 'Transitioned to P1 (Ramp-Up Phase) after reaching dryback target\n of {{ states(''sensor.cs_dynamic_p0_dryback'') }}%. Current VWC: {{ states(''sensor.cs_configured_avg_vwc'')\n }}% # Use configured entity\n\n '\n data:\n tag: crop_steering_phase_change\n - conditions:\n - condition: template\n value_template: '{{ states(''sensor.cs_minutes_since_lights_on'') | int >=\n states(''input_number.cs_p0_max_wait_time'') | int }}'\n sequence:\n - service: input_select.select_option\n data:\n option: P1\n target:\n entity_id: input_select.cs_crop_steering_phase\n - service: notify.mobile_app_notify\n data:\n title: Crop Steering Phase Change\n message: 'Transitioned to P1 (Ramp-Up Phase) after reaching maximum wait\n time of {{ states(''input_number.cs_p0_max_wait_time'') }} minutes. Current\n VWC: {{ states(''sensor.cs_configured_avg_vwc'') }}% # Use configured\n entity\n\n '\n data:\n tag: crop_steering_phase_change\n mode: single", "config": [ { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "configured avg vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_vwc", "device_id": null } }, { "name": "minutes since lights on sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_minutes_since_lights_on", "device_id": null } }, { "name": "p0 min wait time input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p0_min_wait_time", "device_id": null } }, { "name": "dynamic p0 dryback sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p0_dryback", "device_id": null } }, { "name": "p0 max wait time input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p0_max_wait_time", "device_id": null } }, { "name": "mobile app notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_notify", "device_id": null } }, { "name": "dynamic p0 dryback sensor 2", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p0_dryback", "device_id": null } } ] }, { "id": "improved_crop_steering_p1_to_p2", "automation": "- id: improved_crop_steering_p1_to_p2\n alias: Crop Steering - P1 to P2 Transition\n description: Transitions from P1 to P2 based on shot count, VWC, or EC\n trigger:\n - platform: state\n entity_id: input_number.cs_p1_shot_count\n - platform: numeric_state\n entity_id:\n - sensor.cs_configured_avg_vwc\n above: input_number.cs_substrate_field_capacity\n - platform: numeric_state\n entity_id:\n - sensor.cs_configured_avg_ec\n below: input_number.cs_ec_target_flush\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P1\n action:\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ states(''input_number.cs_p1_shot_count'') | float >= states(''input_number.cs_p1_max_shots'')\n | float }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.cs_crop_steering_phase\n data:\n option: P2\n - service: notify.mobile_app_notify\n data:\n title: Crop Steering Phase Change\n message: 'Transitioned to P2 (Maintenance Phase) after reaching maximum\n shot count of {{ states(''input_number.cs_p1_max_shots'') }}. Current\n VWC: {{ states(''sensor.cs_configured_avg_vwc'') }}% # Use configured\n entity\n\n '\n data:\n tag: crop_steering_phase_change\n - conditions:\n - condition: numeric_state\n entity_id: sensor.cs_configured_avg_vwc\n above: '{{ states(''input_number.cs_p1_target_vwc'') }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.cs_crop_steering_phase\n data:\n option: P2\n - service: notify.mobile_app_notify\n data:\n title: Crop Steering Phase Change\n message: 'Transitioned to P2 (Maintenance Phase) after reaching target VWC\n of {{ states(''input_number.cs_p1_target_vwc'') }}%. Current VWC: {{ states(''sensor.cs_configured_avg_vwc'')\n }}% # Use configured entity\n\n '\n data:\n tag: crop_steering_phase_change\n - conditions:\n - condition: numeric_state\n entity_id: sensor.cs_configured_avg_ec\n below: input_number.cs_ec_target_flush\n - condition: numeric_state\n entity_id: sensor.cs_configured_avg_vwc\n above: input_number.cs_p1_target_vwc\n - condition: numeric_state\n entity_id: input_number.cs_p1_shot_count\n above: '{{ states(''input_number.cs_p1_min_shots'') | int -1 }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.cs_crop_steering_phase\n data:\n option: P2\n - service: notify.mobile_app_notify\n data:\n title: Crop Steering Phase Change\n message: 'Transitioned to P2 (Maintenance Phase) after reaching EC target.\n Current EC: {{ states(''sensor.cs_configured_avg_ec'') }} mS/cm # Use\n configured entity Current VWC: {{ states(''sensor.cs_configured_avg_vwc'')\n }}% # Use configured entity\n\n '\n data:\n tag: crop_steering_phase_change\n mode: single", "config": [ { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "p1 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_shot_count", "device_id": null } }, { "name": "configured avg vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_vwc", "device_id": null } }, { "name": "mobile app notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_notify", "device_id": null } }, { "name": "substrate field capacity input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_substrate_field_capacity", "device_id": null } }, { "name": "configured avg ec sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_ec", "device_id": null } }, { "name": "ec target flush input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_ec_target_flush", "device_id": null } }, { "name": "p1 max shots input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_max_shots", "device_id": null } }, { "name": "p1 target vwc input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_target_vwc", "device_id": null } }, { "name": "p1 min shots input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_min_shots", "device_id": null } } ] }, { "id": "improved_crop_steering_to_p3", "automation": "- id: improved_crop_steering_to_p3\n alias: Crop Steering - P2 to P3 Transition\n description: Transitions from P2 to P3 based on calculated time before lights-off\n trigger:\n - platform: template\n value_template: '{% set current_timestamp = as_timestamp(now()) %} {% set p3_start\n = as_timestamp(today_at(states(''sensor.cs_p3_start_time_calculated''))) %}\n # Renamed sensor dependency {% set diff_seconds = current_timestamp - p3_start\n %} {{ diff_seconds >= 0 and diff_seconds < 60 }}\n\n '\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P2\n action:\n - service: input_select.select_option\n data:\n option: P3\n target:\n entity_id: input_select.cs_crop_steering_phase\n - service: notify.mobile_app_notify\n data:\n title: Crop Steering Phase Change\n message: 'Transitioned to P3 (Overnight Dry Back Phase). {% if is_state(''input_select.cs_steering_mode'',\n ''Vegetative'') %} # Renamed Using vegetative dry back strategy ({{ states(''input_number.cs_p3_veg_last_irrigation'')\n }} min before lights-off). # Renamed {% else %} Using generative dry back\n strategy ({{ states(''input_number.cs_p3_gen_last_irrigation'') }} min before\n lights-off). # Renamed {% endif %}\n\n '\n data:\n tag: crop_steering_phase_change\n mode: single", "config": [ { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "mobile app notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_notify", "device_id": null } }, { "name": "p3 start time calculated sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p3_start_time_calculated", "device_id": null } }, { "name": "steering mode select", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_steering_mode", "device_id": null } }, { "name": "p3 veg last irrigation input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p3_veg_last_irrigation", "device_id": null } }, { "name": "p3 gen last irrigation input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p3_gen_last_irrigation", "device_id": null } } ] }, { "id": "improved_crop_steering_p1_irrigation", "automation": "- id: improved_crop_steering_p1_irrigation\n alias: Crop Steering - P1 Ramp-Up Irrigation\n description: Controls irrigation during P1 with gradually increasing shot sizes\n trigger:\n - platform: time_pattern\n minutes: /1\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P1\n - condition: template\n value_template: '{% set current_minute = now().minute | int %} {% set interval\n = states(''input_number.cs_p1_time_between_shots'') | int %} # Renamed {{ current_minute\n % interval == 0 }}\n\n '\n - condition: template\n value_template: '{{ states(''input_number.cs_p1_shot_count'') | int < states(''input_number.cs_p1_max_shots'')\n | int }}'\n - condition: state\n entity_id: switch.cs_configured_pump_switch\n state: 'off'\n action:\n - variables:\n shot_duration: '{{ states(''sensor.cs_p1_shot_duration_seconds'') | float }}'\n shot_count: '{{ states(''input_number.cs_p1_shot_count'') | int }}'\n shot_size_percent: '{{ states(''sensor.cs_p1_current_shot_size_percent'') |\n float }}'\n - service: switch.turn_on\n target:\n entity_id: switch.cs_configured_pump_switch\n - delay:\n seconds: '{{ shot_duration }}'\n - service: switch.turn_off\n target:\n entity_id: switch.cs_configured_pump_switch\n - service: input_number.set_value\n target:\n entity_id: input_number.cs_p1_shot_count\n data:\n value: '{{ shot_count + 1 }}'\n - service: logbook.log\n data:\n name: P1 Irrigation\n message: 'Ramp-Up Shot {{ shot_count + 1 }}: {{ shot_duration }}s ({{ shot_size_percent\n }}% of substrate volume) VWC Before: {{ states(''sensor.cs_configured_avg_vwc'')\n }}% # Use configured entity EC: {{ states(''sensor.cs_configured_avg_ec'')\n }} mS/cm # Use configured entity\n\n '\n mode: single", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "p1 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_shot_count", "device_id": null } }, { "name": "configured avg vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_vwc", "device_id": null } }, { "name": "configured avg ec sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_ec", "device_id": null } }, { "name": "p1 max shots input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_max_shots", "device_id": null } }, { "name": "p1 time between shots input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p1_time_between_shots", "device_id": null } }, { "name": "p1 shot duration seconds sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p1_shot_duration_seconds", "device_id": null } }, { "name": "p1 current shot size percent sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p1_current_shot_size_percent", "device_id": null } } ] }, { "id": "improved_crop_steering_p2_irrigation_on", "automation": "- id: improved_crop_steering_p2_irrigation_on\n alias: Crop Steering - P2 EC-Adjusted Irrigation On\n description: Turns on irrigation during P2 based on EC-adjusted VWC threshold\n trigger:\n - platform: state\n entity_id:\n - sensor.cs_configured_avg_vwc\n - platform: state\n entity_id:\n - sensor.cs_p2_vwc_threshold_ec_adjusted\n condition:\n - condition: numeric_state\n entity_id: sensor.cs_configured_avg_vwc\n below: sensor.cs_p2_vwc_threshold_ec_adjusted\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P2\n - condition: state\n entity_id: switch.cs_configured_pump_switch\n state: 'off'\n action:\n - variables:\n threshold: '{{ states(''sensor.cs_p2_vwc_threshold_ec_adjusted'') | float }}'\n current_vwc: '{{ states(''sensor.cs_configured_avg_vwc'') | float }}'\n ec_ratio: '{{ states(''sensor.cs_ec_ratio'') | float }}'\n shot_duration: '{{ states(''sensor.cs_p2_shot_duration_seconds'') | float }}'\n - service: switch.turn_on\n target:\n entity_id: switch.cs_configured_pump_switch\n - service: logbook.log\n data:\n name: P2 Irrigation Started\n message: 'Maintenance Irrigation: {{ shot_duration }}s VWC Before: {{ current_vwc\n }}% EC Ratio: {{ ec_ratio }} Adjusted Threshold: {{ threshold }}%\n\n '\n mode: single", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "configured avg vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_vwc", "device_id": null } }, { "name": "p2 vwc threshold ec adjusted sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p2_vwc_threshold_ec_adjusted", "device_id": null } }, { "name": "ec ratio sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_ec_ratio", "device_id": null } }, { "name": "p2 shot duration seconds sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p2_shot_duration_seconds", "device_id": null } } ] }, { "id": "improved_crop_steering_p2_irrigation_off_timed", "automation": "- id: improved_crop_steering_p2_irrigation_off_timed\n alias: Crop Steering - P2 Timed Irrigation Off\n description: Turns off irrigation during P2 after calculated duration\n trigger:\n - platform: state\n entity_id: switch.cs_configured_pump_switch\n from: 'off'\n to: 'on'\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P2\n action:\n - variables:\n shot_duration: '{{ states(''sensor.cs_p2_shot_duration_seconds'') | float }}'\n - delay:\n seconds: '{{ shot_duration if shot_duration > 0 else 1 }}'\n - service: switch.turn_off\n target:\n entity_id: switch.cs_configured_pump_switch\n - service: input_number.set_value\n target:\n entity_id: input_number.cs_p2_shot_count\n data:\n value: '{{ (states(''input_number.cs_p2_shot_count'') | int) + 1 }}'\n - service: logbook.log\n data:\n name: P2 Irrigation Completed\n message: 'Maintenance Irrigation Completed Duration: {{ shot_duration }}s VWC\n After: {{ states(''sensor.cs_configured_avg_vwc'') }}% # Use configured entity\n EC: {{ states(''sensor.cs_configured_avg_ec'') }} mS/cm # Use configured entity\n\n '\n mode: single", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "p2 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p2_shot_count", "device_id": null } }, { "name": "configured avg vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_vwc", "device_id": null } }, { "name": "configured avg ec sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_ec", "device_id": null } }, { "name": "p2 shot duration seconds sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p2_shot_duration_seconds", "device_id": null } } ] }, { "id": "improved_crop_steering_p2_irrigation_off_capacity", "automation": "- id: improved_crop_steering_p2_irrigation_off_capacity\n alias: Crop Steering - P2 Irrigation Off at Field Capacity\n description: Turns off irrigation during P2 when field capacity is reached\n trigger:\n - platform: numeric_state\n entity_id:\n - sensor.cs_configured_avg_vwc\n above: input_number.cs_substrate_field_capacity\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P2\n - condition: state\n entity_id: switch.cs_configured_pump_switch\n state: 'on'\n action:\n - service: switch.turn_off\n target:\n entity_id: switch.cs_configured_pump_switch\n - service: logbook.log\n data:\n name: P2 Irrigation Stopped\n message: 'Maintenance Irrigation Stopped - Field Capacity Reached VWC: {{ states(''sensor.cs_configured_avg_vwc'')\n }}% # Use configured entity Field Capacity: {{ states(''input_number.cs_substrate_field_capacity'')\n }}% # Renamed\n\n '\n mode: single", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "configured avg vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_avg_vwc", "device_id": null } }, { "name": "substrate field capacity input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_substrate_field_capacity", "device_id": null } } ] }, { "id": "improved_crop_steering_p3_emergency_irrigation", "automation": "- id: improved_crop_steering_p3_emergency_irrigation\n alias: Crop Steering - P3 Emergency Irrigation\n description: Provides emergency irrigation during P3 if VWC drops too low\n trigger:\n - platform: numeric_state\n entity_id:\n - sensor.cs_configured_min_vwc\n below: sensor.cs_dynamic_p3_dryback\n condition:\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P3\n - condition: state\n entity_id: switch.cs_configured_pump_switch\n state: 'off'\n action:\n - variables:\n shot_duration: '{{ states(''sensor.cs_p3_emergency_shot_duration_seconds'')\n | float }}'\n current_vwc: '{{ states(''sensor.cs_configured_min_vwc'') | float }}'\n threshold: '{{ states(''sensor.cs_dynamic_p3_dryback'') | float }}'\n - service: switch.turn_on\n target:\n entity_id: switch.cs_configured_pump_switch\n - delay:\n seconds: '{{ shot_duration }}'\n - service: switch.turn_off\n target:\n entity_id: switch.cs_configured_pump_switch\n - service: input_number.set_value\n target:\n entity_id: input_number.cs_p3_shot_count\n data:\n value: '{{ (states(''input_number.cs_p3_shot_count'') | int) + 1 }}'\n - service: logbook.log\n data:\n name: P3 Emergency Irrigation\n message: 'Emergency Irrigation During P3 Duration: {{ shot_duration }}s VWC\n Before: {{ current_vwc }}% Emergency Threshold: {{ threshold }}%\n\n '\n - service: notify.mobile_app_notify\n data:\n title: Emergency Irrigation\n message: 'Emergency irrigation triggered during P3 phase. VWC dropped to {{\n current_vwc }}% (below threshold of {{ threshold }}%).\n\n '\n data:\n tag: emergency_irrigation\n mode: single", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "p3 shot count input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p3_shot_count", "device_id": null } }, { "name": "mobile app notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_notify", "device_id": null } }, { "name": "configured min vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_configured_min_vwc", "device_id": null } }, { "name": "dynamic p3 dryback sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p3_dryback", "device_id": null } }, { "name": "p3 emergency shot duration seconds sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p3_emergency_shot_duration_seconds", "device_id": null } } ] }, { "id": "improved_steering_mode_changed", "automation": "- id: improved_steering_mode_changed\n alias: Improved Steering Mode Changed\n description: Updates parameters when steering mode changes\n trigger:\n - platform: state\n entity_id: input_select.cs_steering_mode\n action:\n - service: homeassistant.update_entity\n target:\n entity_id:\n - sensor.cs_dynamic_p0_dryback\n - sensor.cs_p3_start_time_calculated\n - sensor.cs_current_ec_target\n - service: notify.mobile_app_notify\n data:\n title: Growth Steering Mode Changed\n message: '{% if is_state(''input_select.cs_steering_mode'', ''Vegetative'')\n %} # Renamed Switched to Vegetative steering mode. P0 Dryback: {{ states(''input_number.cs_p0_veg_dryback_target'')\n }}% # Renamed P3 Start: {{ states(''input_number.cs_p3_veg_last_irrigation'')\n }} min before lights-off # Renamed {% else %} Switched to Generative steering\n mode. P0 Dryback: {{ states(''input_number.cs_p0_gen_dryback_target'') }}%\n # Renamed P3 Start: {{ states(''input_number.cs_p3_gen_last_irrigation'')\n }} min before lights-off # Renamed {% endif %}\n\n '\n data:\n tag: steering_mode_update\n mode: single", "config": [ { "name": "dynamic p0 dryback sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p0_dryback", "device_id": null } }, { "name": "mobile app notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_notify", "device_id": null } }, { "name": "p3 start time calculated sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_p3_start_time_calculated", "device_id": null } }, { "name": "steering mode select", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_steering_mode", "device_id": null } }, { "name": "p3 veg last irrigation input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p3_veg_last_irrigation", "device_id": null } }, { "name": "p3 gen last irrigation input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p3_gen_last_irrigation", "device_id": null } }, { "name": "dynamic p0 dryback sensor 2", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p0_dryback", "device_id": null } }, { "name": "current ec target sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_current_ec_target", "device_id": null } }, { "name": "p0 veg dryback target input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p0_veg_dryback_target", "device_id": null } }, { "name": "p0 gen dryback target input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.cs_p0_gen_dryback_target", "device_id": null } } ] }, { "id": "update_zone_status_from_selector", "automation": "- id: update_zone_status_from_selector\n alias: Update Zone Status from Selector\n description: Updates the individual zone enabled states based on the zone selector\n trigger:\n - platform: state\n entity_id: input_select.active_irrigation_zones\n action:\n - choose:\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: All Zones\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id:\n - input_boolean.zone_1_enabled\n - input_boolean.zone_2_enabled\n - input_boolean.zone_3_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: Zone 1 Only\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id: input_boolean.zone_1_enabled\n - service: input_boolean.turn_off\n target:\n entity_id:\n - input_boolean.zone_2_enabled\n - input_boolean.zone_3_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: Zone 2 Only\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id: input_boolean.zone_2_enabled\n - service: input_boolean.turn_off\n target:\n entity_id:\n - input_boolean.zone_1_enabled\n - input_boolean.zone_3_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: Zone 3 Only\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id: input_boolean.zone_3_enabled\n - service: input_boolean.turn_off\n target:\n entity_id:\n - input_boolean.zone_1_enabled\n - input_boolean.zone_2_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: Zones 1 & 2\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id:\n - input_boolean.zone_1_enabled\n - input_boolean.zone_2_enabled\n - service: input_boolean.turn_off\n target:\n entity_id: input_boolean.zone_3_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: Zones 1 & 3\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id:\n - input_boolean.zone_1_enabled\n - input_boolean.zone_3_enabled\n - service: input_boolean.turn_off\n target:\n entity_id: input_boolean.zone_2_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: Zones 2 & 3\n sequence:\n - service: input_boolean.turn_on\n target:\n entity_id:\n - input_boolean.zone_2_enabled\n - input_boolean.zone_3_enabled\n - service: input_boolean.turn_off\n target:\n entity_id: input_boolean.zone_1_enabled\n - conditions:\n - condition: state\n entity_id: input_select.active_irrigation_zones\n state: No Zones (Disabled)\n sequence:\n - service: input_boolean.turn_off\n target:\n entity_id:\n - input_boolean.zone_1_enabled\n - input_boolean.zone_2_enabled\n - input_boolean.zone_3_enabled\n default: []", "config": [ { "name": "active irrigation zones select", "room": null, "type": "input_select", "id": { "entity_id": "input_select.active_irrigation_zones", "device_id": null } }, { "name": "zone 1 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_1_enabled", "device_id": null } }, { "name": "zone 2 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_2_enabled", "device_id": null } }, { "name": "zone 3 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_3_enabled", "device_id": null } } ] }, { "id": "turn_on_irrigation_pump_zones", "automation": "- id: turn_on_irrigation_pump_zones\n alias: Turn On Irrigation Pump and Zones\n description: Turns on the mainline valve and selected zone valves based on configured\n entities\n trigger:\n - platform: state\n entity_id: switch.cs_configured_pump_switch\n to: 'on'\n action:\n - variables:\n pump_entity: '{{ states(''input_text.cs_config_pump_switch_entity'') }}'\n zone_switches: '{{ states(''input_text.cs_config_zone_switch_entities'').split('','')\n | map(''trim'') | reject(''=='', '''') | list }}'\n waste_switch: '{{ states(''input_text.cs_config_waste_switch_entity'') }}'\n zone1_switch: '{{ zone_switches[0] if zone_switches | length > 0 else none }}'\n zone2_switch: '{{ zone_switches[1] if zone_switches | length > 1 else none }}'\n zone3_switch: '{{ zone_switches[2] if zone_switches | length > 2 else none }}'\n - if:\n - '{{ waste_switch | length > 0 }}'\n then:\n - service: switch.turn_off\n target:\n entity_id: '{{ waste_switch }}'\n - service: switch.turn_on\n target:\n entity_id: '{{ pump_entity }}'\n - if:\n - '{{ zone1_switch is not none and is_state(''input_boolean.zone_1_enabled'',\n ''on'') }}'\n then:\n - service: switch.turn_on\n target:\n entity_id: '{{ zone1_switch }}'\n - if:\n - '{{ zone2_switch is not none and is_state(''input_boolean.zone_2_enabled'',\n ''on'') }}'\n then:\n - service: switch.turn_on\n target:\n entity_id: '{{ zone2_switch }}'\n - if:\n - '{{ zone3_switch is not none and is_state(''input_boolean.zone_3_enabled'',\n ''on'') }}'\n then:\n - service: switch.turn_on\n target:\n entity_id: '{{ zone3_switch }}'", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "zone 1 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_1_enabled", "device_id": null } }, { "name": "zone 2 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_2_enabled", "device_id": null } }, { "name": "zone 3 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_3_enabled", "device_id": null } }, { "name": "config pump switch entity input", "room": null, "type": "input_text", "id": { "entity_id": "input_text.cs_config_pump_switch_entity", "device_id": null } }, { "name": "config zone switch entities input", "room": null, "type": "input_text", "id": { "entity_id": "input_text.cs_config_zone_switch_entities", "device_id": null } }, { "name": "config waste switch entity input", "room": null, "type": "input_text", "id": { "entity_id": "input_text.cs_config_waste_switch_entity", "device_id": null } } ] }, { "id": "turn_off_irrigation_pump_zones", "automation": "- id: turn_off_irrigation_pump_zones\n alias: Turn Off Irrigation Pump and Zones\n description: Turns off all configured valves when the configured pump switch is\n turned off\n trigger:\n - platform: state\n entity_id: switch.cs_configured_pump_switch\n to: 'off'\n action:\n - variables:\n pump_entity: '{{ states(''input_text.cs_config_pump_switch_entity'') }}'\n zone_switches: '{{ states(''input_text.cs_config_zone_switch_entities'').split('','')\n | map(''trim'') | reject(''=='', '''') | list }}'\n zone1_switch: '{{ zone_switches[0] if zone_switches | length > 0 else none }}'\n zone2_switch: '{{ zone_switches[1] if zone_switches | length > 1 else none }}'\n zone3_switch: '{{ zone_switches[2] if zone_switches | length > 2 else none }}'\n - service: switch.turn_off\n target:\n entity_id: '{% set entities = [] %} {% if zone1_switch is not none %}{% set\n entities = entities + [zone1_switch] %}{% endif %} {% if zone2_switch is not\n none %}{% set entities = entities + [zone2_switch] %}{% endif %} {% if zone3_switch\n is not none %}{% set entities = entities + [zone3_switch] %}{% endif %} {{\n entities }}\n\n '\n - service: switch.turn_off\n target:\n entity_id: '{{ pump_entity }}'", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "config pump switch entity input", "room": null, "type": "input_text", "id": { "entity_id": "input_text.cs_config_pump_switch_entity", "device_id": null } }, { "name": "config zone switch entities input", "room": null, "type": "input_text", "id": { "entity_id": "input_text.cs_config_zone_switch_entities", "device_id": null } } ] }, { "id": "zone_specific_p2_irrigation_trigger", "automation": "- id: zone_specific_p2_irrigation_trigger\n alias: Zone-Specific P2 Irrigation Trigger\n description: Sets active zones and triggers main pump if any enabled zone needs\n P2 irrigation\n trigger:\n - platform: template\n value_template: \"{% set phase = states('input_select.cs_crop_steering_phase')\\\n \\ %} {% if phase == 'P2' %}\\n {% set zone1_enabled = is_state('input_boolean.zone_1_enabled',\\\n \\ 'on') %}\\n {% set zone2_enabled = is_state('input_boolean.zone_2_enabled',\\\n \\ 'on') %}\\n {% set zone3_enabled = is_state('input_boolean.zone_3_enabled',\\\n \\ 'on') %}\\n \\n {% set zone1_vwc = states('sensor.zone_1_vwc') | float(999)\\\n \\ %} {# Use local zone sensor #}\\n {% set zone2_vwc = states('sensor.zone_2_vwc')\\\n \\ | float(999) %} {# Use local zone sensor #}\\n {% set zone3_vwc = states('sensor.zone_3_vwc')\\\n \\ | float(999) %} {# Use local zone sensor #}\\n \\n {% set dryback_target =\\\n \\ states('sensor.cs_dynamic_p2_dryback') | float(0) %} {# Use dynamic target\\\n \\ #}\\n \\n {% if (zone1_enabled and zone1_vwc <= dryback_target) or\\n \\\n \\ (zone2_enabled and zone2_vwc <= dryback_target) or\\n (zone3_enabled\\\n \\ and zone3_vwc <= dryback_target) %}\\n true\\n {% else %}\\n false\\n \\\n \\ {% endif %}\\n{% else %}\\n false\\n{% endif %}\\n\"\n condition:\n - condition: state\n entity_id: switch.cs_configured_pump_switch\n state: 'off'\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P2\n action:\n - variables:\n dryback_target: '{{ states(''sensor.cs_dynamic_p2_dryback'') | float(0) }}'\n zone1_needs_irrigation: '{% set zone1_enabled = is_state(''input_boolean.zone_1_enabled'',\n ''on'') %} {% set zone1_vwc = states(''sensor.zone_1_vwc'') | float(999) %}\n {{ zone1_enabled and zone1_vwc <= dryback_target }}\n\n '\n zone2_needs_irrigation: '{% set zone2_enabled = is_state(''input_boolean.zone_2_enabled'',\n ''on'') %} {% set zone2_vwc = states(''sensor.zone_2_vwc'') | float(999) %}\n {{ zone2_enabled and zone2_vwc <= dryback_target }}\n\n '\n zone3_needs_irrigation: '{% set zone3_enabled = is_state(''input_boolean.zone_3_enabled'',\n ''on'') %} {% set zone3_vwc = states(''sensor.zone_3_vwc'') | float(999) %}\n {{ zone3_enabled and zone3_vwc <= dryback_target }}\n\n '\n - choose:\n - conditions: '{{ zone1_needs_irrigation and zone2_needs_irrigation and zone3_needs_irrigation\n }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: All Zones\n - conditions: '{{ zone1_needs_irrigation and zone2_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zones 1 & 2\n - conditions: '{{ zone1_needs_irrigation and zone3_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zones 1 & 3\n - conditions: '{{ zone2_needs_irrigation and zone3_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zones 2 & 3\n - conditions: '{{ zone1_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zone 1 Only\n - conditions: '{{ zone2_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zone 2 Only\n - conditions: '{{ zone3_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zone 3 Only\n default: []\n - service: switch.turn_on\n target:\n entity_id: switch.cs_configured_pump_switch", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "active irrigation zones select", "room": null, "type": "input_select", "id": { "entity_id": "input_select.active_irrigation_zones", "device_id": null } }, { "name": "zone 1 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_1_enabled", "device_id": null } }, { "name": "zone 2 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_2_enabled", "device_id": null } }, { "name": "zone 3 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_3_enabled", "device_id": null } }, { "name": "zone 1 vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.zone_1_vwc", "device_id": null } }, { "name": "zone 2 vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.zone_2_vwc", "device_id": null } }, { "name": "zone 3 vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.zone_3_vwc", "device_id": null } }, { "name": "dynamic p2 dryback sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p2_dryback", "device_id": null } } ] }, { "id": "zone_specific_p3_irrigation_trigger", "automation": "- id: zone_specific_p3_irrigation_trigger\n alias: Zone-Specific P3 Emergency Irrigation Trigger\n description: Sets active zones and triggers main pump if any enabled zone needs\n P3 emergency irrigation\n trigger:\n - platform: template\n value_template: \"{% set phase = states('input_select.cs_crop_steering_phase')\\\n \\ %} {% if phase == 'P3' %}\\n {% set zone1_enabled = is_state('input_boolean.zone_1_enabled',\\\n \\ 'on') %}\\n {% set zone2_enabled = is_state('input_boolean.zone_2_enabled',\\\n \\ 'on') %}\\n {% set zone3_enabled = is_state('input_boolean.zone_3_enabled',\\\n \\ 'on') %}\\n \\n {% set zone1_vwc = states('sensor.zone_1_vwc') | float(999)\\\n \\ %} {# Use local zone sensor #}\\n {% set zone2_vwc = states('sensor.zone_2_vwc')\\\n \\ | float(999) %} {# Use local zone sensor #}\\n {% set zone3_vwc = states('sensor.zone_3_vwc')\\\n \\ | float(999) %} {# Use local zone sensor #}\\n \\n {% set dryback_target =\\\n \\ states('sensor.cs_dynamic_p3_dryback') | float(0) %} {# Use dynamic target\\\n \\ #}\\n \\n {% if (zone1_enabled and zone1_vwc <= dryback_target) or\\n \\\n \\ (zone2_enabled and zone2_vwc <= dryback_target) or\\n (zone3_enabled\\\n \\ and zone3_vwc <= dryback_target) %}\\n true\\n {% else %}\\n false\\n \\\n \\ {% endif %}\\n{% else %}\\n false\\n{% endif %}\\n\"\n condition:\n - condition: state\n entity_id: switch.cs_configured_pump_switch\n state: 'off'\n - condition: state\n entity_id: input_select.cs_crop_steering_phase\n state: P3\n action:\n - variables:\n dryback_target: '{{ states(''sensor.cs_dynamic_p3_dryback'') | float(0) }}'\n zone1_needs_irrigation: '{% set zone1_enabled = is_state(''input_boolean.zone_1_enabled'',\n ''on'') %} {% set zone1_vwc = states(''sensor.zone_1_vwc'') | float(999) %}\n {{ zone1_enabled and zone1_vwc <= dryback_target }}\n\n '\n zone2_needs_irrigation: '{% set zone2_enabled = is_state(''input_boolean.zone_2_enabled'',\n ''on'') %} {% set zone2_vwc = states(''sensor.zone_2_vwc'') | float(999) %}\n {{ zone2_enabled and zone2_vwc <= dryback_target }}\n\n '\n zone3_needs_irrigation: '{% set zone3_enabled = is_state(''input_boolean.zone_3_enabled'',\n ''on'') %} {% set zone3_vwc = states(''sensor.zone_3_vwc'') | float(999) %}\n {{ zone3_enabled and zone3_vwc <= dryback_target }}\n\n '\n - choose:\n - conditions: '{{ zone1_needs_irrigation and zone2_needs_irrigation and zone3_needs_irrigation\n }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: All Zones\n - conditions: '{{ zone1_needs_irrigation and zone2_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zones 1 & 2\n - conditions: '{{ zone1_needs_irrigation and zone3_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zones 1 & 3\n - conditions: '{{ zone2_needs_irrigation and zone3_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zones 2 & 3\n - conditions: '{{ zone1_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zone 1 Only\n - conditions: '{{ zone2_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zone 2 Only\n - conditions: '{{ zone3_needs_irrigation }}'\n sequence:\n - service: input_select.select_option\n target:\n entity_id: input_select.active_irrigation_zones\n data:\n option: Zone 3 Only\n default: []\n - service: switch.turn_on\n target:\n entity_id: switch.cs_configured_pump_switch", "config": [ { "name": "configured pump switch", "room": null, "type": "switch", "id": { "entity_id": "switch.cs_configured_pump_switch", "device_id": null } }, { "name": "crop steering phase select 2", "room": null, "type": "input_select", "id": { "entity_id": "input_select.cs_crop_steering_phase", "device_id": null } }, { "name": "dynamic p3 dryback sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.cs_dynamic_p3_dryback", "device_id": null } }, { "name": "active irrigation zones select", "room": null, "type": "input_select", "id": { "entity_id": "input_select.active_irrigation_zones", "device_id": null } }, { "name": "zone 1 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_1_enabled", "device_id": null } }, { "name": "zone 2 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_2_enabled", "device_id": null } }, { "name": "zone 3 enabled input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.zone_3_enabled", "device_id": null } }, { "name": "zone 1 vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.zone_1_vwc", "device_id": null } }, { "name": "zone 2 vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.zone_2_vwc", "device_id": null } }, { "name": "zone 3 vwc sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.zone_3_vwc", "device_id": null } } ] }, { "id": "F1 Light Acclimation", "automation": "- alias: F1 Light Acclimation\n description: Linear increase from 50% to 90% over 21 days, then disable itself\n mode: single\n trigger:\n - platform: time\n at: input_datetime.f1_lights_on_time\n action:\n - service: light.turn_on\n target:\n entity_id: light.f1_light_group\n data:\n brightness: '{{ states(''input_number.f1_target_brightness'') | float | round\n }}'\n - service: input_number.set_value\n target:\n entity_id: input_number.f1_target_brightness\n data:\n value: '{{ [states(''input_number.f1_target_brightness'') | float + 5.1, 229.5]\n | min }}'\n - choose:\n - conditions:\n - condition: numeric_state\n entity_id: input_number.f1_target_brightness\n above: 229.4\n sequence:\n - service: notify.mobile_app_s23ultra\n data:\n message: '✅ F1 Light Acclimation complete: reached 90% brightness.'\n - service: automation.turn_off\n target:\n entity_id: automation.f1_light_acclimation", "config": [ { "name": "f1 lights on time input", "room": null, "type": "input_datetime", "id": { "entity_id": "input_datetime.f1_lights_on_time", "device_id": null } }, { "name": "f1 light group", "room": null, "type": "light", "id": { "entity_id": "light.f1_light_group", "device_id": null } }, { "name": "f1 target brightness input", "room": null, "type": "input_number", "id": { "entity_id": "input_number.f1_target_brightness", "device_id": null } }, { "name": "mobile app s23ultra notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_s23ultra", "device_id": null } }, { "name": "f1 light acclimation automation", "room": null, "type": "automation", "id": { "entity_id": "automation.f1_light_acclimation", "device_id": null } } ] }, { "id": "Tank Low Level Refill and Dose", "automation": "- alias: Tank Low Level Refill and Dose\n description: Manages tank refill and dosing process when water level drops below\n 0.6 or manual button press. Checks pH and EC values after dosing and alerts if\n out of range.\n mode: single\n trigger:\n - platform: numeric_state\n entity_id: sensor.aqua_pro_water_level\n below: 5\n for:\n minutes: 1\n id: water_level\n enabled: false\n - platform: state\n entity_id: input_button.manual_tank_fill\n id: manual_button\n enabled: true\n - platform: state\n entity_id: binary_sensor.tank_sensor_tank_level\n from: 'on'\n to: 'off'\n - platform: numeric_state\n entity_id: sensor.aqua_pro_water_level\n below: 0.06\n condition:\n - condition: state\n entity_id: input_boolean.tank_fill_safety_switch\n state: 'on'\n - condition: numeric_state\n entity_id: sensor.aqua_pro_water_level\n below: 0.06\n action:\n - service: notify.mobile_app_s23ultra\n data:\n message: Starting tank fill sequence - Turning off irrigation\n data:\n tag: tank_fill_process\n - service: input_boolean.turn_on\n target:\n entity_id: input_boolean.nutrient_dosing_active\n - service: switch.turn_off\n target:\n entity_id:\n - switch.f1_irrigation_relays_relay_1\n - switch.f1_irrigation_relays_relay_2\n - switch.f1_irrigation_relays_relay_3\n - switch.f1_irrigation_relays_relay_4\n - switch.waste_valve\n - delay: 00:00:05\n - service: switch.turn_off\n target:\n entity_id:\n - switch.espoe_irrigation_relay_1_2\n - switch.espoe_irrigation_relay_2_4\n - delay: 00:00:05\n - service: notify.mobile_app_s23ultra\n data:\n message: Turning on tank fill valve\n data:\n tag: tank_fill_process\n - service: switch.turn_on\n target:\n entity_id: switch.espoe_irrigation_relay_1_4\n - service: notify.mobile_app_s23ultra\n data:\n message: Starting tank fill - Running for 10 minutes\n data:\n tag: tank_fill_process\n - delay: 00:10:00\n - service: notify.mobile_app_s23ultra\n data:\n title: Tank Fill Progress\n message: Tank fill complete - Starting circulation\n data:\n tag: tank_fill_process\n - service: switch.turn_off\n target:\n entity_id:\n - switch.pump_power_switch\n - switch.f1_irrigation_pump_master_switch\n - service: switch.turn_on\n target:\n entity_id:\n - switch.espoe_irrigation_relay_2_4\n - switch.espoe_irrigation_relay_1_1\n - delay: 00:00:03\n - service: switch.turn_on\n target:\n entity_id: switch.pump_power_switch\n - delay: 00:00:02\n - service: switch.turn_on\n target:\n entity_id: switch.f1_irrigation_pump_master_switch\n - delay: 00:00:15\n - condition: numeric_state\n entity_id: sensor.pump_power_switch_power\n above: 100\n - service: notify.mobile_app_s23ultra\n data:\n title: Tank Fill Progress\n message: Starting nutrient dosing\n data:\n tag: tank_fill_process\n - choose:\n - conditions:\n - condition: numeric_state\n entity_id: sensor.pump_power_switch_power\n below: 100\n sequence:\n - service: switch.turn_off\n target:\n entity_id: switch.f1_irrigation_pump_master_switch\n - delay: 00:00:05\n - service: switch.turn_on\n target:\n entity_id: switch.f1_irrigation_pump_master_switch\n - delay: 00:00:10\n - service: notify.mobile_app_s23ultra\n data:\n message: 'URGENT: Pump power below 100W after reset. Stopping automation.'\n priority: high\n data:\n tag: tank_fill_error\n - stop\n - delay: 00:00:30\n - service: mqtt.publish\n data:\n topic: AQU1AD04A42/ctr\n payload: '{\"cmd\": \"setNutrient\", \"msgid\": \"start_dose\", \"sn\": \"AQU1AD04A42\",\n \"monitor\": 0}'\n - delay: 00:03:00\n - service: notify.mobile_app_s23ultra\n data:\n message: Dosing complete - Starting mixing period\n data:\n tag: tank_fill_process\n - service: mqtt.publish\n data:\n topic: AQU1AD04A42/ctr\n payload: '{\"cmd\": \"setNutrient\", \"msgid\": \"force_stop\", \"sn\": \"AQU1AD04A42\",\n \"monitor\": 1}'\n - service: notify.mobile_app_s23ultra\n data:\n message: Mixing complete - Shutting down pumps\n data:\n tag: tank_fill_process\n - service: switch.turn_off\n target:\n entity_id:\n - switch.espoe_irrigation_relay_1_4\n - delay: 00:01:00\n - service: switch.turn_off\n target:\n entity_id:\n - switch.espoe_irrigation_relay_1_1\n - delay: 00:00:01\n - service: switch.turn_off\n target:\n entity_id:\n - switch.espoe_irrigation_relay_2_4\n - delay: 00:05:00\n - service: notify.mobile_app_s23ultra\n data:\n message: Checking pH and EC levels...\n data:\n tag: tank_fill_process\n - choose:\n - conditions:\n - condition: or\n conditions:\n - condition: numeric_state\n entity_id: sensor.atlas_legacy_1_ph_res1\n below: 5.8\n - condition: numeric_state\n entity_id: sensor.atlas_legacy_1_ph_res1\n above: 6.2\n sequence:\n - service: notify.mobile_app_s23ultra\n data:\n title: pH Value Out of Range\n message: 'CRITICAL ALERT: pH out of range! Current pH: {{ states(''sensor.atlas_legacy_1_ph_res1'')\n }}. Should be between 5.80-6.20.'\n data:\n ttl: 0\n priority: high\n channel: critical_alerts\n importance: high\n vibrationPattern:\n - 100\n - 1000\n - 100\n - 1000\n - 100\n tag: ph_ec_alert\n - conditions:\n - condition: or\n conditions:\n - condition: numeric_state\n entity_id: sensor.atlas_legacy_1_ec_res1\n below: 2.8\n - condition: numeric_state\n entity_id: sensor.atlas_legacy_1_ec_res1\n above: 3.2\n sequence:\n - service: notify.mobile_app_s23ultra\n data:\n title: EC Value Out of Range\n message: 'CRITICAL ALERT: EC out of range! Current EC: {{ states(''sensor.atlas_legacy_1_ec_res1'')\n }}. Should be between 2.80-3.20.'\n data:\n ttl: 0\n priority: high\n channel: critical_alerts\n importance: high\n vibrationPattern:\n - 100\n - 1000\n - 100\n - 1000\n - 100\n tag: ph_ec_alert\n - service: notify.mobile_app_s23ultra\n data:\n message: 'Process complete - pH: {{ states(''sensor.atlas_legacy_1_ph_res1'')\n }}, EC: {{ states(''sensor.atlas_legacy_1_ec_res1'') }}'\n data:\n tag: tank_fill_process\n - choose:\n - conditions:\n - condition: time\n after: 06:00:00\n before: 02:00:00\n sequence:\n - service: automation.turn_on\n target:\n entity_id: automation.f1_irrigation_irrigate_5_minutes_every_45_minutes\n - service: notify.mobile_app_s23ultra\n data:\n message: Irrigation schedule resumed after tank fill (daytime)\n data:\n tag: tank_fill_process\n default:\n - service: notify.mobile_app_s23ultra\n data:\n message: Tank fill complete, but irrigation remains disabled (nighttime)\n data:\n tag: tank_fill_process\n - service: notify.mobile_app_s23ultra\n data:\n message: Tank fill and dose sequence complete - Starting cooldown period\n data:\n tag: tank_fill_process\n - service: input_boolean.turn_off\n target:\n entity_id: input_boolean.nutrient_dosing_active\n - delay: 01:30:00\n - service: input_boolean.turn_on\n target:\n entity_id: input_boolean.nutrient_dosing_active", "config": [ { "name": "mobile app s23ultra notify", "room": null, "type": "notify", "id": { "entity_id": "notify.mobile_app_s23ultra", "device_id": null } }, { "name": "aqua pro water level sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.aqua_pro_water_level", "device_id": null } }, { "name": "manual tank fill input", "room": null, "type": "input_button", "id": { "entity_id": "input_button.manual_tank_fill", "device_id": null } }, { "name": "tank sensor tank level binary sensor", "room": null, "type": "binary_sensor", "id": { "entity_id": "binary_sensor.tank_sensor_tank_level", "device_id": null } }, { "name": "tank fill safety switch input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.tank_fill_safety_switch", "device_id": null } }, { "name": "nutrient dosing active input", "room": null, "type": "input_boolean", "id": { "entity_id": "input_boolean.nutrient_dosing_active", "device_id": null } }, { "name": "f1 irrigation relays relay 1 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.f1_irrigation_relays_relay_1", "device_id": null } }, { "name": "f1 irrigation relays relay 2 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.f1_irrigation_relays_relay_2", "device_id": null } }, { "name": "f1 irrigation relays relay 3 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.f1_irrigation_relays_relay_3", "device_id": null } }, { "name": "f1 irrigation relays relay 4 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.f1_irrigation_relays_relay_4", "device_id": null } }, { "name": "waste valve switch", "room": null, "type": "switch", "id": { "entity_id": "switch.waste_valve", "device_id": null } }, { "name": "espoe irrigation relay 1 2 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.espoe_irrigation_relay_1_2", "device_id": null } }, { "name": "espoe irrigation relay 2 4 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.espoe_irrigation_relay_2_4", "device_id": null } }, { "name": "espoe irrigation relay 1 4 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.espoe_irrigation_relay_1_4", "device_id": null } }, { "name": "pump power switch", "room": null, "type": "switch", "id": { "entity_id": "switch.pump_power_switch", "device_id": null } }, { "name": "f1 irrigation pump master switch", "room": null, "type": "switch", "id": { "entity_id": "switch.f1_irrigation_pump_master_switch", "device_id": null } }, { "name": "espoe irrigation relay 1 1 switch", "room": null, "type": "switch", "id": { "entity_id": "switch.espoe_irrigation_relay_1_1", "device_id": null } }, { "name": "pump power switch power sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.pump_power_switch_power", "device_id": null } }, { "name": "atlas legacy 1 ph res1 sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.atlas_legacy_1_ph_res1", "device_id": null } }, { "name": "atlas legacy 1 ec res1 sensor", "room": null, "type": "sensor", "id": { "entity_id": "sensor.atlas_legacy_1_ec_res1", "device_id": null } }, { "name": "f1 irrigation irrigate 5 minutes every 45 minutes automation", "room": null, "type": "automation", "id": { "entity_id": "automation.f1_irrigation_irrigate_5_minutes_every_45_minutes", "device_id": null } } ] } ]