kloggy / HA-Irrigation-Version2

221 stars 55 forks source link

Templates will fail from 2022.1 #65

Closed drthanwho closed 2 years ago

drthanwho commented 2 years ago

From 2021.12 warnings will be logged for templates that don't have a default value specified. And after the grace period they will fail to load completely.

021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %}
{% if is_state('input_boolean.irrigation_cycle1_schedule_enabled', 'on') and
      is_state('input_boolean.irrigation_cycle2_schedule_enabled', 'on') %}
  {% if (c1_start - c2_start) | abs <= 60 %}
    true
  {% elif c1_start < c2_start and
          c1_end > (c2_start - 60) %}
    true
  {% elif c2_start < c1_start and
          c2_end > (c1_start - 60) %}
    true
  {% else %}
    false
  {% endif %}
{% else %}
  false
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2021-11-11 23:47:51 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% set c1_start = states('sensor.irrigation_cycle1_start_time_in_seconds') | int %} {% set c1_duration = states('sensor.irrigation_cycle1_duration_in_seconds') | int %} {% set c1_end = c1_start + c1_duration %} {% set c2_start = states('sensor.irrigation_cycle2_start_time_in_seconds') | int %} {% set c2_duration = states('sensor.irrigation_cycle2_duration_in_seconds') | int %} {% set c2_end = c2_start + c2_duration %} {% set c1_name = states('input_text.irrigation_cycle1_name') %} {% set c2_name = states('input_text.irrigation_cycle2_name') %}
{# NOTE that a 1 minute gap between cycles is required #} {% if (c1_start - c2_start) | abs <= 60 %}
  You have set {{ c1_name }} to start at the same time as {{ c2_name }}.
{% elif c1_start < c2_start and
        c1_end > (c2_start - 60) %}
  You have set {{ c2_name }} to start before {{ c1_name }} has ended.<br><br>{{ c2_name }} will not run.
{% elif c2_start < c1_start and
        c2_end > (c1_start - 60) %}
  You have set {{ c1_name }} to start before {{ c2_name }} has ended.<br><br>{{ c1_name }} will not run.
{% else %}
  No timing errors found! Please check code...
{% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
kloggy commented 2 years ago

The latest files which I uploaded a couple of days ago address this issue.