diff --git a/README.md b/README.md index c26940a..c2f2199 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,37 @@ # Home-Assistant -This might one day have my whole config but at the moment I have only posted a few sections which are (mostly) self contained packages. +I have adapted the fantastic code from @kloggy to an ESP32 and an 8 relay board to have up to 8 zones. I have 2 separate ESPs for a total of 16 zones configured the same way (only different names for the zones). One activates the "West" area, the other the "East". Also not using the Weather-related watering adjustments. No need given the weather patterns where I live :) -1. My **Garden Irrigation** system, +Parts : - See here for more information - https://community.home-assistant.io/t/my-garden-irrigation/99686 +https://www.amazon.com/gp/product/B07QCP2451/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 +https://www.amazon.com/gp/product/B07C8LSXKC/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 + +https://www.amazon.com/gp/product/B07Q29CD7J/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 + +Software Requirements: +Requires the following custom cards to be installed and working +- toggle-lock-entity-row +- config-template-card +- fold-entity-row +- toggle-lock-entity-row + +Setup the ESP32 with ESPHome + - esp32_1.yaml for my example of how the ESP is configured to handle 8 zones + - I have a second one configured the same way, just different names for the zones + +Changes to configuration : +1. Add following line in configuration.yaml + packages: !include_dir_named packages +2. Have the following directory : + /config/packages/garden +3. Place the 3 files in the config/packages/garden + - garden_global.yaml + - garden_irrigation.yaml + - garden_master_control.yaml +4. changes to lovelace + - see lovelace.yaml for the additional code to be added to lovelace to add the additional tab + + See here for more information in the OP - https://community.home-assistant.io/t/my-garden-irrigation/99686 -2. My **Guest Mode** implemenation which allows for an ad-hoc setting along with two (or more) regular schedules diff --git a/lovelace/views/view_garden.yaml b/lovelace/views/view_garden.yaml index 3c8678c..738f3d5 100644 --- a/lovelace/views/view_garden.yaml +++ b/lovelace/views/view_garden.yaml @@ -1,265 +1,117 @@ -#================================ -#=== -#=== GARDEN -#=== -#================================ -title: Garden -icon: mdi:flower -cards: - - - type: custom:compact-custom-header - - #========================== - #=== Master Control Switch - #========================== - - type: vertical-stack + - badges: [] cards: - - - type: picture-entity - entity: input_boolean.irrigation_master_control_switch - image: /local/lovelace/lawn-sprinkler.jpg - tap_action: - action: toggle - - - type: conditional + - cards: + - entity: input_boolean.irrigation_master_control_switch + state_image: + 'off': /local/sprinkler-off.png + 'on': /local/sprinkler-on.png + tap_action: + action: toggle + type: picture-entity + - card: + cards: + - cards: + - entity: input_boolean.cycle1_manual_run + name: Morning Cycle + tap_action: + action: toggle + type: 'custom:toggle-lock-entity-row' + - entity: input_boolean.cycle2_manual_run + name: Afternoon Cycle + tap_action: + action: toggle + type: 'custom:toggle-lock-entity-row' + type: horizontal-stack + - entities: + - entity: switch.zone1 + icon: 'mdi:engine' + - entity: switch.zone2 + icon: 'mdi:engine' + - entity: switch.zone3 + icon: 'mdi:engine' + - entity: switch.zone4 + icon: 'mdi:engine' + - entity: switch.zone5 + icon: 'mdi:engine' + type: glance + - entities: + - head: + entity: sensor.last_irrigated_time + icon: 'mdi:update' + items: + - entity: sensor.zone1_time_today + icon: 'mdi:water' + - entity: sensor.zone2_time_today + icon: 'mdi:water' + - entity: sensor.zone3_time_today + icon: 'mdi:water' + - entity: sensor.zone4_time_today + icon: 'mdi:water' + - entity: sensor.zone5_time_today + icon: 'mdi:water' + type: 'custom:fold-entity-row' + show_header_toggle: false + title: Irrigation History + type: entities + type: vertical-stack + conditions: + - entity: input_boolean.irrigation_master_control_switch + state: 'on' + type: conditional + type: vertical-stack + - card: + entities: + - sensor.cycle1_running + - entity: sensor.cycle1_zone_being_watered + icon: 'mdi:fountain' + - timer.cycle1_zone_duration + - input_number.cycle1_zone1_duration + - input_number.cycle1_zone2_duration + - input_number.cycle1_zone3_duration + - input_number.cycle1_zone4_duration + - input_number.cycle1_zone5_duration + - head: + entity: input_boolean.cycle1_enable + type: 'custom:toggle-lock-entity-row' + items: + - entity: sensor.cycle1_next_run_time + icon: 'mdi:clock-start' + - input_select.cycle1_schedule_time + - input_select.cycle1_watering_days + type: 'custom:fold-entity-row' + show_header_toggle: false + title: Area 1 + type: entities conditions: - entity: input_boolean.irrigation_master_control_switch state: 'on' - card: - type: vertical-stack - cards: - - #=== Manual control buttons - - type: horizontal-stack - cards: - - type: custom:toggle-lock-entity-row -# - type: entity-button - entity: input_boolean.cycle1_manual_run - name: Morning Cycle - tap_action: - action: toggle - - - type: custom:toggle-lock-entity-row -# - type: entity-button - entity: input_boolean.cycle2_manual_run - name: Afternoon Cycle - tap_action: - action: toggle - - #=== Valve information - - type: 'custom:config-template-card' - entities: - - switch.zone1_valve - - switch.zone2_valve - - switch.zone3_valve - - switch.zone4_valve - - switch.zone5_valve - - sensor.zone1to4_valve - - sensor.zone5_valve - variables: - - states['sensor.zone1to4_valve'].state - - states['sensor.zone5_valve'].state - card: - type: 'custom:hui-glance-card' - entities: - - entity: switch.zone1_valve - icon: mdi:engine - - entity: switch.zone2_valve - icon: mdi:engine - - entity: switch.zone3_valve - icon: mdi:engine - - entity: switch.zone4_valve - icon: mdi:engine - - entity: switch.zone5_valve - icon: mdi:engine - - entity: sensor.zone1to4_valve - name: '' - icon: "${vars[0] >= 100 ? 'mdi:wifi' : vars[0] >= 80 ? 'mdi:wifi-strength-3' : vars[0] >= 60 ? 'mdi:wifi-strength-2' : vars[0] > 0 ? 'mdi:wifi-strength-1' : 'mdi:wifi-off' }" - - entity: sensor.zone1to4_valve - name: '' - icon: "${vars[0] >= 100 ? 'mdi:wifi' : vars[0] >= 80 ? 'mdi:wifi-strength-3' : vars[0] >= 60 ? 'mdi:wifi-strength-2' : vars[0] > 0 ? 'mdi:wifi-strength-1' : 'mdi:wifi-off' }" - - entity: sensor.zone1to4_valve - name: '' - icon: "${vars[0] >= 100 ? 'mdi:wifi' : vars[0] >= 80 ? 'mdi:wifi-strength-3' : vars[0] >= 60 ? 'mdi:wifi-strength-2' : vars[0] > 0 ? 'mdi:wifi-strength-1' : 'mdi:wifi-off' }" - - entity: sensor.zone1to4_valve - name: '' - icon: "${vars[0] >= 100 ? 'mdi:wifi' : vars[0] >= 80 ? 'mdi:wifi-strength-3' : vars[0] >= 60 ? 'mdi:wifi-strength-2' : vars[0] > 0 ? 'mdi:wifi-strength-1' : 'mdi:wifi-off' }" - - entity: sensor.zone5_valve - name: '' - icon: "${vars[1] >= 100 ? 'mdi:wifi' : vars[1] >= 80 ? 'mdi:wifi-strength-3' : vars[1] >= 60 ? 'mdi:wifi-strength-2' : vars[1] > 0 ? 'mdi:wifi-strength-1' : 'mdi:wifi-off' }" - - #=== Temperature and Rainfall - - type: entities - title: Temperature and Rainfall - show_header_toggle: false - entities: - - input_number.temperature_baseline - - input_number.rainfall_threshold - - type: custom:fold-entity-row - head: - type: section - label: Weather History - items: - - type: section - label: Temperature - - - entity: sensor.temp_high_2days - icon: mdi:thermometer - - entity: sensor.temp_high_5days - icon: mdi:thermometer - - - type: divider - style: - height: 15px - - - entity: sensor.temp_minus0 - icon: mdi:thermometer - - entity: sensor.temp_minus1 - icon: mdi:thermometer - - entity: sensor.temp_minus2 - icon: mdi:thermometer - - entity: sensor.temp_minus3 - icon: mdi:thermometer - - entity: sensor.temp_minus4 - icon: mdi:thermometer - - - type: section - label: Rainfall - - - entity: sensor.rain_3days_ratio - icon: mdi:weather-rainy - - - type: divider - style: - height: 15px - - - entity: sensor.rain_minus0 - icon: mdi:weather-rainy - - entity: sensor.rain_minus1 - icon: mdi:weather-rainy - - entity: sensor.rain_minus2 - icon: mdi:weather-rainy - - entity: sensor.rain_minus3 - icon: mdi:weather-rainy - - #=== Irrigation History - - type: entities - title: Irrigation History - show_header_toggle: false - entities: - - type: custom:fold-entity-row - head: - entity: sensor.last_irrigated_time - icon: mdi:update - items: - - entity: sensor.zone1_time_today - icon: mdi:water - - entity: sensor.zone2_time_today - icon: mdi:water - - entity: sensor.zone3_time_today - icon: mdi:water - - entity: sensor.zone4_time_today - icon: mdi:water - - entity: sensor.zone5_time_today - icon: mdi:water - - #================== - #=== Morning Cycle - #================== - - type: conditional - conditions: - - entity: input_boolean.irrigation_master_control_switch - state: 'on' - card: - #=== Morning Cycle details - type: entities - title: Morning Cycle - show_header_toggle: false - entities: - - sensor.cycle1_running - - entity: sensor.cycle1_zone_being_watered - icon: mdi:fountain - - timer.cycle1_zone_duration - - input_number.cycle1_zone1_duration - - input_number.cycle1_zone2_duration - - input_number.cycle1_zone3_duration - - input_number.cycle1_zone4_duration - - input_number.cycle1_zone5_duration - - #=== Morning Schedule details - - type: custom:fold-entity-row - head: - type: custom:toggle-lock-entity-row - entity: input_boolean.cycle1_enable - items: - - entity: sensor.cycle1_next_run_time - icon: mdi:clock-start - - input_select.cycle1_schedule_time - - input_select.cycle1_watering_days - - #=== Morning Weather Adjustment details - - type: custom:fold-entity-row - head: - entity: input_boolean.cycle1_use_weather_adjustment - items: - - entity: sensor.cycle1_zone1_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle1_zone2_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle1_zone3_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle1_zone4_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle1_zone5_duration_adjusted - icon: mdi:camera-timer - - #==================== - #=== Afternoon Cycle - #==================== - - type: conditional - conditions: - - entity: input_boolean.irrigation_master_control_switch - state: 'on' - card: - #=== Afternoon Cycle details - type: entities - title: Afternoon Cycle - show_header_toggle: false - entities: - - sensor.cycle2_running - - entity: sensor.cycle2_zone_being_watered - icon: mdi:fountain - - timer.cycle2_zone_duration - - input_number.cycle2_zone1_duration - - input_number.cycle2_zone2_duration - - input_number.cycle2_zone3_duration - - input_number.cycle2_zone4_duration - - input_number.cycle2_zone5_duration - - #=== Afternoon Schedule details - - type: custom:fold-entity-row - head: - type: custom:toggle-lock-entity-row - entity: input_boolean.cycle2_enable - items: - - entity: sensor.cycle2_next_run_time - icon: mdi:clock-start - - input_select.cycle2_schedule_time - - input_select.cycle2_watering_days - - #=== Afternoon Weather Adjustment details - - type: custom:fold-entity-row - head: - entity: input_boolean.cycle2_use_weather_adjustment - items: - - entity: sensor.cycle2_zone1_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle2_zone2_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle2_zone3_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle2_zone4_duration_adjusted - icon: mdi:camera-timer - - entity: sensor.cycle2_zone5_duration_adjusted - icon: mdi:camera-timer - + type: conditional + - card: + entities: + - sensor.cycle2_running + - entity: sensor.cycle2_zone_being_watered + icon: 'mdi:fountain' + - timer.cycle2_zone_duration + - input_number.cycle2_zone1_duration + - input_number.cycle2_zone2_duration + - input_number.cycle2_zone3_duration + - input_number.cycle2_zone4_duration + - input_number.cycle2_zone5_duration + - head: + entity: input_boolean.cycle2_enable + type: 'custom:toggle-lock-entity-row' + items: + - entity: sensor.cycle2_next_run_time + icon: 'mdi:clock-start' + - input_select.cycle2_schedule_time + - input_select.cycle2_watering_days + type: 'custom:fold-entity-row' + show_header_toggle: false + title: Afternoon Cycle + type: entities + conditions: + - entity: input_boolean.irrigation_master_control_switch + state: 'on' + type: conditional + icon: 'mdi:flower' + title: Garden diff --git a/lovelace/views/view_guest_mode.yaml b/lovelace/views/view_guest_mode.yaml deleted file mode 100644 index 76dd1d9..0000000 --- a/lovelace/views/view_guest_mode.yaml +++ /dev/null @@ -1,76 +0,0 @@ -#################################################### -# THIS IS ONLY A PARTIAL EXTRACT OF ONE OF MY VIEWS -# -# IT IS HERE PURELY AS AN AID TO RECREATING WHAT I -# SHOW IN MY SCREENSHOTS. -# -# IF YOU LIKE IT YOU WILL NEED TO ADAPT IT TO FIT -# IN YOUR OWN LOVELACE SETUP -##################################################### - - - - type: custom:fold-entity-row - head: - entity: binary_sensor.guest_mode - items: - - type: divider - - #=== Guest Schedules - #=== Schedule once - - type: custom:fold-entity-row - head: - type: custom:toggle-lock-entity-row - entity: input_boolean.guest_mode_once - name: Guest mode once - icon: mdi:human-handsup - items: - - input_number.guest_mode_once_duration - - type: divider - - #=== Schedule 1 - - type: custom:fold-entity-row - head: - type: custom:toggle-lock-entity-row - entity: input_boolean.guest_mode_schedule_1 - name: Guest schedule (1) - icon: mdi:numeric-1-box-outline - items: - - input_text.guest_mode_schedule_1_name - - input_select.guest_mode_schedule_1_day - - type: custom:time-input-row - entity: input_datetime.guest_mode_schedule_1_start_time - - input_number.guest_mode_schedule_1_duration - - type: divider - - #=== Schedule 2 - - type: custom:fold-entity-row - head: - type: custom:toggle-lock-entity-row - entity: input_boolean.guest_mode_schedule_2 - name: Guest schedule (2) - icon: mdi:numeric-2-box-outline - items: - - input_text.guest_mode_schedule_2_name - - input_select.guest_mode_schedule_2_day - - type: custom:time-input-row - entity: input_datetime.guest_mode_schedule_2_start_time - - input_number.guest_mode_schedule_2_duration -# - type: divider - - - #======================== - #=== Active Guest Timers - #======================== - - type: custom:card-modder - style: - --primary-text-color: 'yellow' - card: - type: entity-filter - show_header_toggle: false - entities: - - timer.guest_mode_once_duration - - timer.guest_mode_schedule_1_duration - - timer.guest_mode_schedule_2_duration - state_filter: - - "active" - show_empty: false diff --git a/packages/garden/20190730_182302666_iOS.jpg b/packages/garden/20190730_182302666_iOS.jpg new file mode 100644 index 0000000..1873c13 Binary files /dev/null and b/packages/garden/20190730_182302666_iOS.jpg differ diff --git a/packages/garden/Lovelace screen Irrigation.png b/packages/garden/Lovelace screen Irrigation.png new file mode 100644 index 0000000..fa245d7 Binary files /dev/null and b/packages/garden/Lovelace screen Irrigation.png differ diff --git a/packages/garden/Lovelace view.jpg b/packages/garden/Lovelace view.jpg new file mode 100644 index 0000000..d18892f Binary files /dev/null and b/packages/garden/Lovelace view.jpg differ diff --git a/packages/garden/README.md b/packages/garden/README.md index 1affc4c..04f0c1d 100644 --- a/packages/garden/README.md +++ b/packages/garden/README.md @@ -3,50 +3,10 @@
-
-__The Morning Cycle showing the Schedule__
-
-
-
-__The Morning Cycle showing the Weather Adjustments__
-
-
-
-__Showing the Irrigation History__
-
-
+https://www.amazon.com/gp/product/B07Q29CD7J/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
diff --git a/packages/garden/Screenshots/IrrigationHistory.png b/packages/garden/Screenshots/IrrigationHistory.png
deleted file mode 100644
index 64a0b5b..0000000
Binary files a/packages/garden/Screenshots/IrrigationHistory.png and /dev/null differ
diff --git a/packages/garden/Screenshots/MasterControlSwitch.png b/packages/garden/Screenshots/MasterControlSwitch.png
deleted file mode 100644
index 699d6f6..0000000
Binary files a/packages/garden/Screenshots/MasterControlSwitch.png and /dev/null differ
diff --git a/packages/garden/Screenshots/MorningCycleWithSchedule.png b/packages/garden/Screenshots/MorningCycleWithSchedule.png
deleted file mode 100644
index 448ad56..0000000
Binary files a/packages/garden/Screenshots/MorningCycleWithSchedule.png and /dev/null differ
diff --git a/packages/garden/Screenshots/MorningCycleWithWeatherAdjustments.png b/packages/garden/Screenshots/MorningCycleWithWeatherAdjustments.png
deleted file mode 100644
index 97fe3d8..0000000
Binary files a/packages/garden/Screenshots/MorningCycleWithWeatherAdjustments.png and /dev/null differ
diff --git a/packages/garden/Screenshots/TemperatureAndRainfall.png b/packages/garden/Screenshots/TemperatureAndRainfall.png
deleted file mode 100644
index 1668672..0000000
Binary files a/packages/garden/Screenshots/TemperatureAndRainfall.png and /dev/null differ
diff --git a/packages/garden/esp32_1.yaml b/packages/garden/esp32_1.yaml
new file mode 100644
index 0000000..6f36a30
--- /dev/null
+++ b/packages/garden/esp32_1.yaml
@@ -0,0 +1,51 @@
+esphome:
+ name: esp32_1
+ platform: ESP32
+ board: nodemcu-32s
+
+wifi:
+ ssid: "XXXXXX"
+ password: "XXXXXXX"
+
+# Enable logging
+logger:
+
+# Enable Home Assistant API
+api:
+
+ota:
+
+switch:
+ - platform: gpio
+ name: "Zone1"
+ pin: GPIO4
+ inverted: true
+ - platform: gpio
+ name: "Zone2"
+ pin: GPIO16
+ inverted: true
+ - platform: gpio
+ name: "Zone3"
+ pin: GPIO17
+ inverted: true
+ - platform: gpio
+ name: "Zone4"
+ pin: GPIO18
+ inverted: true
+ - platform: gpio
+ name: "Zone5"
+ pin: GPIO19
+ inverted: true
+ - platform: gpio
+ name: "Zone6"
+ pin: GPIO21
+ inverted: true
+ - platform: gpio
+ name: "Zone7"
+ pin: GPIO22
+ inverted: true
+ - platform: gpio
+ name: "Zone8"
+ pin: GPIO23
+ inverted: true
+
\ No newline at end of file
diff --git a/packages/garden/garden_dash_button.yaml b/packages/garden/garden_dash_button.yaml
deleted file mode 100644
index 0b02433..0000000
--- a/packages/garden/garden_dash_button.yaml
+++ /dev/null
@@ -1,120 +0,0 @@
-
-#============
-#=== Scripts
-#============
-script:
-
- #===========================================
- #=== DASH Button - start or stop irrigation
- #=== (called from the Dashio add-on)
- #===========================================
- dash_irrigation:
- sequence:
-
- - service_template: >
- {% if is_state('input_boolean.irrigation_master_control_switch', 'off') %}
- script.dash_irrigation_not_started
- {% elif is_state('input_boolean.cycle1_running', 'off') and
- is_state('input_boolean.cycle2_running', 'off') %}
- script.dash_start_irrigation
- {% else %}
- script.dash_stop_irrigation
- {% endif %}
-
-
- #================================================================
- #=== Script to start irrigation cycle 1 when DASH button pressed
- #================================================================
- dash_start_irrigation:
- sequence:
-
- - wait_template: >
- {{ is_state('script.announce' , 'off') }}
- timeout: '00:00:05'
-
- #=== Set sonos parameters
- - service: script.setup_sonos_parameters
- data:
- room: kitchen
- volume: 0.3
-
- #=== Prepare Sonos devices (Snapshot, Unjoin and set Volume)
- - service: script.prepare_sonos_devices
-
- #=== Wait for Sonos devices to be ready
- - delay: "00:00:01"
-
- - wait_template: "{{ is_state('script.prepare_sonos_devices', 'off') }}"
-
- #=== Announce irrigation
- - service: script.announce_irrigation_started
-
- - service: input_boolean.turn_on
- data:
- entity_id: input_boolean.cycle1_manual_run
-
- - wait_template: "{{ is_state('script.announce_irrigation_started' , 'on') }}"
- timeout: '00:00:02'
-
- - wait_template: "{{ is_state('script.announce_irrigation_started' , 'off') }}"
-
- #=== Restore Sonos
- - service: media_player.sonos_restore
- data_template:
- entity_id: >
- {{ 'media_player.' ~ states('input_select.announce_room') }}
- with_group: 'true'
-
-
- #========================================================
- #=== Script to stop irrigation when DASH button pressed
- #=== This stops any cycle even if it was not initiated
- #=== by the dash button
- #========================================================
- dash_stop_irrigation:
- sequence:
- - service: input_boolean.turn_off
- data:
- entity_id:
- - input_boolean.cycle1_manual_run
- - input_boolean.cycle2_manual_run
-
-
- #================================================================
- #=== Script when irrigation doesn't run when DASH button pressed
- #================================================================
- dash_irrigation_not_started:
- sequence:
-
- - wait_template: >
- {{ is_state('script.announce' , 'off') }}
- timeout: '00:00:05'
-
- #=== Set sonos parameters
- - service: script.setup_sonos_parameters
- data:
- room: kitchen
- volume: 0.3
-
- #=== Prepare Sonos devices (Snapshot, Unjoin and set Volume)
- - service: script.prepare_sonos_devices
-
- #=== Wait for Sonos devices to be ready
- - delay: "00:00:01"
-
- - wait_template: "{{ is_state('script.prepare_sonos_devices', 'off') }}"
-
- #=== Announce irrigation
- - service: script.announce_irrigation_not_started
-
- - wait_template: "{{ is_state('script.announce_irrigation_not_started' , 'on') }}"
- timeout: '00:00:02'
-
- - wait_template: "{{ is_state('script.announce_irrigation_not_started' , 'off') }}"
-
- #=== Restore Sonos
- - service: media_player.sonos_restore
- data_template:
- entity_id: >
- {{ 'media_player.' ~ states('input_select.announce_room') }}
- with_group: 'true'
diff --git a/packages/garden/garden_globals.yaml b/packages/garden/garden_globals.yaml
index c2e3346..992b7d5 100644
--- a/packages/garden/garden_globals.yaml
+++ b/packages/garden/garden_globals.yaml
@@ -5,11 +5,22 @@
group:
irrigation_switches:
entities:
- - switch.zone1_valve
- - switch.zone2_valve
- - switch.zone3_valve
- - switch.zone4_valve
- - switch.zone5_valve
+ - switch.zone1
+ - switch.zone2
+ - switch.zone3
+ - switch.zone4
+ - switch.zone5
+ - switch.zone6
+ - switch.zone7
+ - switch.zone8
+ - switch.zone9
+ - switch.zone10
+ - switch.zone11
+ - switch.zone12
+ - switch.zone13
+ - switch.zone14
+ - switch.zone15
+ - switch.zone16
#===================
@@ -33,27 +44,27 @@ input_boolean:
cycle2_enable_saved_state:
- cycle1_use_weather_adjustment:
- name: Use weather adjustment
- icon: mdi:weather-partlycloudy
+ # cycle1_use_weather_adjustment:
+ # name: Use weather adjustment
+ # icon: mdi:weather-partlycloudy
- cycle2_use_weather_adjustment:
- name: Use weather adjustment
- icon: mdi:weather-partlycloudy
+ # cycle2_use_weather_adjustment:
+ # name: Use weather adjustment
+ # icon: mdi:weather-partlycloudy
cycle1_manual_run:
- name: Run morning cycle now
+ name: Run west side now
icon: mdi:arrow-right-drop-circle
cycle2_manual_run:
- name: Run afternoon cycle now
+ name: Run east side cycle now
icon: mdi:arrow-right-drop-circle
cycle1_running:
- name: Cycle 1 running
+ name: Cycle1_running
cycle2_running:
- name: Cycle 2 running
+ name: Cycle2_running
#================
@@ -73,7 +84,7 @@ input_text:
input_select:
cycle1_watering_days:
- name: Morning cycle watering days
+ name: West side cycle watering days
options:
- 'Daily'
- 'Alternate'
@@ -81,7 +92,7 @@ input_select:
icon: mdi:calendar
cycle2_watering_days:
- name: Afternoon cycle watering days
+ name: East side cycle watering days
options:
- 'Daily'
- 'Alternate'
@@ -89,23 +100,25 @@ input_select:
icon: mdi:calendar
cycle1_schedule_time:
- name: Morning cycle schedule start time
+ name: West side cycle schedule start time
options:
- - '08:00'
- - '09:00'
- - '10:00'
- - '11:00'
- - '12:00'
+ - '13:00'
+ - '14:00'
+ - '15:00'
+ - '16:00'
+ - '17:00'
+ - '18:00'
icon: mdi:alarm
cycle2_schedule_time:
- name: Afternoon cycle schedule start time
+ name: East side cycle schedule start time
options:
+ - '13:00'
+ - '14:00'
+ - '15:00'
- '16:00'
- '17:00'
- '18:00'
- - '19:00'
- - '20:00'
icon: mdi:alarm
@@ -133,153 +146,231 @@ input_number:
# CYCLE 1
cycle1_zone1_duration:
- name: Zone 1 duration
+ name: Roses
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
cycle1_zone2_duration:
- name: Zone 2 duration
+ name: Pool
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
cycle1_zone3_duration:
- name: Zone 3 duration
+ name: Walkway
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
cycle1_zone4_duration:
- name: Zone 4 duration
+ name: Citrus
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
cycle1_zone5_duration:
- name: Zone 5 duration
+ name: Lavander
+ min: 0
+ max: 10
+ step: 1
+ icon: mdi:camera-timer
+ unit_of_measurement: mins
+
+ cycle1_zone6_duration:
+ name: Zone 6 duration
+ min: 0
+ max: 10
+ step: 1
+ icon: mdi:camera-timer
+ unit_of_measurement: mins
+
+ cycle1_zone7_duration:
+ name: Zone 7 duration
+ min: 0
+ max: 10
+ step: 1
+ icon: mdi:camera-timer
+ unit_of_measurement: mins
+
+ cycle1_zone8_duration:
+ name: Zone 8 duration
min: 0
- max: 59
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
# CYCLE 2
- cycle2_zone1_duration:
- name: Zone 1 duration
+ cycle2_zone9_duration:
+ name: Beds
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
- cycle2_zone2_duration:
- name: Zone 2 duration
+ cycle2_zone10_duration:
+ name: Poolside
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
- cycle2_zone3_duration:
- name: Zone 3 duration
+ cycle2_zone11_duration:
+ name: Upper Garden
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
- cycle2_zone4_duration:
- name: Zone 4 duration
+ cycle2_zone12_duration:
+ name: Vineyard
+ min: 0
+ max: 10
+ step: 1
+ icon: mdi:camera-timer
+ unit_of_measurement: mins
+
+ cycle2_zone13_duration:
+ name: Guest House
+ min: 0
+ max: 10
+ step: 1
+ icon: mdi:camera-timer
+ unit_of_measurement: mins
+
+ cycle2_zone14_duration:
+ name: Guest Driveway
min: 0
- max: 30
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
- cycle2_zone5_duration:
- name: Zone 5 duration
+ cycle2_zone15_duration:
+ name: Main Driveway
min: 0
- max: 59
+ max: 10
+ step: 1
+ icon: mdi:camera-timer
+ unit_of_measurement: mins
+
+ cycle2_zone16_duration:
+ name: Orchard
+ min: 0
+ max: 10
step: 1
icon: mdi:camera-timer
unit_of_measurement: mins
# The temperature above or below which the duration is adjusted
- temperature_baseline:
- name: Temperature baseline
- min: 20
- max: 30
- icon: mdi:thermometer
- unit_of_measurement: '°C'
+ # temperature_baseline:
+ # name: Temperature baseline
+ # min: 20
+ # max: 30
+ # icon: mdi:thermometer
+ # unit_of_measurement: '°C'
# How much rain is needed before the duration is reduced
- rainfall_threshold:
- name: Rainfall threshold
- min: 5
- max: 30
- icon: mdi:weather-rainy
- unit_of_measurement: 'mm'
+ # rainfall_threshold:
+ # name: Rainfall threshold
+ # min: 5
+ # max: 30
+ # icon: mdi:weather-rainy
+ # unit_of_measurement: 'mm'
# Adjusted duration times can be extreme during calculations
# depending on weather conditions so min and max are set high
- adjusted_cycle1_zone1_duration:
- name: Adjusted cycle1 zone1 duration
- min: -60
- max: 60
-
- adjusted_cycle1_zone2_duration:
- name: Adjusted cycle1 zone2 duration
- min: -60
- max: 60
-
- adjusted_cycle1_zone3_duration:
- name: Adjusted cycle1 zone3 duration
- min: -60
- max: 60
-
- adjusted_cycle1_zone4_duration:
- name: Adjusted cycle1 zone4 duration
- min: -60
- max: 60
-
- adjusted_cycle1_zone5_duration:
- name: Adjusted cycle1 zone5 duration
- min: -60
- max: 120
-
- adjusted_cycle2_zone1_duration:
- name: Adjusted cycle1 zone1 duration
- min: -60
- max: 60
-
- adjusted_cycle2_zone2_duration:
- name: Adjusted cycle1 zone2 duration
- min: -60
- max: 60
-
- adjusted_cycle2_zone3_duration:
- name: Adjusted cycle1 zone3 duration
- min: -60
- max: 60
-
- adjusted_cycle2_zone4_duration:
- name: Adjusted cycle1 zone4 duration
- min: -60
- max: 60
-
- adjusted_cycle2_zone5_duration:
- name: Adjusted cycle1 zone5 duration
- min: -60
- max: 120
+ # adjusted_cycle1_zone1_duration:
+ # name: Adjusted cycle1 zone1 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle1_zone2_duration:
+ # name: Adjusted cycle1 zone2 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle1_zone3_duration:
+ # name: Adjusted cycle1 zone3 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle1_zone4_duration:
+ # name: Adjusted cycle1 zone4 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle1_zone5_duration:
+ # name: Adjusted cycle1 zone5 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle1_zone6_duration:
+ # name: Adjusted cycle1 zone6 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle1_zone7_duration:
+ # name: Adjusted cycle1 zone7 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle1_zone8_duration:
+ # name: Adjusted cycle1 zone8 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle2_zone1_duration:
+ # name: Adjusted cycle1 zone1 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle2_zone2_duration:
+ # name: Adjusted cycle1 zone2 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle2_zone3_duration:
+ # name: Adjusted cycle1 zone3 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle2_zone4_duration:
+ # name: Adjusted cycle1 zone4 duration
+ # min: -60
+ # max: 60
+
+ # adjusted_cycle2_zone5_duration:
+ # name: Adjusted cycle1 zone5 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle2_zone6_duration:
+ # name: Adjusted cycle1 zone6 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle2_zone7_duration:
+ # name: Adjusted cycle1 zone7 duration
+ # min: -60
+ # max: 120
+
+ # adjusted_cycle2_zone8_duration:
+ # name: Adjusted cycle1 zone8 duration
+ # min: -60
+ # max: 120
#===========
@@ -319,7 +410,7 @@ sensor:
{% endif %}
cycle1_running:
- friendly_name: "Morning cycle"
+ friendly_name: "West cycle"
value_template: >
{% if is_state('input_boolean.cycle1_running', 'on') %}
Running
@@ -334,7 +425,7 @@ sensor:
{% endif %}
cycle2_running:
- friendly_name: "Afternoon cycle"
+ friendly_name: "East cycle"
value_template: >
{% if is_state('input_boolean.cycle2_running', 'on') %}
Running
@@ -363,130 +454,244 @@ sensor:
# Zone Times - templated on history_stats sensors
zone1_time_today:
- friendly_name: Zone 1 total watering time today
+ friendly_name: Roses total watering time
value_template: >
{% set duration = states('sensor.zone1_time') %}
{{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
zone2_time_today:
- friendly_name: Zone 2 total watering time today
+ friendly_name: Pool total watering time
value_template: >
{% set duration = states('sensor.zone2_time') %}
{{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
zone3_time_today:
- friendly_name: Zone 3 total watering time today
+ friendly_name: Walkway total watering time
value_template: >
{% set duration = states('sensor.zone3_time') %}
{{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
zone4_time_today:
- friendly_name: Zone 4 total watering time today
+ friendly_name: Citrus total watering time
value_template: >
{% set duration = states('sensor.zone4_time') %}
{{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
zone5_time_today:
- friendly_name: Zone 5 total watering time today
+ friendly_name: Lavander total watering time
value_template: >
{% set duration = states('sensor.zone5_time') %}
{{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
-
- cycle1_zone1_duration_adjusted:
- friendly_name: "Zone 1 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle1_zone1_duration') | int }}"
+ zone6_time_today:
+ friendly_name: Zone 6 total watering time
+ value_template: >
+ {% set duration = states('sensor.zone6_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle1_zone2_duration_adjusted:
- friendly_name: "Zone 2 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle1_zone2_duration') | int }}"
+ zone7_time_today:
+ friendly_name: Zone 7 total watering time
+ value_template: >
+ {% set duration = states('sensor.zone7_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle1_zone3_duration_adjusted:
- friendly_name: "Zone 3 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle1_zone3_duration') | int }}"
+ zone8_time_today:
+ friendly_name: Zone 8 total watering time
+ value_template: >
+ {% set duration = states('sensor.zone8_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle1_zone4_duration_adjusted:
- friendly_name: "Zone 4 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle1_zone4_duration') | int }}"
+ zone9_time_today:
+ friendly_name: Beds total watering time
+ value_template: >
+ {% set duration = states('sensor.zone9_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle1_zone5_duration_adjusted:
- friendly_name: "Zone 5 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle1_zone5_duration') | int }}"
+ zone10_time_today:
+ friendly_name: Poolside total watering time
+ value_template: >
+ {% set duration = states('sensor.zone10_time') %}
+ {{ duration|float|multiply(60)|round }}
+ unit_of_measurement: mins
+
+ zone11_time_today:
+ friendly_name: Upper Garden total watering time
+ value_template: >
+ {% set duration = states('sensor.zone11_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle2_zone1_duration_adjusted:
- friendly_name: "Zone 1 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle2_zone1_duration') | int }}"
+ zone12_time_today:
+ friendly_name: Vineyard total watering time
+ value_template: >
+ {% set duration = states('sensor.zone12_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle2_zone2_duration_adjusted:
- friendly_name: "Zone 2 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle2_zone2_duration') | int }}"
+ zone13_time_today:
+ friendly_name: Guest House total watering time
+ value_template: >
+ {% set duration = states('sensor.zone13_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle2_zone3_duration_adjusted:
- friendly_name: "Zone 3 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle2_zone3_duration') | int }}"
+ zone14_time_today:
+ friendly_name: Guest Driveway total watering time
+ value_template: >
+ {% set duration = states('sensor.zone14_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle2_zone4_duration_adjusted:
- friendly_name: "Zone 4 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle2_zone4_duration') | int }}"
+ zone15_time_today:
+ friendly_name: Main Driveway total watering time
+ value_template: >
+ {% set duration = states('sensor.zone15_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
- cycle2_zone5_duration_adjusted:
- friendly_name: "Zone 5 adjusted duration"
- value_template: "{{ states('input_number.adjusted_cycle2_zone5_duration') | int }}"
+ zone16_time_today:
+ friendly_name: Orchard total watering time
+ value_template: >
+ {% set duration = states('sensor.zone16_time') %}
+ {{ duration|float|multiply(60)|round }}
unit_of_measurement: mins
+
# History sensors
# Zone Times
- platform: history_stats
name: zone1_time
- entity_id: switch.zone1_valve
+ entity_id: switch.zone1
state: 'on'
type: time
- start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
- platform: history_stats
name: zone2_time
- entity_id: switch.zone2_valve
+ entity_id: switch.zone2
state: 'on'
type: time
- start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
- platform: history_stats
name: zone3_time
- entity_id: switch.zone3_valve
+ entity_id: switch.zone3
state: 'on'
type: time
- start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
- platform: history_stats
name: zone4_time
- entity_id: switch.zone4_valve
+ entity_id: switch.zone4
state: 'on'
type: time
- start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
- platform: history_stats
name: zone5_time
- entity_id: switch.zone5_valve
+ entity_id: switch.zone5
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone6_time
+ entity_id: switch.zone6
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone7_time
+ entity_id: switch.zone7
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone8_time
+ entity_id: switch.zone8
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone9_time
+ entity_id: switch.zone9
state: 'on'
type: time
- start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
+ - platform: history_stats
+ name: zone10_time
+ entity_id: switch.zone10
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone11_time
+ entity_id: switch.zone11
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone12_time
+ entity_id: switch.zone12
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone13_time
+ entity_id: switch.zone13
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone14_time
+ entity_id: switch.zone14
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone15_time
+ entity_id: switch.zone15
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
+
+ - platform: history_stats
+ name: zone16_time
+ entity_id: switch.zone16
+ state: 'on'
+ type: time
+ start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
+ end: '{{ now() }}'
diff --git a/packages/garden/garden_irrigation.yaml b/packages/garden/garden_irrigation.yaml
index f9eb6bc..1da8c5d 100644
--- a/packages/garden/garden_irrigation.yaml
+++ b/packages/garden/garden_irrigation.yaml
@@ -78,11 +78,11 @@ automation:
action:
- service: script.irrigation_run_a_cycle
data_template:
- cycle: 1
+ cycle: '1'
- service: script.update_next_runtime
data_template:
- cycle: 1
+ cycle: '1'
#=== Cycle 2
- alias: Irrigation - Run Cycle 2
@@ -104,11 +104,11 @@ automation:
action:
- service: script.irrigation_run_a_cycle
data_template:
- cycle: 2
+ cycle: '2'
- service: script.update_next_runtime
data_template:
- cycle: 2
+ cycle: '2'
#======================
@@ -333,7 +333,7 @@ script:
- service: script.irrigation_irrigate_a_zone
data_template:
cycle: '{{ cycle }}'
- zone: 1
+ zone: '1'
#=== Wait for script.irrigation_irrigate_a_zone to end
- wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
@@ -342,7 +342,7 @@ script:
- service: script.irrigation_irrigate_a_zone
data_template:
cycle: '{{ cycle }}'
- zone: 2
+ zone: '2'
#=== Wait for script.irrigation_irrigate_a_zone to end
- wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
@@ -351,7 +351,7 @@ script:
- service: script.irrigation_irrigate_a_zone
data_template:
cycle: '{{ cycle }}'
- zone: 3
+ zone: '3'
#=== Wait for script.irrigation_irrigate_a_zone to end
- wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
@@ -360,7 +360,7 @@ script:
- service: script.irrigation_irrigate_a_zone
data_template:
cycle: '{{ cycle }}'
- zone: 4
+ zone: '4'
#=== Wait for script.irrigation_irrigate_a_zone to end
- wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
@@ -369,7 +369,106 @@ script:
- service: script.irrigation_irrigate_a_zone
data_template:
cycle: '{{ cycle }}'
- zone: 5
+ zone: '5'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 6
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '6'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 7
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '7'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 8
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '8'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 9
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '9'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 10
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '10'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 11
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '11'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 12
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '12'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 13
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '13'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 14
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '14'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 15
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '15'
+
+ #=== Wait for script.irrigation_irrigate_a_zone to end
+ - wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
+
+ #=== Call the script to irrigate zone 16
+ - service: script.irrigation_irrigate_a_zone
+ data_template:
+ cycle: '{{ cycle }}'
+ zone: '16'
#=== Wait for script.irrigation_irrigate_a_zone to end
- wait_template: "{{ is_state('script.irrigation_irrigate_a_zone', 'off') }}"
@@ -407,8 +506,9 @@ script:
#=== Don't continue if switch is unavailable
- condition: template
value_template: >
- {{ states('switch.zone' + zone + '_valve') != 'unavailable' }}
+ {{ states('switch.zone' + zone) != 'unavailable' }}
+##### what is the impact of this weather adjustment in the formula ???????????????? ##########
#=== Don't continue if duration is zero
- condition: template
value_template: >
@@ -419,11 +519,11 @@ script:
{% endif %}
{{ n != 0 }}
- #=== Call the script to set the sonoff PULSETIME
- - service: script.set_sonoff_pulsetime
- data_template:
- cycle: '{{ cycle }}'
- zone: '{{ zone }}'
+ # #=== Call the script to set the sonoff PULSETIME
+ # - service: script.set_sonoff_pulsetime
+ # data_template:
+ # cycle: '{{ cycle }}'
+ # zone: '{{ zone }}'
#=== Wait 5 seconds for good measure to ensure previous zone is completly finished
- delay: "00:00:05"
@@ -436,7 +536,7 @@ script:
- service: switch.turn_on
data_template:
- entity_id: switch.zone{{ zone }}_valve
+ entity_id: switch.zone{{ zone }}
#=== Start timer for zone duration
- service: timer.start
@@ -457,7 +557,7 @@ script:
- service: switch.turn_off
data_template:
- entity_id: switch.zone{{ zone }}_valve
+ entity_id: switch.zone{{ zone }}
#=== Update progress in ui
- service: input_text.set_value
@@ -467,7 +567,7 @@ script:
#=== Be sure the current zone switch is off
- wait_template: >
- {% set entity = 'switch.zone' + zone + '_valve' %}
+ {% set entity = 'switch.zone' + zone %}
{{ is_state(entity , 'off') }}
@@ -491,29 +591,3 @@ script:
{% endif %}
time: >
{{ states('input_select.cycle' + cycle + '_schedule_time') }}
-
-
- #========================================================================
- #=== Set Sonoff PULSETIME to 30 seconds longer than the zone runtime
- #=== is passed:
- #=== {{ cycle }}
- #=== {{ zone }}
- #===
- #=== This acts as a fail safe in the event of any communication failure
- #=== between HA and the Sonoff. The Sonoff will switch off under its own
- #=== control so closing the valve.
- #===
- #=== Note: From the Tasmota wiki, for a Pulsetime greater than 11 seconds
- #=== it should be set to 100 + (minutes * 60)
- #========================================================================
- set_sonoff_pulsetime:
- sequence:
- - service: mqtt.publish
- data_template:
- topic: >
- sonoff4ch01/cmnd/pulsetime{{ zone }}
- payload: >
- {% set payload = states('input_number.cycle' + cycle + '_zone' + zone + '_duration') | int %}
- {% set payload = 100 + (payload * 60) + 30 %}
- {{ payload }}
-
diff --git a/packages/garden/garden_master_control.yaml b/packages/garden/garden_master_control.yaml
index f9ae7c1..090084e 100644
--- a/packages/garden/garden_master_control.yaml
+++ b/packages/garden/garden_master_control.yaml
@@ -21,7 +21,6 @@ automation:
trigger:
- platform: state
entity_id: input_boolean.irrigation_master_control_switch
-
- platform: homeassistant
event: start
diff --git a/packages/garden/garden_notifications.yaml b/packages/garden/garden_notifications.yaml
deleted file mode 100644
index 8e47b6d..0000000
--- a/packages/garden/garden_notifications.yaml
+++ /dev/null
@@ -1,101 +0,0 @@
-#================
-#=== Automations
-#================
-automation:
-
- #===================================================
- #=== Notify about irrigation events when on holiday
- #===================================================
- - alias: Irrigation - Notify about irrigation events when on holiday
- initial_state: on
- trigger:
- - platform: state
- entity_id:
- - input_boolean.cycle1_running
- - input_boolean.cycle2_running
-
- condition:
- - condition: state
- entity_id: binary_sensor.holiday_mode
- state: 'on'
-
- action:
- - service_template: >
- {% if trigger.to_state.state == 'on' %}
- script.notify_irrigation_start
- {% else %}
- script.notify_irrigation_end
- {% endif %}
- data_template:
- cycle: >
- {% if trigger.entity_id == 'input_boolean.cycle1_running' %}
- 1
- {% else %}
- 2
- {% endif %}
-
-
-#============
-#=== Scripts
-#============
-script:
-
- #===============================
- #=== Notify when a cycle starts
- #=== Called with
- #=== {{ cycle }}
- #===============================
- notify_irrigation_start:
- sequence:
- - service: script.notify
- data_template:
- tell: steve_and_sarah
- message: >
- {% set cycle_map = {
- '1': 'morning',
- '2': 'afternoon'
- } %}
- {% set cycle_time = cycle_map[cycle] %}
-
- {% if is_state('input_boolean.cycle' + cycle + '_use_weather_adjustment', 'off') %}
- {% set total_time = states('input_number.cycle' + cycle + '_zone1_duration') | int
- + states('input_number.cycle' + cycle + '_zone2_duration') | int
- + states('input_number.cycle' + cycle + '_zone3_duration') | int
- + states('input_number.cycle' + cycle + '_zone4_duration') | int
- + states('input_number.cycle' + cycle + '_zone5_duration') | int %}
-
- {% else %}
- {% set total_time = states('input_number.adjusted_cycle' + cycle + '_zone1_duration') | int
- + states('input_number.adjusted_cycle' + cycle + '_zone2_duration') | int
- + states('input_number.adjusted_cycle' + cycle + '_zone3_duration') | int
- + states('input_number.adjusted_cycle' + cycle + '_zone4_duration') | int
- + states('input_number.adjusted_cycle' + cycle + '_zone5_duration') | int %}
- {% endif %}
-
- I thought you'd like to know that the {{cycle_time}} irrigation cycle has just started.
-
-
- I expect it will take about {{ total_time }} minutes to finish but I'll let you know when it has.
-
-
- Don't worry your garden is safe with me. I hope you're having a lovely holiday!
-
-
- #=============================
- #=== Notify when a cycle ends
- #=== Called with
- #=== {{ cycle }}
- #=============================
- notify_irrigation_end:
- sequence:
- - service: script.notify
- data_template:
- tell: steve_and_sarah
- message: >
- {% set cycle_map = {
- '1': 'morning',
- '2': 'afternoon'
- } %}
- {% set cycle_time = cycle_map[cycle] %}
-
- All the {{cycle_time}} watering is done.
diff --git a/packages/garden/garden_valves_failsafe.yaml b/packages/garden/garden_valves_failsafe.yaml
deleted file mode 100644
index 7bf4cfa..0000000
--- a/packages/garden/garden_valves_failsafe.yaml
+++ /dev/null
@@ -1,188 +0,0 @@
-#============================================================================
-#=== Not that I don't trust my programming but...
-#=== 1. Turn off valves and schedules when master control switch is off
-#=== 2. Turn off all valves when HA starts
-#=== 3. Don't allow more than one valve on at one time
-#=== 4. Turn off valve 1 to 4 if it is on for longer than 30 minutes
-#=== Turn off valve 5 if it is on for longer than 59 minutes
-#=== Better safe than sorry!
-#============================================================================
-
-#================
-#=== Automations
-#================
-automation:
-
- #====================================================================
- #=== Master Control Switch
- #=== Turn off valves and schedules when master control switch is off
- #====================================================================
- - alias: Irrigation Failsafe - master control switch
- initial_state: on
- trigger:
- - platform: state
- entity_id: input_boolean.irrigation_master_control_switch
- to: 'off'
-
- - platform: homeassistant
- event: start
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - input_boolean.cycle1_enable
- - input_boolean.cycle2_enable
- - input_boolean.cycle1_manual_run
- - input_boolean.cycle2_manual_run
- - switch.zone1_valve
- - switch.zone2_valve
- - switch.zone3_valve
- - switch.zone4_valve
- - switch.zone5_valve
-
-
- #=======================================
- #=== Home Assistant starts
- #=== Turn off all valves when HA starts
- #=======================================
- - alias: Irrigation Failsafe - HA start
- initial_state: on
- trigger:
- - platform: homeassistant
- event: start
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - switch.zone1_valve
- - switch.zone2_valve
- - switch.zone3_valve
- - switch.zone4_valve
- - switch.zone5_valve
-
-
- #==================================================================
- #=== Don't allow more than one valve on at one time.
- #=== And
- #=== Turn off valve 1 to 4 if it is on for longer than 30 minutes.
- #=== Turn off valve 5 if it is on for longer than 59 minutes.
- #==================================================================
- #=== Valve 1 ON
- - alias: Irrigation Failsafe - Valve 1 on
- initial_state: on
- trigger:
- - platform: state
- entity_id:
- - switch.zone1_valve
- to: 'on'
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - switch.zone2_valve
- - switch.zone3_valve
- - switch.zone4_valve
- - switch.zone5_valve
-
- - wait_template: "{{ is_state('switch.zone1_valve', 'off') }}"
- timeout: '00:30:15'
-
- - service: homeassistant.turn_off
- entity_id: switch.zone1_valve
-
-
- #=== Valve 2 ON
- - alias: Irrigation Failsafe - Valve 2 on
- initial_state: on
- trigger:
- - platform: state
- entity_id:
- - switch.zone2_valve
- to: 'on'
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - switch.zone1_valve
- - switch.zone3_valve
- - switch.zone4_valve
- - switch.zone5_valve
-
- - wait_template: "{{ is_state('switch.zone2_valve', 'off') }}"
- timeout: '00:30:15'
-
- - service: homeassistant.turn_off
- entity_id: switch.zone2_valve
-
-
- #=== Valve 3 ON
- - alias: Irrigation Failsafe - Valve 3 on
- initial_state: on
- trigger:
- - platform: state
- entity_id:
- - switch.zone3_valve
- to: 'on'
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - switch.zone1_valve
- - switch.zone2_valve
- - switch.zone4_valve
- - switch.zone5_valve
-
- - wait_template: "{{ is_state('switch.zone3_valve', 'off') }}"
- timeout: '00:30:15'
-
- - service: homeassistant.turn_off
- entity_id: switch.zone3_valve
-
-
- #=== Valve 4 ON
- - alias: Irrigation Failsafe - Valve 4 on
- initial_state: on
- trigger:
- - platform: state
- entity_id:
- - switch.zone4_valve
- to: 'on'
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - switch.zone1_valve
- - switch.zone2_valve
- - switch.zone3_valve
- - switch.zone5_valve
-
- - wait_template: "{{ is_state('switch.zone4_valve', 'off') }}"
- timeout: '00:30:15'
-
- - service: homeassistant.turn_off
- entity_id: switch.zone4_valve
-
-
- #=== Valve 5 ON
- - alias: Irrigation Failsafe - Valve 5 on
- initial_state: on
- trigger:
- - platform: state
- entity_id:
- - switch.zone5_valve
- to: 'on'
-
- action:
- - service: homeassistant.turn_off
- entity_id:
- - switch.zone1_valve
- - switch.zone2_valve
- - switch.zone3_valve
- - switch.zone4_valve
-
- - wait_template: "{{ is_state('switch.zone5_valve', 'off') }}"
- timeout: '00:59:15'
-
- - service: homeassistant.turn_off
- entity_id: switch.zone5_valve
-
diff --git a/packages/garden/garden_weather_calculations.yaml b/packages/garden/garden_weather_calculations.yaml
deleted file mode 100644
index cd26ada..0000000
--- a/packages/garden/garden_weather_calculations.yaml
+++ /dev/null
@@ -1,316 +0,0 @@
-#=================
-# === Automations
-#=================
-automation:
-
- #=====================================================================
- #=== Adjust weather durations if:
- #=== the baseline duration is changed
- #=== the temperature threshold or rainfall baseline are changed
- #=== use weather adjustment is turn on
- #=====================================================================
-
- # Duration changed cycle 1
- - alias: Irrigation Weather - Adjust durations with change in cycle1 baseline duration
- initial_state: 'on'
- trigger:
- - platform: state
- entity_id:
- - input_number.cycle1_zone1_duration
- - input_number.cycle1_zone2_duration
- - input_number.cycle1_zone3_duration
- - input_number.cycle1_zone4_duration
- - input_number.cycle1_zone5_duration
-
- action:
- - wait_template: "{{ is_state('script.adjust_cycle1_durations', 'off') }}"
-
- - service: script.adjust_cycle1_durations
-
-
- # Duration changed cycle 1
- - alias: Irrigation Weather - Adjust durations with change in cycle2 baseline duration
- initial_state: 'on'
- trigger:
- - platform: state
- entity_id:
- - input_number.cycle2_zone1_duration
- - input_number.cycle2_zone2_duration
- - input_number.cycle2_zone3_duration
- - input_number.cycle2_zone4_duration
- - input_number.cycle2_zone5_duration
- action:
- - wait_template: "{{ is_state('script.adjust_cycle2_durations', 'off') }}"
-
- - service: script.adjust_cycle2_durations
-
- # Baselines changed
- - alias: Irrigation Weather - Adjust durations with change in rain or temp baseline
- initial_state: 'on'
- trigger:
- - platform: state
- entity_id:
- - input_number.temperature_baseline
- - input_number.rainfall_threshold
- action:
- - service: script.calculate_average_weather_conditions
-
- - wait_template: "{{ is_state('script.calculate_average_weather_conditions', 'off') }}"
-
- - service: script.adjust_cycle1_durations
-
- - service: script.adjust_cycle2_durations
-
- # Weather adjustment turned on
- - alias: Irrigation Weather - Option to use weather adjustment turned on
- initial_state: 'on'
- trigger:
- - platform: state
- entity_id:
- - input_boolean.cycle1_use_weather_adjustment
- - input_boolean.cycle2_use_weather_adjustment
- to: 'on'
- action:
- - service_template: >
- {% if trigger.entity_id == 'input_boolean.cycle1_use_weather_adjustment' %}
- script.adjust_cycle1_durations
- {% else %}
- script.adjust_cycle2_durations
- {% endif %}
-
-
- #============================================================
- #=== Recalculate average weather conditions every 30 minutes
- #=== And recalculate Cycle durations
- #============================================================
- - alias: Irrigation Weather - Update average weather conditions every 30 mins
- initial_state: 'on'
- trigger:
- - platform: time_pattern
- minutes: '/30'
- seconds: 00
- action:
- - service: script.calculate_average_weather_conditions
-
- - wait_template: "{{ is_state('script.calculate_average_weather_conditions', 'off') }}"
-
- # Adjust Cycle 1 durations
- - service: script.adjust_cycle1_durations
- - wait_template: "{{ is_state('script.adjust_cycle1_durations', 'off') }}"
-
- # Adjust Cycle 2 durations
- - service: script.adjust_cycle2_durations
- - wait_template: "{{ is_state('script.adjust_cycle2_durations', 'off') }}"
-
-
-#============
-#=== Scripts
-#============
-script:
-
- #=========================================
- #=== Calculate average weather conditions
- #=========================================
- calculate_average_weather_conditions:
- sequence:
-
- # Set today's forecast high temperature
- # but only if it has gone up
- # temp_minus0 is set to low every night at 23:50 in the automation that
- # cycles the weather information
- - service: input_number.set_value
- data_template:
- entity_id: input_number.temp_minus0
- value: >
- {% if states.input_number.temp_minus0.state | float < states.sensor.dark_sky_forecast_daytime_high_temperature_0.state | float %}
- {{ states('sensor.dark_sky_forecast_daytime_high_temperature_0') }}
- {% else %}
- {{ states('input_number.temp_minus0') }}
- {% endif %}
-
- # Calculate average high temp for today and yesterday
- - service: input_number.set_value
- data_template:
- entity_id: input_number.temp_high_2days
- value: >
- {{ ((float(states.input_number.temp_minus0.state) +
- float(states.input_number.temp_minus1.state)) / 2 ) | round }}
-
- # Calculate average high temp for the today and yesterday and previous 3 days
- - service: input_number.set_value
- data_template:
- entity_id: input_number.temp_high_5days
- value: >
- {{ ((float(states.input_number.temp_minus0.state) +
- float(states.input_number.temp_minus1.state) +
- float(states.input_number.temp_minus2.state) +
- float(states.input_number.temp_minus3.state) +
- float(states.input_number.temp_minus4.state)) / 5) | round }}
-
- # Adjust the total amount of rain depending on how many days ago it was.
- # If 3 days ago take 20% of the rain.
- # If 2 days ago take 50% of the rain.
- # If yesterday take 80% of the rain.
- - service: input_number.set_value
- data_template:
- entity_id: input_number.rain_3days_total
- value: >
- {{ (float(states.input_number.rain_minus1.state) * 0.8) +
- (float(states.input_number.rain_minus2.state) * 0.5) +
- (float(states.input_number.rain_minus3.state) * 0.2) }}
-
- # Add in todays forecast rain
- - service: input_number.set_value
- data_template:
- entity_id: input_number.rain_3days_total
- value: >
- {{ float(states.input_number.rain_3days_total.state) +
- (float(states.input_number.rain_minus0.state)) }}
-
- # Convert into a ratio (maximum 1.00) used to reduce irrigation time or stop it altogether:
- # Rain needed in last 3 days to stop grass irrigation is set in RainfallThreshold
- # Rain levels less than this amount will be used to reduce irrigation run times proportionally
- - service: input_number.set_value
- data_template:
- entity_id: input_number.rain_3days_ratio
- value: >
- {{ states.input_number.rain_3days_total.state | float / states.input_number.rainfall_threshold.state | float }}
-
- # Make sure ratio is not greater than 1
- - service: input_number.set_value
- data_template:
- entity_id: input_number.rain_3days_ratio
- value: >
- {% if states.input_number.rain_3days_ratio.state | float > 1 %}
- 1
- {% else %}
- {{ states.input_number.rain_3days_ratio.state }}
- {% endif %}
-
-
- #=========================================
- #=== Adjust duration for zones in cycle 1
- #=========================================
- adjust_cycle1_durations:
- sequence:
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '1'
- zone: '1'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '1'
- zone: '2'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '1'
- zone: '3'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '1'
- zone: '4'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '1'
- zone: '5'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
-
- #=========================================
- #=== Adjust duration for zones in cycle 2
- #=========================================
- adjust_cycle2_durations:
- sequence:
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '2'
- zone: '1'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '2'
- zone: '2'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '2'
- zone: '3'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '2'
- zone: '4'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
- - service: script.calculate_adjusted_zone_durations
- data:
- cycle: '2'
- zone: '5'
- - wait_template: "{{ is_state('script.calculate_adjusted_zone_durations', 'off') }}"
-
-
- #========================================================
- #=== Adjust zone duration for average weather conditions
- #=== is passed:
- #=== {{ cycle }}
- #=== {{ zone }}
- #========================================================
- calculate_adjusted_zone_durations:
- sequence:
-
- # Adjust for average daily temperature
-
- # Calculate any change in run time based on daily average temperature.
- # The default run time will occur at TemperatureBaseline degrees.
- # As the daily average temperature increases above this the run time will
- # also increase.
- # As the average temp drops below TemperatureBaseline the run time decreases.
- # The forumla used ‐ based on a 20 degree TemperatureBaseline would be:
- # (((TwoDayHighAverageTemp ‐ 20) / 20) +1) * BaseLineDuration
- # So: the percentage change in duration is the same as the percentage
- # difference between the actual temperature and the baseline temperature
- # i.e. a 10% increase in duration when the baseline temperataure
- # is 20 degrees and the actual temperature is 22 degrees
-
- # First adjust for temperature
- - service: input_number.set_value
- data_template:
- entity_id: input_number.adjusted_cycle{{ cycle }}_zone{{ zone }}_duration
- value: >
- {% set duration = states('input_number.cycle' + cycle + '_zone' + zone + '_duration') %}
- {{ (((float(states.input_number.temp_high_2days.state) - float(states.input_number.temperature_baseline.state)) / float(states.input_number.temperature_baseline.state)) + 1) * float(duration) }}
-
- # Then adjust for average daily rainfall
- - service: input_number.set_value
- data_template:
- entity_id: input_number.adjusted_cycle{{ cycle }}_zone{{ zone }}_duration
- value: >
- {% set normal_duration = states('input_number.cycle' + cycle + '_zone' + zone + '_duration') %}
- {% set adj_duration = states('input_number.adjusted_cycle' + cycle + '_zone' + zone + '_duration') %}
- {{ float(adj_duration) - (float(normal_duration) * float(states.input_number.rain_3days_ratio.state)) }}
-
- # Make sure new duration is not less than zero
- - service: input_number.set_value
- data_template:
- entity_id: input_number.adjusted_cycle{{ cycle }}_zone{{ zone }}_duration
- value: >
- {% if states('input_number.adjusted_cycle' + cycle + '_zone' + zone + '_duration') | float < 0 %}
- 0
- {% else %}
- {{ states('input_number.adjusted_cycle' + cycle + '_zone' + zone + '_duration') }}
- {% endif %}
-
-# This elif was removed when zone 5 was allowed to go to 59 minutes
-# {% elif states('input_number.adjusted_cycle' + cycle + '_zone' + zone + '_duration') | float > 30 %}
-# 30
diff --git a/packages/garden/garden_weather_data_collection.yaml b/packages/garden/garden_weather_data_collection.yaml
deleted file mode 100644
index 580f7e1..0000000
--- a/packages/garden/garden_weather_data_collection.yaml
+++ /dev/null
@@ -1,348 +0,0 @@
-
-#==================
-#=== Input_Numbers
-#==================
-input_number:
- # Temperature
- temp_minus0:
- name: Temp today
- min: 0
- max: 40
- icon: mdi:thermometer
-
- temp_minus1:
- name: Temp yesterday
- min: 0
- max: 40
- icon: mdi:thermometer
-
- temp_minus2:
- name: Temp 2 days ago
- min: 0
- max: 40
- icon: mdi:thermometer
-
- temp_minus3:
- name: Temp 3 days ago
- min: 0
- max: 40
- icon: mdi:thermometer
-
- temp_minus4:
- name: Temp 4 days ago
- min: 0
- max: 40
- icon: mdi:thermometer
-
- temp_high_2days:
- name: Avg 2 day temp
- min: 0
- max: 40
- mode: box
- icon: mdi:thermometer
-
- temp_high_5days:
- name: Avg 5 day temp
- min: 0
- max: 40
- mode: box
- icon: mdi:thermometer
-
-
- # Rainfall
- rain_minus0:
- name: Rain today
- min: 0
- max: 100
- icon: mdi:weather-rainy
-
- rain_minus1:
- name: Rain yesterday
- min: 0
- max: 100
- icon: mdi:weather-rainy
-
- rain_minus2:
- name: Rain 2 days ago
- min: 0
- max: 100
- icon: mdi:weather-rainy
-
- rain_minus3:
- name: Rain 3 days ago
- min: 0
- max: 100
- icon: mdi:weather-rainy
-
- rain_3days_total:
- name: Last 3 days rain
- min: 0
- max: 500
- mode: box
- icon: mdi:weather-rainy
-
- rain_3days_ratio:
- name: Last 3 days rain adj
- min: 0
- max: 100
- step: 0.01
- mode: box
- icon: mdi:weather-rainy
-
-
-#============
-#=== Sensors
-#============
-sensor:
- - platform: template
- sensors:
- # Weather information sensors
- # Temperature
- temp_minus0:
- friendly_name: Temp today
- value_template: "{{ states('input_number.temp_minus0') }}"
- unit_of_measurement: "°C"
-
- temp_minus1:
- friendly_name: Temp yesterday
- value_template: "{{ states('input_number.temp_minus1') }}"
- unit_of_measurement: "°C"
-
- temp_minus2:
- friendly_name: Temp 2 days ago
- value_template: "{{ states('input_number.temp_minus2') }}"
- unit_of_measurement: "°C"
-
- temp_minus3:
- friendly_name: Temp 3 days ago
- value_template: "{{ states('input_number.temp_minus3') }}"
- unit_of_measurement: "°C"
-
- temp_minus4:
- friendly_name: Temp 4 days ago
- value_template: "{{ states('input_number.temp_minus4') }}"
- unit_of_measurement: "°C"
-
- temp_high_2days:
- friendly_name: Avg 2 day temp
- value_template: "{{ states('input_number.temp_high_2days') }}"
- unit_of_measurement: "°C"
-
- temp_high_5days:
- friendly_name: Avg 5 day temp
- value_template: "{{ states('input_number.temp_high_5days') }}"
- unit_of_measurement: "°C"
-
-
- # Rainfall
- # rain_minus0:
- # friendly_name: Rain today
- # value_template: "{{ states('input_number.rain_minus0') | int }}"
- # unit_of_measurement: "mm"
-
- rain_minus0:
- friendly_name: Rain today
- value_template: "{{ states('sensor.smartweather_rain_today') }}"
- unit_of_measurement: "mm"
-
- rain_minus1:
- friendly_name: Rain yesterday
- value_template: "{{ states('input_number.rain_minus1') }}"
- unit_of_measurement: "mm"
-
- rain_minus2:
- friendly_name: Rain 2 days ago
- value_template: "{{ states('input_number.rain_minus2') }}"
- unit_of_measurement: "mm"
-
- rain_minus3:
- friendly_name: Rain 3 days ago
- value_template: "{{ states('input_number.rain_minus3') }}"
- unit_of_measurement: "mm"
-
- rain_3days_ratio:
- friendly_name: Last 3 days rain adj. multiplyer
- value_template: "{{ states('input_number.rain_3days_ratio') }}"
-
-
-#=================
-# === Automations
-#=================
-automation:
-
- #================================================
- #=== Collect new and cycle historic weather data
- #================================================
- - alias: Irrigation Weather Data - Collect new and cycle historic weather data
- initial_state: 'on'
- trigger:
- - platform: time
- at: '01:00:00'
-
- action:
- # These scripts pass the count of entities but in this case as I
- # have numbered them beginning with zero pass the count minus 1
-
- # Cycle the temperature figures
- - service: script.garden_temperature_data
- data_template:
- loop_count: >
- {% set ns = namespace(count = 0) %}
- {% for item in states if item.entity_id.startswith('input_number.temp_minus') %}
- {% set ns.count = loop.index %}
- {% endfor %}
- {{ (ns.count - 1) }}
-
- # Cycle the rainfall figures
- - service: script.garden_rainfall_data
- data_template:
- loop_count: >
- {% set ns = namespace(count = 0) %}
- {% for item in states if item.entity_id.startswith('input_number.rain_minus') %}
- {% set ns.count = loop.index %}
- {% endfor %}
- {{ (ns.count - 1) }}
-
-###### EXTRA AUTOMATION NEEDED HERE
-###### TO COLLECT RAINFALL DATA EVERY HOUR
-###### INTO input_number.rain_minus0
-###### USING sensor.smartweather_precpitation_last_1hr
-######
-###### This could be done before irrigation starts by
-###### by using sensor.smartweather_rain_today if
-###### weather adjustments are being made as it is not
-###### needed for cycling the history
-
-#=============
-# === Scripts
-#=============
-script:
-
- #====================================================
- #=== Collect new and cycle historic TEMPERATURE data
- #====================================================
- garden_temperature_data:
- sequence:
-
- # Cycle the temperature figures.
- # Passed {{ loop_count}} which is the number relating to the highest entity
- # e.g. input_number.temp_minus4
-
- # Setting the temperature for today:
- # DarkSky dark_sky_forecast_temperature_high_0 is used as the high temperature.
-
- # ===== THIS NEEDS TO BE LOOKED AT
- # The average weather calculations happen every 30 mins and will
- # only update todays temperature if it goes up.
- # This is because the DarkSky max temperature appears to change during
- # the day to reflect max temperature for the remainder of the day???
-
- - service: input_number.set_value
- data_template:
- entity_id: >
- input_number.temp_minus{{ loop_count }}
- value: >
- {% if loop_count | int == 0 %}
- {{ states('sensor.dark_sky_forecast_daytime_high_temperature_0d') | float }}
- {% else %}
- {{ states('input_number.temp_minus' ~ (loop_count | int - 1) | string) }}
- {% endif %}
-
- # Stop when count is 0
- - condition: template
- value_template: >
- {{ loop_count | int > 0 }}
-
- # Stop the looping script...
- - service: homeassistant.turn_off
- entity_id: script.loop_garden_temperature_data
-
- # ...before looping
- - service: script.loop_garden_temperature_data
- data_template:
- loop_count: >
- {{ loop_count }}
-
-
- #============================================
- #=== Loop the script garden_temperature_data
- #============================================
- loop_garden_temperature_data:
- sequence:
-
- # Stop the calling script...
- - service: homeassistant.turn_off
- entity_id: script.garden_temperature_data
-
- # ...then restart it
- - service: script.garden_temperature_data
- data_template:
- loop_count: >
- {{ loop_count | int - 1 }}
-
-
- #=================================================
- #=== Collect new and cycle historic RAINFALL data
- #=================================================
- garden_rainfall_data:
- sequence:
-
- # Cycle the rainfall figures.
- # Passed {{ loop_count}} which is the number relating to the highest entity
- # e.g. input_number.rain_minus3
-
- # Now using sensor.smartweather_rain_yesterday
- # Make todays rain zero
-
- - service: input_number.set_value
- data_template:
- entity_id: >
- input_number.rain_minus{{ loop_count }}
- value: >
- {% if loop_count | int == 0 %}
- 0
- {% elif loop_count | int == 1 %}
- {{ states('sensor.smartweather_rain_yesterday') }}
- {% else %}
- {{ states('input_number.rain_minus' ~ (loop_count | int - 1) | string) }}
- {% endif %}
-
- # # Stop when count is 0
- # - condition: template
- # value_template: >
- # {{ loop_count | int > 0 }}
-
- # Stop when count is 1 because day zero is rain today which
- # is collected directly from the sensor.smartweather_rain_today
- - condition: template
- value_template: >
- {{ loop_count | int > 1 }}
-
- # Stop the looping script...
- - service: homeassistant.turn_off
- entity_id: script.loop_garden_rainfall_data
-
- # ...before looping
- - service: script.loop_garden_rainfall_data
- data_template:
- loop_count: >
- {{ loop_count }}
-
-
- #=========================================
- #=== Loop the script garden_rainfall_data
- #=========================================
- loop_garden_rainfall_data:
- sequence:
-
- # Stop the calling script...
- - service: homeassistant.turn_off
- entity_id: script.garden_rainfall_data
-
- # ...then restart it
- - service: script.garden_rainfall_data
- data_template:
- loop_count: >
- {{ loop_count | int - 1 }}
-
-
diff --git a/packages/garden/lovelace.yml b/packages/garden/lovelace.yml
new file mode 100644
index 0000000..12ae25a
--- /dev/null
+++ b/packages/garden/lovelace.yml
@@ -0,0 +1,167 @@
+ - badges: []
+ cards:
+ - cards:
+ - entity: input_boolean.irrigation_master_control_switch
+ state_image:
+ 'off': /local/sprinkler-off.png
+ 'on': /local/sprinkler-on.png
+ tap_action:
+ action: toggle
+ type: picture-entity
+ - card:
+ cards:
+ - cards:
+ - entity: input_boolean.cycle1_manual_run
+ name: West Side
+ tap_action:
+ action: toggle
+ type: 'custom:toggle-lock-entity-row'
+ - entity: input_boolean.cycle2_manual_run
+ name: East Side
+ tap_action:
+ action: toggle
+ type: 'custom:toggle-lock-entity-row'
+ type: horizontal-stack
+ - entities:
+ - entity: switch.zone1
+ icon: 'mdi:engine'
+ - entity: switch.zone2
+ icon: 'mdi:engine'
+ - entity: switch.zone3
+ icon: 'mdi:engine'
+ - entity: switch.zone4
+ icon: 'mdi:engine'
+ - entity: switch.zone5
+ icon: 'mdi:engine'
+ title: West Side
+ type: glance
+ - entities:
+ - entity: switch.zone9
+ icon: 'mdi:engine'
+ - entity: switch.zone10
+ icon: 'mdi:engine'
+ - entity: switch.zone11
+ icon: 'mdi:engine'
+ - entity: switch.zone12
+ icon: 'mdi:engine'
+ - entity: switch.zone13
+ icon: 'mdi:engine'
+ - entity: switch.zone14
+ icon: 'mdi:engine'
+ - entity: switch.zone15
+ icon: 'mdi:engine'
+ - entity: switch.zone16
+ icon: 'mdi:engine'
+ title: East Side
+ type: glance
+ - entities:
+ - head:
+ entity: sensor.last_irrigated_time
+ icon: 'mdi:update'
+ items:
+ - entity: sensor.zone1_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone2_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone3_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone4_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone5_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone9_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone10_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone11_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone12_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone13_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone14_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone15_time_today
+ icon: 'mdi:water'
+ - entity: sensor.zone16_time_today
+ icon: 'mdi:water'
+ type: 'custom:fold-entity-row'
+ show_header_toggle: false
+ title: Irrigation History
+ type: entities
+ type: vertical-stack
+ conditions:
+ - entity: input_boolean.irrigation_master_control_switch
+ state: 'on'
+ type: conditional
+ type: vertical-stack
+ - card:
+ entities:
+ - entity: sensor.cycle1_running
+ name: West Side Area
+ - entity: sensor.cycle1_zone_being_watered
+ icon: 'mdi:fountain'
+ - timer.cycle1_zone_duration
+ - head:
+ entity: sensor.cycle1_running
+ items:
+ - input_number.cycle1_zone1_duration
+ - input_number.cycle1_zone2_duration
+ - input_number.cycle1_zone3_duration
+ - input_number.cycle1_zone4_duration
+ - input_number.cycle1_zone5_duration
+ type: 'custom:fold-entity-row'
+ - head:
+ entity: input_boolean.cycle1_enable
+ type: 'custom:toggle-lock-entity-row'
+ items:
+ - entity: sensor.cycle1_next_run_time
+ icon: 'mdi:clock-start'
+ - input_select.cycle1_schedule_time
+ - input_select.cycle1_watering_days
+ type: 'custom:fold-entity-row'
+ show_header_toggle: false
+ title: West Side
+ type: entities
+ conditions:
+ - entity: input_boolean.irrigation_master_control_switch
+ state: 'on'
+ type: conditional
+ - card:
+ entities:
+ - entity: sensor.cycle2_running
+ name: East Side
+ - entity: sensor.cycle2_zone_being_watered
+ icon: 'mdi:fountain'
+ - timer.cycle2_zone_duration
+ - head:
+ entity: sensor.cycle2_running
+ name: East Side
+ items:
+ - input_number.cycle2_zone9_duration
+ - input_number.cycle2_zone10_duration
+ - input_number.cycle2_zone11_duration
+ - input_number.cycle2_zone12_duration
+ - input_number.cycle2_zone13_duration
+ - input_number.cycle2_zone14_duration
+ - input_number.cycle2_zone15_duration
+ - input_number.cycle2_zone16_duration
+ type: 'custom:fold-entity-row'
+ - head:
+ entity: input_boolean.cycle2_enable
+ type: 'custom:toggle-lock-entity-row'
+ items:
+ - entity: sensor.cycle2_next_run_time
+ icon: 'mdi:clock-start'
+ - input_select.cycle2_schedule_time
+ - input_select.cycle2_watering_days
+ type: 'custom:fold-entity-row'
+ show_header_toggle: false
+ title: East Side
+ type: entities
+ conditions:
+ - entity: input_boolean.irrigation_master_control_switch
+ state: 'on'
+ type: conditional
+ icon: 'mdi:flower'
+ title: Garden
\ No newline at end of file
diff --git a/packages/garden/system off.jpg b/packages/garden/system off.jpg
new file mode 100644
index 0000000..5c1c8b6
Binary files /dev/null and b/packages/garden/system off.jpg differ
diff --git a/packages/garden/system off_small.jpg b/packages/garden/system off_small.jpg
new file mode 100644
index 0000000..48e54a8
Binary files /dev/null and b/packages/garden/system off_small.jpg differ
diff --git a/packages/garden/system on.jpg b/packages/garden/system on.jpg
new file mode 100644
index 0000000..3a9c348
Binary files /dev/null and b/packages/garden/system on.jpg differ
diff --git a/packages/garden/system on_small.jpg b/packages/garden/system on_small.jpg
new file mode 100644
index 0000000..93a201d
Binary files /dev/null and b/packages/garden/system on_small.jpg differ
diff --git a/packages/occupancy/README.md b/packages/occupancy/README.md
deleted file mode 100644
index 685bfad..0000000
--- a/packages/occupancy/README.md
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-__Guest Mode 'ON'__
-
-
-
-
-__Guest Mode 'ON' expanded__
-
-
-
-
-__Guest Mode 'ON' fully expanded__
-
-
-
-
-__Guest Mode 'ON' two schedules fully expanded__
-
-
-
-
-__Guest Mode popup__
-
-
diff --git a/packages/occupancy/occupancy_guest_mode.yaml b/packages/occupancy/occupancy_guest_mode.yaml
deleted file mode 100644
index 0cb5b76..0000000
--- a/packages/occupancy/occupancy_guest_mode.yaml
+++ /dev/null
@@ -1,354 +0,0 @@
-#================
-#=== Automations
-#================
-automation:
-
- #====================================================
- #=== Check Guest mode schedule timers at HA start up
- #===
- #=== If the house is not in holiday mode and
- #=== if they are turned on, it is the right day and
- #=== the time now is during the on time then set
- #=== the timer to run until the scheduled end time.
- #====================================================
- #=== Guest Schedule 1
- - alias: Guest mode schedule 1 check at startup
- # initial_state: on
- trigger:
- - platform: homeassistant
- event: start
-
- condition:
- - condition: state
- entity_id: binary_sensor.holiday_mode
- state: 'off'
-
- - condition: state
- entity_id: input_boolean.guest_mode_schedule_1
- state: 'on'
-
- - condition: or
- conditions:
- - condition: template
- value_template: "{{ states('input_select.guest_mode_schedule_1_day') == now().strftime('%A') }}"
-
- - condition: state
- entity_id: input_select.guest_mode_schedule_1_day
- state: 'Every Day'
-
- - condition: template
- value_template: >
- {% set time_now = as_timestamp(now()) %}
- {% set start_time = states('input_datetime.guest_mode_schedule_1_start_time') %}
- {% set start_time = as_timestamp(now()) | timestamp_custom('%Y-%m-%d') + ' ' + start_time %}
- {% set duration = states('input_number.guest_mode_schedule_1_duration') | int * 60 %}
- {% set end_time = as_timestamp(start_time) + duration %}
-
- {{ time_now > as_timestamp(start_time) and time_now < end_time }}
-
- action:
- - service: timer.start
- data_template:
- entity_id: timer.guest_mode_schedule_1_duration
- duration: >
- {% set time_now = as_timestamp(now()) %}
- {% set start_time = states('input_datetime.guest_mode_schedule_1_start_time') %}
- {% set start_time = as_timestamp(now()) | timestamp_custom('%Y-%m-%d') + ' ' + start_time %}
- {% set duration = states('input_number.guest_mode_schedule_1_duration') | int * 60 %}
- {% set end_time = as_timestamp(start_time) + duration %}
- {% set seconds_left = end_time - time_now %}
- {% set hours_left = seconds_left // 3600 %}
- {% set minutes_left = (seconds_left - (hours_left * 3600)) // 60 %}
-
- {{ '%02i' | format(hours_left) }}:{{ '%02i' | format(minutes_left) }}:01
-
-
- #=== Guest Schedule 2
- - alias: Guest mode schedule 2 check at startup
- # initial_state: on
- trigger:
- - platform: homeassistant
- event: start
-
- condition:
- - condition: state
- entity_id: binary_sensor.holiday_mode
- state: 'off'
-
- - condition: state
- entity_id: input_boolean.guest_mode_schedule_2
- state: 'on'
-
- - condition: or
- conditions:
- - condition: template
- value_template: "{{ states('input_select.guest_mode_schedule_2_day') == now().strftime('%A') }}"
-
- - condition: state
- entity_id: input_select.guest_mode_schedule_2_day
- state: 'Every Day'
-
- - condition: template
- value_template: >
- {% set time_now = as_timestamp(now()) %}
- {% set start_time = states('input_datetime.guest_mode_schedule_2_start_time') %}
- {% set start_time = as_timestamp(now()) | timestamp_custom('%Y-%m-%d') + ' ' + start_time %}
- {% set duration = states('input_number.guest_mode_schedule_2_duration') | int * 60 %}
- {% set end_time = as_timestamp(start_time) + duration %}
-
- {{ time_now > as_timestamp(start_time) and time_now < end_time }}
- action:
- - service: timer.start
- data_template:
- entity_id: timer.guest_mode_schedule_2_duration
- duration: >
- {% set time_now = as_timestamp(now()) %}
- {% set start_time = states('input_datetime.guest_mode_schedule_2_start_time') %}
- {% set start_time = as_timestamp(now()) | timestamp_custom('%Y-%m-%d') + ' ' + start_time %}
- {% set duration = states('input_number.guest_mode_schedule_2_duration') | int * 60 %}
- {% set end_time = as_timestamp(start_time) + duration %}
- {% set seconds_left = end_time - time_now %}
- {% set hours_left = seconds_left // 3600 %}
- {% set minutes_left = (seconds_left - (hours_left * 3600)) // 60 %}
-
- {{ '%02i' | format(hours_left) }}:{{ '%02i' | format(minutes_left) }}:01
-
-
- #====================
- #===
- #=== Guest Mode Once
- #===
- #====================
- #==================================================
- #=== Start the Guest Mode once timer
- #===
- #=== This is allowed when house is in holiday mode
- #=== to allow it to be turned on from Telegram but
- #=== in that case when timer is finished it will
- #=== then turn on Holiday Mode (Forced)
- #==================================================
- - alias: Guest Mode once start timer
- # initial_state: on
- trigger:
- - platform: state
- entity_id: input_boolean.guest_mode_once
- to: 'on'
-
- - platform: state
- entity_id: input_number.guest_mode_once_duration
-
- condition:
- - condition: state
- entity_id: input_boolean.guest_mode_once
- state: 'on'
-
- action:
- # Cancel the timer
- - service: timer.cancel
- data_template:
- entity_id: timer.guest_mode_once_duration
-
- # Re-start timer with new duration
- # Note that 00:00:00 doesn't work as a duration so always include one second
- - service: timer.start
- data_template:
- entity_id: timer.guest_mode_once_duration
- duration: >
- {% set duration = states('input_number.guest_mode_once_duration') | int %}
- {% set hours = duration // 60 %}
- {% set minutes = duration - (hours * 60) %}
- {{ '%02i' | format(hours) }}:{{ '%02i' | format(minutes) }}:01
-
-
- #==============================================================
- #=== Turn off Guest Mode once when the timer is finished and
- #=== turn holiday mode back on if it was on when timer started
- #==============================================================
- - alias: Guest Mode once timer finished
- # initial_state: on
- trigger:
- - platform: event
- event_type: timer.finished
- event_data:
- entity_id: timer.guest_mode_once_duration
-
- action:
- - service: input_boolean.turn_off
- data:
- entity_id: input_boolean.guest_mode_once
-
-
- #======================================
- #=== Turn off Guest Mode once manually
- #======================================
- - alias: Guest Mode once off
- # initial_state: on
- trigger:
- - platform: state
- entity_id: input_boolean.guest_mode_once
- to: 'off'
-
- action:
- - service: timer.finish
- data_template:
- entity_id: timer.guest_mode_once_duration
-
-
- #==========================
- #===
- #=== Guest Mode Schedule 1
- #===
- #==========================
- #===========================================
- #=== Start the scheduled Guest Mode 1 timer
- #=== If the house is not in holiday mode
- #=== At the right time
- #=== If it is the right day
- #===========================================
- - alias: Guest Mode schedule 1 start timer
- # initial_state: on
- trigger:
- - platform: template
- value_template: "{{ states('sensor.time') ~ ':00' == states('input_datetime.guest_mode_schedule_1_start_time') }}"
-
- condition:
- - condition: state
- entity_id: binary_sensor.holiday_mode
- state: 'off'
-
- - condition: state
- entity_id: input_boolean.guest_mode_schedule_1
- state: 'on'
-
- - condition: template
- value_template: "{{ states('input_select.guest_mode_schedule_1_day') == now().strftime('%A') or
- states('input_select.guest_mode_schedule_1_day') == 'Every Day' }}"
-
- action:
- # Cancel the timer
- - service: timer.cancel
- data_template:
- entity_id: timer.guest_mode_schedule_1_duration
-
- # Re-start timer with new duration
- # Note that 00:00:00 doesn't work as a duration so always include one second
- - service: timer.start
- data_template:
- entity_id: timer.guest_mode_schedule_1_duration
- duration: >
- {% set duration = states('input_number.guest_mode_schedule_1_duration') | int %}
- {% set hours = duration // 60 %}
- {% set minutes = duration - (hours * 60) %}
- {{ '%02i' | format(hours) }}:{{ '%02i' | format(minutes) }}:01
-
- - service: browser_mod.command
- data:
- command: popup
- title: Guest Mode Schedule 1 has started
- card:
- type: entity-filter
- show_header_toggle: false
- entities:
- - timer.guest_mode_once_duration
- - timer.guest_mode_schedule_1_duration
- - timer.guest_mode_schedule_2_duration
- state_filter:
- - "active"
- deviceID:
- - MYPC
-
-
- #=============================================
- #=== Turn off scheduled Guest Mode 1 manually
- #=============================================
- - alias: Guest Mode schedule 1 off
- # initial_state: on
- trigger:
- - platform: state
- entity_id: input_boolean.guest_mode_schedule_1
- to: 'off'
-
- action:
- - service: timer.finish
- data_template:
- entity_id: timer.guest_mode_schedule_1_duration
-
-
- #==========================
- #===
- #=== Guest Mode Schedule 2
- #===
- #==========================
- #===========================================
- #=== Start the scheduled Guest Mode 2 timer
- #=== If the house is not in holiday mode
- #=== At the right time
- #=== If it is the right day
- #===========================================
- - alias: Guest Mode schedule 2 start timer
- # initial_state: on
- trigger:
- - platform: template
- value_template: "{{ states('sensor.time') ~ ':00' == states('input_datetime.guest_mode_schedule_2_start_time') }}"
-
- condition:
- - condition: state
- entity_id: binary_sensor.holiday_mode
- state: 'off'
-
- - condition: state
- entity_id: input_boolean.guest_mode_schedule_2
- state: 'on'
-
- - condition: template
- value_template: "{{ states('input_select.guest_mode_schedule_2_day') == now().strftime('%A') or
- states('input_select.guest_mode_schedule_2_day') == 'Every Day' }}"
-
- action:
- # Cancel the timer
- - service: timer.cancel
- data_template:
- entity_id: timer.guest_mode_schedule_2_duration
-
- # Re-start timer with new duration
- # Note that 00:00:00 doesn't work as a duration so always include one second
- - service: timer.start
- data_template:
- entity_id: timer.guest_mode_schedule_2_duration
- duration: >
- {% set duration = states('input_number.guest_mode_schedule_2_duration') | int %}
- {% set hours = duration // 60 %}
- {% set minutes = duration - (hours * 60) %}
- {{ '%02i' | format(hours) }}:{{ '%02i' | format(minutes) }}:01
-
- - service: browser_mod.command
- data:
- command: popup
- title: Guest Mode Schedule 2 has started
- card:
- type: entity-filter
- show_header_toggle: false
- entities:
- - timer.guest_mode_once_duration
- - timer.guest_mode_schedule_1_duration
- - timer.guest_mode_schedule_2_duration
- state_filter:
- - "active"
- deviceID:
- - MYPC
-
-
- #=============================================
- #=== Turn off scheduled Guest Mode 2 manually
- #=============================================
- - alias: Guest Mode schedule 2 off
- # initial_state: on
- trigger:
- - platform: state
- entity_id: input_boolean.guest_mode_schedule_2
- to: 'off'
-
- action:
- - service: timer.finish
- data_template:
- entity_id: timer.guest_mode_schedule_2_duration
diff --git a/packages/occupancy/occupancy_guest_mode_globals.yaml b/packages/occupancy/occupancy_guest_mode_globals.yaml
deleted file mode 100644
index 9f4591a..0000000
--- a/packages/occupancy/occupancy_guest_mode_globals.yaml
+++ /dev/null
@@ -1,124 +0,0 @@
-#===================
-#=== Input booleans
-#===================
-input_boolean:
-
- # Guest mode is used when a guest is in the house but either does not
- # have a known device or is not 'trusted' indefinitely e.g. the cleaner.
- guest_mode_once:
- name: Guest mode (once)
- icon: mdi:human-handsup
-
- guest_mode_schedule_1:
- name: Guest mode schedule (1)
- icon: mdi:human-handsup
-
- guest_mode_schedule_2:
- name: Guest mode schedule (2)
- icon: mdi:human-handsup
-
- holiday_mode_on:
- name: Holiday mode on
- icon: mdi:beach
-
-
-#================
-#=== Input texts
-#================
-input_text:
- guest_mode_schedule_1_name:
- name: Name
-
- guest_mode_schedule_2_name:
- name: Name
-
-
-#===================
-#=== Input numbers
-#===================
-input_number:
- guest_mode_once_duration:
- name: Duration
- icon: mdi:camera-timer
- min: 0
- max: 360
- step: 30
- unit_of_measurement: 'mins'
-
- guest_mode_schedule_1_duration:
- name: Duration
- icon: mdi:camera-timer
- min: 0
- max: 360
- step: 30
- unit_of_measurement: 'mins'
-
- guest_mode_schedule_2_duration:
- name: Duration
- icon: mdi:camera-timer
- min: 0
- max: 360
- step: 30
- unit_of_measurement: 'mins'
-
-
-#==================
-#=== Input selects
-#==================
-input_select:
- guest_mode_schedule_1_day:
- name: Day
- options:
- - 'Every Day'
- - 'Monday'
- - 'Tuesday'
- - 'Wednesday'
- - 'Thursday'
- - 'Friday'
- - 'Sataurday'
- - 'Sunday'
- icon: mdi:calendar
-
- guest_mode_schedule_2_day:
- name: Day
- options:
- - 'Every Day'
- - 'Monday'
- - 'Tuesday'
- - 'Wednesday'
- - 'Thursday'
- - 'Friday'
- - 'Sataurday'
- - 'Sunday'
- icon: mdi:calendar
-
-
-#====================
-#=== Input datetimes
-#====================
-input_datetime:
- guest_mode_schedule_1_start_time:
- name: Start time
- has_date: false
- has_time: true
-
- guest_mode_schedule_2_start_time:
- name: Start time
- has_date: false
- has_time: true
-
-
-#===========
-#=== timers
-#===========
-timer:
- guest_mode_once_duration:
- name: Time remaining (once)
-
- guest_mode_schedule_1_duration:
- name: Time remaining (schedule 1)
-
- guest_mode_schedule_2_duration:
- name: Time remaining (schedule 2)
-
-
diff --git a/packages/occupancy/screenshots/GuestModeOff.png b/packages/occupancy/screenshots/GuestModeOff.png
deleted file mode 100644
index e33d543..0000000
Binary files a/packages/occupancy/screenshots/GuestModeOff.png and /dev/null differ
diff --git a/packages/occupancy/screenshots/GuestModeOn.png b/packages/occupancy/screenshots/GuestModeOn.png
deleted file mode 100644
index 4b92992..0000000
Binary files a/packages/occupancy/screenshots/GuestModeOn.png and /dev/null differ
diff --git a/packages/occupancy/screenshots/GuestModeOnExpanded.png b/packages/occupancy/screenshots/GuestModeOnExpanded.png
deleted file mode 100644
index 48fb32b..0000000
Binary files a/packages/occupancy/screenshots/GuestModeOnExpanded.png and /dev/null differ
diff --git a/packages/occupancy/screenshots/GuestModeOnFullyExpanded.png b/packages/occupancy/screenshots/GuestModeOnFullyExpanded.png
deleted file mode 100644
index 189c63e..0000000
Binary files a/packages/occupancy/screenshots/GuestModeOnFullyExpanded.png and /dev/null differ
diff --git a/packages/occupancy/screenshots/GuestModeOnTwoSchedulesFullyExpanded.png b/packages/occupancy/screenshots/GuestModeOnTwoSchedulesFullyExpanded.png
deleted file mode 100644
index 359b42c..0000000
Binary files a/packages/occupancy/screenshots/GuestModeOnTwoSchedulesFullyExpanded.png and /dev/null differ
diff --git a/packages/occupancy/screenshots/GuestModePopup.png b/packages/occupancy/screenshots/GuestModePopup.png
deleted file mode 100644
index 6bba40b..0000000
Binary files a/packages/occupancy/screenshots/GuestModePopup.png and /dev/null differ