Pool auto filtration based on temperature

Nothing append in the abacus mode. the duration change a little but i have this error and the pump is always in action…

Enregistreur: homeassistant.helpers.event
Source: helpers/template.py:575
S'est produit pour la première fois: 17:32:35 (2 occurrences)
Dernier enregistrement: 17:32:35

Error while processing template: Template<template=(| | | |---|---:| | **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* | | **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours | {% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}) renders=194>
Error while processing template: Template<template=(| | | |---|---:| | **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* | | **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours | {% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}) renders=198>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1863, in forgiving_as_timestamp
    return dt_util.as_timestamp(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/dt.py", line 132, in as_timestamp
    raise ValueError("not a valid date/time.")
ValueError: not a valid date/time.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 573, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 3, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1866, in forgiving_as_timestamp
    raise_no_default("as_timestamp", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1668, in raise_no_default
    raise ValueError(
ValueError: Template error: as_timestamp got invalid input 'None' when rendering template '|   |    |
|---|---:|
| **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* |
| **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours  |
{% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 699, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 575, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: as_timestamp got invalid input 'None' when rendering template '|   |    |
|---|---:|
| **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* |
| **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours  |
{% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}' but no default was specified

Tu as bien fait cette étape ?

replace switch.tz3000_pompe_piscine by your switch in pool.yaml

replace sensor.pool_water_temp_kalman by your water temperature sensor in pool.yaml and lovelace-card.yaml

i try differently
I have no error in lovelace car
But always errors in journal

Enregistreur: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:199
intégration: Template (documentation, problèmes)
S'est produit pour la première fois: 18:34:01 (1 occurrences)
Dernier enregistrement: 18:34:01

TemplateError('ValueError: Template error: as_timestamp got invalid input 'None' when rendering template '{{ (( now().timestamp() - as_timestamp(state_attr('automation.pool_filtration_cycle_start','last_triggered')) ) / 3600 ) | round(2) }}' but no default was specified') while processing template 'Template<template=({{ (( now().timestamp() - as_timestamp(state_attr('automation.pool_filtration_cycle_start','last_triggered')) ) / 3600 ) | round(2) }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.last_autostart_triggered_since'

and

Enregistreur: homeassistant.helpers.event
Source: helpers/template.py:575
S'est produit pour la première fois: 18:33:22 (6 occurrences)
Dernier enregistrement: 18:34:09

Error while processing template: Template<template=(| | | |---|---:| | **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* | | **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours | {% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}) renders=22>
Error while processing template: Template<template=({{ (( now().timestamp() - as_timestamp(state_attr('automation.pool_filtration_cycle_start','last_triggered')) ) / 3600 ) | round(2) }}) renders=2>
Error while processing template: Template<template=(| | | |---|---:| | **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* | | **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours | {% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}) renders=26>
Error while processing template: Template<template=(| | | |---|---:| | **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* | | **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours | {% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}) renders=30>
Error while processing template: Template<template=(| | | |---|---:| | **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* | | **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours | {% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}) renders=34>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1863, in forgiving_as_timestamp
    return dt_util.as_timestamp(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/dt.py", line 132, in as_timestamp
    raise ValueError("not a valid date/time.")
ValueError: not a valid date/time.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 573, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 3, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1866, in forgiving_as_timestamp
    raise_no_default("as_timestamp", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1668, in raise_no_default
    raise ValueError(
ValueError: Template error: as_timestamp got invalid input 'None' when rendering template '|   |    |
|---|---:|
| **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* |
| **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours  |
{% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 699, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 575, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: as_timestamp got invalid input 'None' when rendering template '|   |    |
|---|---:|
| **Last auto filtration started at** : &nbsp;&nbsp;&nbsp;&nbsp;| *{{ as_timestamp(state_attr('automation.pool_filtration_cycle_start', 'last_triggered'))|timestamp_custom('%a, %B %-d, %H:%M', True) }}* |
| **filtration ran today**:| *{{states('sensor.pompe_piscine_on_today') }}* hours  |
{% if is_state("switch.smartswitch_02_l3", "on") -%} | **Auto filtration will stop at**: | *{{(as_timestamp(now()+ timedelta( hours = states('sensor.auto_cycle_duration_abacus')|float(1) - states('sensor.pompe_piscine_on_today')|float(1)|float(1))))| timestamp_custom("%H:%M:%S")}}* | {%- else -%} | **Auto filtration will stop at**: |N/A| {%- endif %}' but no default was specified

I try tomorrow now with this configuration

Thank’s for the help

maybe try to trigger the failing automation manually

Hello.
It seems to work today. Without error message
Thanks

Bonjour.
Petite question après avoir noté que nous sommes plusieurs à avoir le problème.
1- pour la plupart nous utilisons des modules sans fil pour déclencher la pompe (dans mon cas un sonoff)
2- lorsqu’il s’agit de wifi (c’est mon cas), nous ne disposons pas de retour d’état.
3- plus problématique, lorsqu’il s’agit d’un local piscine, celui-ci peut être un peu éloigné et les conditions météo peuvent rapidement avoir un impact.
4- du coup, parfois l’ordre peut être envoyé par HA, mais s’il est envoyé à un moment où il y a un problème (momentané) de connexion (comme un ping qui se perd), l’ordre est perdu. Et la pompe continue de tourner.

Du coup, je cherche un moyen de faire en sorte que l’application de l’ordre envoyé soit vérifié à un intervalle régulier (vérification de conformité de l’état du switch) et que le cas échéant il soit ré-expédié si l’état n’est pas satisfaisant.
Si une âme charitable a une idée :wink:

Merci !

Hello
J ai redemarré mon HA cet apres midi
Du coup la filtration qui devait s’arreter à 17 est toujours en marche à 21h
Bizarre non?
Je suis en mode manuel / Automatique
debut 9 h du matin pour 8 heures de filtration

Merci pour le coup de main…

Sinon ca marche impec

the automation that stop the filtraiton is based on a history_stats template sensor, so it “survives” a reboot.
i tried to reproduce your problem , but i can’t , the automation works on my side .
did you tried navigate to automation.pool_manual_filtration_cycle_stop and run it manually to be sure the action on your switch works ?

Hello,
Il y a quelques temps, je voulais fair ele systeme en suivant les heures creuses(voir un peu plus haut)
Je n’ai toujours pas eu le temps…
Par contre provisoirement, j’ai crée une automatisation pour faire fonctionner l’apres midi pendant 2h.
Pourrais tu m’indiquer dans ton code où je peux deduire ses 2h du temps total de filtration en mode abacus?

Bonjour,

en période d’hivernage, j’aurais aimé avoir une position stop (à l’image de standard, normal ou abacus)

Merci

i use a active wintering, so i don’t need this, but you can set to manual with duration at 0

1 Like