kloggy / HA-Irrigation-Version2

230 stars 55 forks source link

Irrigation doesn't start HA 2021.11 #64

Closed morenonew2 closed 2 years ago

morenonew2 commented 3 years ago

Logger: homeassistant.helpers.template Source: helpers/template.py:1254 First occurred: 10:39:37 (39 occurrences) Last logged: 10:48:13

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 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.

{{ 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.

{{ 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 Template warning: 'float' got invalid input 'unknown' when rendering template '{{ states('sensor.irrigation_sensor_forecast_high_temp') | float > states('input_number.irrigation_temperature_highest_forecast_high_temp_today') | float }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1 Template warning: 'float' got invalid input 'unknown' when rendering template '{{ states('sensor.irrigation_sensor_current_temp') | float > states('input_number.irrigation_temperature_highest_actual_temp_today') | float }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1 Template warning: 'float' got invalid input 'unknown' when rendering template '{% set rain_0 = states('sensor.irrigation_sensor_rainfall_today') | float %} {% set rain_1 = states('sensor.irrigation_sensor_rainfall_yesterday') | float %} {% set rain_2 = states('input_number.irrigation_rainfall_2') | float%} {% set rain_3 = states('input_number.irrigation_rainfall_3') | float%} {% set rain_4 = states('input_number.irrigation_rainfall_4') | float%} {% set percent_1 = states('input_number.irrigation_rainfall_percentage_1') | float / 100 %} {% set percent_2 = states('input_number.irrigation_rainfall_percentage_2') | float / 100 %} {% set percent_3 = states('input_number.irrigation_rainfall_percentage_3') | float / 100 %} {% set percent_4 = states('input_number.irrigation_rainfall_percentage_4') | float / 100 %} {% set rain_1 = rain_1 percent_1 %} {% set rain_2 = rain_2 percent_2 %} {% set rain_3 = rain_3 percent_3 %} {% set rain_4 = rain_4 percent_4 %} {% set days_used = states('input_number.irrigation_days_of_rainfall_history_used') | int %} {% set threshold = states('input_number.irrigation_rainfall_threshold') | int %} {% set rain_total = rain_0 %} {% if days_used >= 1 %} {% set rain_total = rain_total + rain_1 %} {% endif %} {% if days_used >= 2 %} {% set rain_total = rain_total + rain_2 %} {% endif %} {% if days_used >= 3 %} {% set rain_total = rain_total + rain_3 %} {% endif %} {% if days_used >= 4 %} {% set rain_total = rain_total + rain_4 %} {% endif %} {% set multiplier = (1 - (rain_total / threshold)) | round(2) %} {% if multiplier <= 0 %} {% set multiplier = 0 %} {% endif %} {% if rain_total >= threshold %} 0 {% else %} {{ multiplier }} {% endif %}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1

Automations doesn't work Only manual work

This issue start with new templating with 2021.11

kloggy commented 3 years ago

I don't think the irrigation not starting is related to the warnings you are getting. I haven't upgraded to 2021.11 yet but...

  1. To stop those warnings. You should be able to change all the occurrences of float to int for binary_sensor.irrigation_cycle_start_clash in irrigation_globals.yaml
  2. For irrigation not starting I will look into if it is related to the upgrade in the next few days after I have installed it.

EDIT: Looking again at your post, I am not sure what I wrote is entirely correct. It looks like you might have something else going on with a sensor state of 'unknown' being converted to an integer. I'm afraid there is not much I can do until I upgrade to see how it affects me.

The recent addition of some functions requiring a default value may have caused some issues. (I am not using the system at the moment as it is winter here).

kloggy commented 3 years ago

I have upgraded to 2011.11 and my schedule seemed to work. I ran it in test mode with switches deactivated as it is Winter here and I didn't want to actually run it.

I have uploaded some new files today. Perhaps you could try those?

kloggy commented 2 years ago

Closing as I am assuming this is fixed.