it says in this post.
Thanks, looks like that weather service is specific to your area. Seems ones I use donāt have any rainfall data. I will have to see how the moisture sensors work. IDK how Iād do it because they are BLE. Might have issues with distance.
Try this. Then you can use weather.home https://www.home-assistant.io/integrations/met
I live in USA and use this.
Does this do rain accumulation based on local data? Iām just curious of how the data is interpreted.
Thanks!
I know you can make a sensor to reset every so often, I dont think it stores anything, just shows future.
For future reference, when the breaking change (deprecation of entity_id
) is implemented in the Template integration, here is a version of your Template Binary Sensor that should be compatible.
First, you will need to define a group containing the input_booleans representing the weekdays:
group:
zone_1_weekdays:
name: Zone 1 Weekdays
entities:
- input_boolean.zone_1_mon
- input_boolean.zone_1_tue
- input_boolean.zone_1_wed
- input_boolean.zone_1_thu
- input_boolean.zone_1_fri
- input_boolean.zone_1_sat
- input_boolean.zone_1_sun
The following template expands that group and also employs sensor.date
.
binary_sensor:
- platform: template
sensors:
zone_1_day_active:
friendly_name: Irrigation Day Active
value_template: >-
{% set today = states.sensor.date.last_updated.timestamp()
| timestamp_custom('%a') | lower %}
{% set weekdays = expand('group.zone_1_weekdays')
| selectattr('state', 'eq', 'on')
| map(attribute='object_id')
| map('replace', 'zone_1_', '')
| list %}
{{ today in weekdays }}
How it works:
- It gets the current weekdayās abbreviation (mon, tue, wed, etc) from
sensor.date
and assigns it to a variable calledtoday
. - It expands the group, selects only the input_booleans that are
on
, gets theirobject_id
(i.e. āzone_1_thuā), discards the āzone_1_ā portion thereby only leaving the weekday abbreviation, and finally generates a list (like['tue', 'thu']
) and assigns it to the variableweekdays
. - The final line simply checks if the value of
today
is inweekdays
list and, if it is, returnstrue
(otherwise,false
).
Iām actually thinking of moving all my schedules over to the custom scheduler card which should simplify things a bit.
How would I convert this to inches? i know there is rain tomorrow.
sensor:
- platform: template
sensors:
predict_rain_today:
friendly_name: 'Predicted Rain Today'
entity_id:
- sensor.dark_sky_precip_probability_1d # always a single int
- sensor.dark_sky_daily_max_precip_intensity_1d # two formats. Single int or "int_1 to int_2" e.g. "3 to 4"
unit_of_measurement: in
value_template: >
{% set chance = states('sensor.dark_sky_precip_probability_1d')|int /100 %}
{% if 'to' in states('sensor.dark_sky_daily_max_precip_intensity_1d') %}
{% set amount = states('sensor.dark_sky_daily_max_precip_intensity_1d').split(' to ') %}
{% set amount1 = amount[0] | float %}
{% set amount2 = amount[1] | float %}
{% set amount_avg = (amount1 + amount2) / 2 %}
{% else %}
{% set amount_avg = states('sensor.dark_sky_daily_max_precip_intensity_1d') | int %}
{% endif %}
{{ (chance * amount_avg)|round(1) }}
Please format your pasted config.
Basically, if itās in mm, divide by 25.4 in the final amount template.
Awesome thread.
I would be nice if anyone could share rough estimates/suggestions for the values of min_moisture, max_moisture, and min_conductivity for a typical lawn.
Thanks in advance and kind regards!
Is this config still working. I keep getting an error in log - entity_id is deprecated (I think in template, it is).
I got everything to work except the automation.
Hey guys
Really awesome thread, Iāve spent quite a bit of time getting this setup and it seems with the end in sight Iāve stopped short of the finish line
I suspect it has something to do with the entity_id but donāt know how to fix it.
Iām getting the error āEntity not available: sensor.zone_1_time_remainingā and Iāve tried a few things but just cannot get that to come up for some reason. The automations are also not being activated and Iām not sure if its because of this sensor?
A nudge in the right direction would be greatly appreciated, my config files and screenshot below, thanks in advance.
binarysensors.yaml
- platform: template
sensors:
zone_1_day_active:
friendly_name: Irrigation Day Active
value_template: >-
{% set today = states.sensor.date.last_updated.timestamp()
| timestamp_custom('%a') | lower %}
{% set weekdays = expand('group.zone_1_weekdays')
| selectattr('state', 'eq', 'on')
| map(attribute='object_id')
| map('replace', 'zone_1_', '')
| list %}
{{ today in weekdays }}
- platform: template
sensors:
zone_1_time_remaining:
friendly_name: 'Time Remaining'
entity_id:
- input_number.zone_1_time_remaining
- sensor.time
- switch.irrigation_z1
value_template: "{{ [ (states('input_number.zone_1_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.irrigation_z1.last_changed)) / 60) | round(0) ,0 ] | max }}"
## unit_of_measurement: "min"
groups.yaml
zone_1_weekdays:
name: Zone 1 Weekdays
entities:
- input_boolean.zone_1_mon
- input_boolean.zone_1_tue
- input_boolean.zone_1_wed
- input_boolean.zone_1_thu
- input_boolean.zone_1_fri
- input_boolean.zone_1_sat
- input_boolean.zone_1_sun
automation.yaml
- id: '1608027082816'
alias: Irrigation Zone 1 AM
description: ''
trigger:
- platform: template
value_template: '"{{ states(''sensor.time'') == states(''input_datetime.zone_1_am_on_time'').rsplit('':'',1)[0]
}}"'
condition:
- condition: state
entity_id: binary_sensor.zone_1_day_active
state: 'on'
action:
- service: switch.turn_on
data: {}
entity_id: switch.irrigation_z1
- service: notify.mobile_app_paul_s9
data:
title: '*Information*'
message: Zone 1 sprinklers turned on (AM Schedule).
mode: single
- id: '1608028549476'
alias: Irrigation Zone 1 PM
description: ''
trigger:
- platform: template
value_template: '"{{ states(''sensor.time'') == states(''input_datetime.zone_1_pm_on_time'').rsplit('':'',1)[0]
}}"'
condition:
- condition: state
entity_id: binary_sensor.zone_1_day_active
state: 'on'
action:
- service: switch.turn_on
data: {}
entity_id: switch.irrigation_z1
- service: notify.mobile_app_paul_s9
data:
title: '*Information*'
message: Zone 1 sprinklers turned on (PM Schedule).
mode: single
Hi mate. Youāll have to scroll back a little to see how my interface and config are done. I set the zone_1_day_active
sensor as a binary sensor with the config below and the other as a non-binary sensor (to carry the changing minute value as it counts down). Noting the differences my working config is below for you. This is in a single package yaml file too.
binary_sensor:
- platform: template
sensors:
zone_1_day_active:
friendly_name: Irrigation Day Active
value_template: >-
{{ (is_state('input_boolean.zone_1_am_enable_schedule', 'on')
or is_state('input_boolean.zone_1_pm_enable_schedule', 'on'))
and (( is_state('input_boolean.zone_1_mon', 'on') and now().weekday() == 0 )
or ( is_state('input_boolean.zone_1_tue', 'on') and now().weekday() == 1 )
or ( is_state('input_boolean.zone_1_wed', 'on') and now().weekday() == 2 )
or ( is_state('input_boolean.zone_1_thu', 'on') and now().weekday() == 3 )
or ( is_state('input_boolean.zone_1_fri', 'on') and now().weekday() == 4 )
or ( is_state('input_boolean.zone_1_sat', 'on') and now().weekday() == 5 )
or ( is_state('input_boolean.zone_1_sun', 'on') and now().weekday() == 6 )) }}
sensor:
- platform: template
sensors:
zone_1_time_remaining:
friendly_name: 'Time Remaining'
#Check if the zone switch is on or off before providing the number
value_template: >
{% if is_state("switch.garden_sprinklers_zone_1", "off") %} 0
{% else %}
{% set countdown_timer = [ (states('input_number.zone_1_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.garden_sprinklers_zone_1.last_changed)) / 60) | round(0) ,0 ] | max %} {{ countdown_timer }}
{% endif %}
unit_of_measurement: "min"
Hello guys,
Super thread exactly that I need :).
I working to an irrigator for my backyard. In present I use home assistant with node-red and an Arduino mega with Ethernet shield W5100, 4 relayās and few sensors. My problem is then I want to change time or day I need to change in node-red in 4 places .
So I try to add more controls in dashboard.
I adapted code above in this trade but I have some errors and I really need your help
This is my config.yaml
default_config:
mqtt:
broker: core-mosquitto
username: home
password: homep
##############################
#################################################################
# #
# Packages/Garden Reticulation #
# #
#################################################################
#################################################################
# #
# This is a full reticulation control package using BOM #
# weather prediction to prevent watering if rain is expected, #
# or occured recently with local moisture sensor data as well #
# #
#################################################################
switch:
- platform:mqtt
name:"Garden Sprinklers Zone 1"
state_topic:"ha/zona/z1"
command_topic:"ha/zona/z1/set"
qos:1
payload_on:"ON"
payload_off:"OFF"
retain:false
- platform:mqtt
name:"Garden Sprinklers Zone 2"
state_topic:"ha/zona/z1"
command_topic:"ha/zona/z1/set"
qos:1
payload_on:"ON"
payload_off:"OFF"
retain:false
#################################################################
# #
# Zone 1 = Front Lawn Zone 2 = Side Garden #
# #
#################################################################
#################################################################
# #
# Is today a Sprinkler Day? #
# #
#################################################################
binary_sensor:
- platform: template
sensors:
zone_1_day_active:
friendly_name: Irrigation Day Active
entities:
- sensor.date
- input_boolestatisan.zone_1_am_enable_schedule
- input_boolean.zone_1_pm_enable_schedule
- input_boolean.zone_1_mon
- input_boolean.zone_1_tue
- input_boolean.zone_1_wed
- input_boolean.zone_1_thu
- input_boolean.zone_1_fri
- input_boolean.zone_1_sat
- input_boolean.zone_1_sun
value_template: >-
{{ (is_state('input_boolean.zone_1_am_enable_schedule', 'on')
or is_state('input_boolean.zone_1_pm_enable_schedule', 'on'))
and (( is_state('input_boolean.zone_1_mon', 'on') and now().weekday() == 0 )
or ( is_state('input_boolean.zone_1_tue', 'on') and now().weekday() == 1 )
or ( is_state('input_boolean.zone_1_wed', 'on') and now().weekday() == 2 )
or ( is_state('input_boolean.zone_1_thu', 'on') and now().weekday() == 3 )
or ( is_state('input_boolean.zone_1_fri', 'on') and now().weekday() == 4 )
or ( is_state('input_boolean.zone_1_sat', 'on') and now().weekday() == 5 )
or ( is_state('input_boolean.zone_1_sun', 'on') and now().weekday() == 6 )) }}
- platform: template
sensors:
zone_2_day_active:
friendly_name: Irrigation Day Active
entities:
- sensor.date
- input_boolean.zone_2_am_enable_schedule
- input_boolean.zone_2_pm_enable_schedule
- input_boolean.zone_2_mon
- input_boolean.zone_2_tue
- input_boolean.zone_2_wed
- input_sboolean.zone_2_thu
- input_boolean.zone_2_fri
- input_boolean.zone_2_sat
- input_boolean.zone_2_sun
value_template: >-
{{ (is_state('input_boolean.zone_2_am_enable_schedule', 'on')
or is_state('input_boolean.zone_2_pm_enable_schedule', 'on'))
and (( is_state('input_boolean.zone_2_mon', 'on') and now().weekday() == 0 )
or ( is_state('input_boolean.zone_2_tue', 'on') and now().weekday() == 1 )
or ( is_state('input_boolean.zone_2_wed', 'on') and now().weekday() == 2 )
or ( is_state('input_boolean.zone_2_thu', 'on') and now().weekday() == 3 )
or ( is_state('input_boolean.zone_2_fri', 'on') and now().weekday() == 4 )
or ( is_state('input_boolean.zone_2_sat', 'on') and now().weekday() == 5 )
or ( is_state('input_boolean.zone_2_sun', 'on') and now().weekday() == 6 )) }}
#################################################################
# #
# Countdown timer from when Sprinklers start #
# #
#################################################################
sensor:
# Used to pull a max_value from the statistics sensor
# Refer: https://www.home-assistant.io/integrations/statistics/
# The max_value is templated into a sensor. See 48hour_rain_figure below
- platform: template
sensors:
zone_1_time_remaining:
friendly_name: 'Time Remaining'
entities:
- input_number.zone_1_run_time
- sensor.time
- switch.garden_sprinklers_zone_1
#Check if the zone switch is on or off before providing the number
value_template: >
{% if is_state("switch.garden_sprinklers_zone_1", "off") %} 0
{% else %}
{% set countdown_timer = [ (states('input_number.zone_1_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.garden_sprinklers_zone_1.last_changed)) / 60) | round(0) ,0 ] | max %} {{ countdown_timer }}
{% endif %}
unit_of_measurement: "min"
zone_2_time_remaining:
friendly_name: 'Time Remaining'
entities:
- input_number.zone_2_run_time
- sensor.time
- switch.garden_sprinklers_zone_2
value_template: >
{% if is_state("switch.garden_sprinklers_zone_2", "off") %} 0
{% else %}
{% set countdown_timer = [ (states('input_number.zone_2_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.garden_sprinklers_zone_2.last_changed)) / 60) | round(0) ,0 ] | max %} {{ countdown_timer }}
{% endif %}
unit_of_measurement: "min"
#################################################################
# #
# Set Start/Finish Times #
# #
#################################################################
input_datetime:
zone_1_am_on_time:
name: AM On Time
has_date: false
has_time: true
zone_1_pm_on_time:
name: PM On Time
has_date: false
has_time: true
zone_2_am_on_time:
name: AM On Time
has_date: false
has_time: true
zone_2_pm_on_time:
name: PM On Time
has_date: false
has_time: true
#################################################################
# #
# Set the days you Water here #
# #
#################################################################
input_boolean:
# Zone 1 Days
zone_1_mon:
name: Monday
icon: mdi:calendar
zone_1_tue:
name: Tuesday
icon: mdi:calendar
zone_1_wed:
name: Wednesday
icon: mdi:calendar
zone_1_thu:
name: Thursday
icon: mdi:calendar
zone_1_fri:
name: Friday
icon: mdi:calendar
zone_1_sat:
name: Saturday
icon: mdi:calendar
zone_1_sun:
name: Sunday
icon: mdi:calendar
# Zone 1 Automation Switches
zone_1_am_enable_schedule:
name: Enable AM Schedule
icon: mdi:weather-sunny
zone_1_pm_enable_schedule:
name: Enable PM Schedule
icon: mdi:weather-sunset
# Zone 2 Days
zone_2_mon:
name: Monday
icon: mdi:calendar
zone_2_tue:
name: Tuesday
icon: mdi:calendar
zone_2_wed:
name: Wednesday
icon: mdi:calendar
zone_2_thu:
name: Thursday
icon: mdi:calendar
zone_2_fri:
name: Friday
icon: mdi:calendar
zone_2_sat:
name: Saturday
icon: mdi:calendar
zone_2_sun:
name: Sunday
icon: mdi:calendar
# Zone 2 Automation Switches
zone_2_am_enable_schedule:
name: Enable AM Schedule
icon: mdi:weather-sunny
zone_2_pm_enable_schedule:
name: Enable PM Schedule
icon: mdi:weather-sunset
#################################################################
# #
# Set the run-time for each Zone below #
# #
#################################################################
input_number:
zone_1_run_time:
name: Run Time
min: 5
max: 30
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_2_run_time:
name: Run Time
min: 1
max: 10
step: 1
unit_of_measurement: min
icon: mdi:clock
#################################
sensor rain:
- platform: mqtt
name: "rain.sensor"
state_topic: "ha/zona/rain"
# Text to speech
#custom-ui
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
Log errors:
Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:454
Integration: Hass.io (documentation, issues)
First occurred: 6:22:34 PM (4 occurrences)
Last logged: 6:31:04 PM
Invalid config for [sensor.template]: [entities] is an invalid option for [sensor.template]. Check: sensor.template->sensors->zone_1_time_remaining->entities. (See ?, line ?). Invalid config for [switch]: expected a dictionary. Got OrderedDict([('default_config', {}), ('mqtt', OrderedDict([('broker', 'core-mosquitto'), ('username', 'home'), ('password', 'homep'), ('will_message', {'topic': 'homeassistant/status', 'payload': 'offline', 'qos': 0, 'retain': False}), ('tls_version', 'auto'), ('port', 1883), ('birth_message', {'topic': 'homeassistant/status', 'payload': 'online', 'qos': 0, 'retain': False}), ('discovery', True), ('keepalive', 60), ('discovery_prefix', 'homeassistant'), ('protocol', '3.1.1')])), ('switch', ['.... (See /config/configuration.yaml, line 29). Invalid config for [switch]: expected a dictionary. Got OrderedDict([('default_config', {}), ('mqtt', OrderedDict([('broker', 'core-mosquitto'), ('username', 'home'), ('password', 'homep'), ('will_message', {'topic': 'homeassistant/status', 'payload': 'offline', 'qos': 0, 'retain': False}), ('tls_version', 'auto'), ('port', 1883), ('birth_message', {'topic': 'homeassistant/status', 'payload': 'online', 'qos': 0, 'retain': False}), ('discovery', True), ('keepalive', 60), ('discovery_prefix', 'homeassistant'), ('protocol', '3.1.1')])), ('switch', ['.... (See /config/configuration.yaml, line 29). Invalid config for [binary_sensor.template]: [entities] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->sensors->zone_1_day_active->entities. (See ?, line ?). Invalid config for [binary_sensor.template]: [entities] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->sensors->zone_2_day_active->entities. (See ?, line ?).
Invalid config for [sensor.template]: [entity] is an invalid option for [sensor.template]. Check: sensor.template->sensors->zone_1_time_remaining->entity. (See ?, line ?). Invalid config for [switch]: expected a dictionary. Got OrderedDict([('default_config', {}), ('mqtt', OrderedDict([('broker', 'core-mosquitto'), ('username', 'home'), ('password', 'homep'), ('will_message', {'topic': 'homeassistant/status', 'payload': 'offline', 'qos': 0, 'retain': False}), ('tls_version', 'auto'), ('port', 1883), ('birth_message', {'topic': 'homeassistant/status', 'payload': 'online', 'qos': 0, 'retain': False}), ('discovery', True), ('keepalive', 60), ('discovery_prefix', 'homeassistant'), ('protocol', '3.1.1')])), ('switch', ['.... (See /config/configuration.yaml, line 29). Invalid config for [switch]: expected a dictionary. Got OrderedDict([('default_config', {}), ('mqtt', OrderedDict([('broker', 'core-mosquitto'), ('username', 'home'), ('password', 'homep'), ('will_message', {'topic': 'homeassistant/status', 'payload': 'offline', 'qos': 0, 'retain': False}), ('tls_version', 'auto'), ('port', 1883), ('birth_message', {'topic': 'homeassistant/status', 'payload': 'online', 'qos': 0, 'retain': False}), ('discovery', True), ('keepalive', 60), ('discovery_prefix', 'homeassistant'), ('protocol', '3.1.1')])), ('switch', ['.... (See /config/configuration.yaml, line 29). Invalid config for [binary_sensor.template]: [entity] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->sensors->zone_1_day_active->entity. (See ?, line ?). Invalid config for [binary_sensor.template]: [entity] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->sensors->zone_2_day_active->entity. (See ?, line ?).
Invalid config for [sensor.template]: [entities] is an invalid option for [sensor.template]. Check: sensor.template->sensors->zone_1_time_remaining->entities. (See ?, line ?). Invalid config for [switch]: expected a dictionary. Got OrderedDict([('default_config', {}), ('mqtt', OrderedDict([('broker', 'core-mosquitto'), ('username', 'home'), ('password', 'homep'), ('will_message', {'topic': 'homeassistant/status', 'payload': 'offline', 'qos': 0, 'retain': False}), ('tls_version', 'auto'), ('port', 1883), ('birth_message', {'topic': 'homeassistant/status', 'payload': 'online', 'qos': 0, 'retain': False}), ('discovery', True), ('keepalive', 60), ('discovery_prefix', 'homeassistant'), ('protocol', '3.1.1')])), ('switch', ['.... (See /config/configuration.yaml, line 24). Invalid config for [switch]: expected a dictionary. Got OrderedDict([('default_config', {}), ('mqtt', OrderedDict([('broker', 'core-mosquitto'), ('username', 'home'), ('password', 'homep'), ('will_message', {'topic': 'homeassistant/status', 'payload': 'offline', 'qos': 0, 'retain': False}), ('tls_version', 'auto'), ('port', 1883), ('birth_message', {'topic': 'homeassistant/status', 'payload': 'online', 'qos': 0, 'retain': False}), ('discovery', True), ('keepalive', 60), ('discovery_prefix', 'homeassistant'), ('protocol', '3.1.1')])), ('switch', ['.... (See /config/configuration.yaml, line 24). Invalid config for [binary_sensor.template]: [entities] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->sensors->zone_1_day_active->entities. (See ?, line ?). Invalid config for [binary_sensor.template]: [entities] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->sensors->zone_2_day_active->entities. (See ?, line ?).
Thanks, for any advice.
Can anybody help in script? Iād like to make a script which:
- turns on the first switch of irrigation
- Waits until the remaining time goes to 0. "Or if it set 0 by default just contionue to the next step)
- Turns on the 2nd switch
etc.
My problem, I donāt know how to set the āwait until remaining time sensorā goes to 0 on the Script UI of HA.
How could you cumulate the running times of each zones into one remaining time value? Like in your screeshotās Back Yard 2nd row.
Hello,
for whole week iāve been trying to setup sprinker system based on this topic. Iāve managed to do only half and after searching for online solution left no choice, but to ask help here. Iām using the latest version of homeassistant. This is error i get in lowlace. Please guide me, what iām doing wrong? Iām not a developer and will not be able to write code.
This is my config for sensor:
- platform: template
sensors:
zone_1_time_remaining:
friendly_name: 'Time Remaining'
#Check if the zone switch is on or off before providing the number
value_template: >
{% if is_state("switch.laistymo_sistema", "off") %} 0
{% else %}
{% set countdown_timer = [ (states('input_number.zone_1_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.laistymo_sistema_zone_1.last_changed)) / 60) | round(0) ,0 ] | max %} {{ countdown_timer }}
{% endif %}
unit_of_measurement: "min"
and for binary_sensor:
- platform: template
sensors:
zone_1_day_active:
friendly_name: Irrigation Day Active
value_template: >-
{{ (is_state('input_boolean.zone_1_am_enable_schedule', 'on')
or is_state('input_boolean.zone_1_pm_enable_schedule', 'on'))
and (( is_state('input_boolean.zone_1_mon', 'on') and now().weekday() == 0 )
or ( is_state('input_boolean.zone_1_tue', 'on') and now().weekday() == 1 )
or ( is_state('input_boolean.zone_1_wed', 'on') and now().weekday() == 2 )
or ( is_state('input_boolean.zone_1_thu', 'on') and now().weekday() == 3 )
or ( is_state('input_boolean.zone_1_fri', 'on') and now().weekday() == 4 )
or ( is_state('input_boolean.zone_1_sat', 'on') and now().weekday() == 5 )
or ( is_state('input_boolean.zone_1_sun', 'on') and now().weekday() == 6 )) }}
did you create all the input in the Helper menu ?
I did not notice any mention of Helper menu. What is it?