My Garden Irrigation

Can you post your sensor.night_or_day

I have no idea why I didn’t make this a binary_sensor (it was a long time ago :wink:)

  #=========================================
  # Night or Day - used primarily in graphs
  #=========================================
  - platform: template
    sensors:
      night_or_day:
        friendly_name: 'Night or Day'
        icon_template: mdi:power-sleep
        value_template: >
          {% if is_state('sun.sun', 'above_horizon') %}
            0
          {% else %}
            1
          {% endif %}

I actually upgraded to the very latest of everything including all the integrations on HACS and my stuff is pretty much working without any issues. One thing i haven’t yet pursued is integrating with the weather sensors to adjust for rainfall etc.

Manually irrigating works as well as the scheduling on either a certain day of the week which is really all i wanted.

I’m over the moon :slight_smile:

1 Like

Hello @klogg . Thanks for updating the packages. Now works with Browser Mod 2.0. Your packages is really helpful! You can add (or give the possibility to add them from the interface) cycles?. Now it is possible to have only 2 cycles and they are few. Thanks again

Hi,

I’m having problem with the pop-up not working.

This my versions:
HA-Irrigation-Version2: November 2022 update
browser_mod: 2.1.3
Home Assistant 2022.11.4
Supervisor 2022.11.2
Operating System 9.3
Frontend 20221108.0 - latest

Do you know if there is some problem or it should work with these versions?
Thanks!

Have you tried this below as it worked for me…

Yes. It doesn’t work for me :frowning:

@antonypar Have you added the browser mod as part of your integrations? I found this to be the main source of the issue i had.

image
Settings → Devices & Services → Integrations.

If browser_mod isn’t in your list, try adding the integration

Great! This solve the issue. :smiley: :smiley:
Really, I had to remove the add-on trough HACS, reinstall it and then add it as Integration.

Hi Klogg, congrats on a great job, works great. I would need to activate the valves at different times on the same day and not all in succession, is it possible to create a task to which the start times can be added? for me it would be perfect! thanks

Hi, did you manage to solve this error?
If yes, how did you do it?
Thanks!

I get this warning constantly repeating in my logs, any ideas how to fix this?

2023-01-17 13:51:00.003 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'jinja2.utils.Namespace object' has no attribute 'cycle1_runs_today' when rendering '{% if is_state('input_boolean.irrigation_master_control_switch', 'off') %}
  SYSTEM IS OFF
{% else %}
  {% set day_today = as_timestamp(now()) | timestamp_custom('%a') | lower %}
  {% set day_tomorrow = as_timestamp(now() + timedelta(days=1)) | timestamp_custom('%a') | lower %}
  {% set number_of_zones = states('input_number.irrigation_number_of_zones') | int %}
  {% set ns = namespace() %}
  {% for zone in range(number_of_zones) %}
    {% set cycle1_zone_duration = states('input_number.irrigation_cycle1_zone' ~ (zone + 1) ~ '_duration') %}
    {% set cycle1_zone_runs_every_day = states('input_boolean.irrigation_cycle1_zone' ~ (zone + 1) ~ '_every_day') %} 
    {% set cycle1_zone_runs_today = states('input_boolean.irrigation_cycle1_zone' ~ (zone + 1) ~ '_' ~ day_today) %}
    {% set cycle1_zone_runs_tomorrow = states('input_boolean.irrigation_cycle1_zone' ~ (zone + 1) ~ '_' ~ day_tomorrow) %}
    {% set cycle2_zone_duration = states('input_number.irrigation_cycle2_zone' ~ (zone + 1) ~ '_duration') %}
    {% set cycle2_zone_runs_every_day = states('input_boolean.irrigation_cycle2_zone' ~ (zone + 1) ~ '_every_day') %} 
    {% set cycle2_zone_runs_today = states('input_boolean.irrigation_cycle2_zone' ~ (zone + 1) ~ '_' ~ day_today) %}
    {% set cycle2_zone_runs_tomorrow = states('input_boolean.irrigation_cycle2_zone' ~ (zone + 1) ~ '_' ~ day_tomorrow) %}
    {% if cycle1_zone_duration != '0.0'  and
          (cycle1_zone_runs_every_day == 'on' or 
          cycle1_zone_runs_today == 'on') %}
      {% set ns.cycle1_runs_today = true %}
    {% endif %}
    {% if cycle2_zone_duration != '0.0'  and
          (cycle2_zone_runs_every_day == 'on' or 
          cycle2_zone_runs_today == 'on') %}
      {% set ns.cycle2_runs_today = true %}
    {% endif %}
    {% if cycle1_zone_duration != '0.0'  and
          (cycle1_zone_runs_every_day == 'on' or 
          cycle1_zone_runs_tomorrow == 'on') %}
      {% set ns.cycle1_runs_tomorrow = true %}
    {% endif %}
    {% if cycle2_zone_duration != '0.0'  and
          (cycle2_zone_runs_every_day == 'on' or 
          cycle2_zone_runs_tomorrow == 'on') %}
      {% set ns.cycle2_runs_tomorrow = true %}
    {% endif %}
  {% endfor %}
  {% set time_now = states('sensor.time') %}
  {% set cycle1_schedule_enabled = states('input_boolean.irrigation_cycle1_schedule_enabled') %}
  {% set cycle2_schedule_enabled = states('input_boolean.irrigation_cycle2_schedule_enabled') %}
  {% set cycle1_start_time = states('input_datetime.irrigation_cycle1_start_time')[0:5] %}
  {% set cycle2_start_time = states('input_datetime.irrigation_cycle2_start_time')[0:5] %}
  {% set cycle1_name = states('input_text.irrigation_cycle1_name') %}
  {% set cycle2_name = states('input_text.irrigation_cycle2_name') %}
  {% set cycle3_name = states('input_text.irrigation_cycle3_name') %}
  {% set cycle1_running = states('input_boolean.irrigation_cycle1_running') %}
  {% set cycle2_running = states('input_boolean.irrigation_cycle2_running') %}
  {% set cycle3_running = states('input_boolean.irrigation_cycle3_running') %}
  {% if cycle1_running == 'on' %}
    {{ cycle1_name ~ ' cycle' }}
  {% elif cycle2_running == 'on' %}
    {{ cycle2_name ~ ' cycle' }}
  {% elif cycle3_running == 'on' %}
    {{ cycle3_name ~ ' cycle' }}
  {% elif cycle1_schedule_enabled == 'on' and
          ns.cycle1_runs_today and
          cycle1_start_time > time_now %}
    {{ cycle1_name + ' cycle at ' + cycle1_start_time }}
  {% elif cycle2_schedule_enabled == 'on' and
          ns.cycle2_runs_today and
          cycle2_start_time > time_now %}
    {{ cycle2_name + ' cycle at ' + cycle2_start_time }}
  {% elif cycle1_schedule_enabled == 'on' and
          ns.cycle1_runs_tomorrow %}
    {{ 'Tomorrow at ' + cycle1_start_time }}
  {% elif cycle2_schedule_enabled == 'on' and
          ns.cycle2_runs_tomorrow %}
    {{ 'Tomorrow at ' + cycle2_start_time }}
  {% else %}
    NO SCHEDULE TODAY OR TOMORROW
  {% endif %}
{% endif %}'

I haven’t been able to recreate this but can you try changing line 173 in

irrigation_globals.yaml

FROM:

            {% set ns = namespace() %}

TO:

            {% set ns = namespace(cycle1_runs_today = false,
                                  cycle1_runs_tomorrow = false,
                                  cycle2_runs_today = false,
                                  cycle2_runs_tomorrow = false) %}

Thanks, that looks like it did the trick. :grinning:

The only other thing thats stopped working is history totals.

I’m not using the system at the moment, it’s -1 degC today :wink:

Do you mean they don’t work at all or that they give decimal values rather than sensible time values?

If the latter then see this post

They dont work at all. I looked at the code and it doesnt monitor the zone switch names that are set in the input_text, they are hard coded not like in the past. So i changed them to the correct names of my switches then they work but as a decimal, as you said. I then made a template sensor to get them back into a human readable time. Don’t think its the best solution as it requires on you going into code and hard coding the zone switches. I was trying to come up with a solution / fix but i’m running out of ideas.

P.S its not the total that have the issue its the individual zone time for today and yesterday.

like this
image

I haven’t looked at this code for a long time but history_stats sensors are a bit problematic in that nothing can be be templated except start and end so yes, they follow the underlying switch name unfortunately.

I’m afraid that is the best solution as far as I can tell. I was also going to create some templated sensors to give a human readable time but I kept hearing whispers that the whole history sensor integration as earmarked for an overhaul so I left it as it is was.

Hi @klogg .
Do you think you will ever insert a few more cycles? 2 They are very few. I am very satisfied with your package it is a pity that you don’t have more time to increase the functions. Thanks for everything!

To be honest, I’m afraid not.
The selfish answer is that I don’t need more. To be honest it already has a lot more functionality than I need or use.

The more balanced answer is that I think it might take quite a bit of work to do so because of the way it was written. I never, ever, considered more than 2 cycles plus a manual one would be used.

The hopeful answer is that the code is now a few years old and much has changed with HA. It is possible that I could rewrite the whole thing much like I did when version 1 was showing it’s age.

Don’t hold me to that, there is absolutely no guarantee that I will, but it is possible… assuming I can find the time!!

I have an issue with lovelace and Irrigation integration. My HA is the last versions.

The integration frontend does not work, because the link to the card are used variable.

This is test:

I have in my lovelace.yaml

  - !include
     pump.yaml
     entity: automation.outside_pump_master_control_switch

The pump.yaml has this:

type: entities
entities:
    - {{ entity }}

The error mesage:

mapping values are not allowed here in “lovelace.yaml”, line 16, column 13

Line 16 is this: entity: automation.outside_pump_master_control_switch

How to solve this? Thanks in advance!