kloggy / HA-Irrigation-Version2

230 stars 55 forks source link

Notification wrong #58

Closed Kejszijo closed 3 years ago

Kejszijo commented 3 years ago

Hi!

I get wrong notification. I scheduled the first cycle at morning, but I notification from the second cycle name and time.

First cycle settings: image

Second cycle settings: image

Notification: pushover

My config: garden_notifications.zip

kloggy commented 3 years ago

I haven't used the notifications since I wrote version 2 and as far as I know little or nothing has changed since then.

In order to troubleshoot this I suggest you add a couple of lines to your garden_notifications.yaml as follows:

          message: >
            {% if trigger.entity_id == 'input_boolean.cycle1_running' %}
              {% set cycle = 'cycle1' %}
            {% else %}
              {% set cycle = 'cycle2' %}
            {% endif %}

            {% set cycle_name = states('input_text.irrigation_' ~ cycle ~ '_name') %}

            {% if trigger.to_state.state == 'on' %}
              Trigger: {{ trigger.entity_id }}

              A {{ cycle_name }} öntözési ciklus elindult.

              A teljes öntözési idő kb. {{ (states('sensor.irrigation_' ~ cycle ~ '_duration_in_seconds') | int / 60) | int }} perc, de ha végzett, akkor jelezni fogom.
            {% else %}
              A {{ cycle_name }} öntözési ciklus véget ért.
            {% endif %}
Kejszijo commented 3 years ago

Hi,

Thanks. The trigger is input_boolean.irrigation_cycle1_running

I found a problem, this line is wrong: {% if trigger.entity_id == 'input_boolean.cycle1_running' %}

The correct is: {% if trigger.entity_id == 'input_boolean.irrigation_cycle1_running' %}