something doesn’t work for me
It no longer shows me the sum of all input_number.
It just shows me the time of the active zones.
I need the sum of the time of all input_numbers regardless of whether the switches are on or not.
The watering takes place one after the other with a small time delay of 2 seconds
Taras helped me very well back then
but the whole thing somehow doesn’t work anymore.
What am I doing wrong?
Thanks.
group:
zone_gesamt:
name: Zonen gesamt
entities:
- switch.zone_1
- switch.zone_2
- switch.zone_3
- switch.zone_4
- switch.zone_5
- switch.zone_6
- switch.zone_7
- switch.zone_8
- switch.zone_9
input_number:
zone_1_run_time:
name: Einfahrt
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_2_run_time:
name: Eingang
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_3_run_time:
name: Streifen Haus
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_4_run_time:
name: Streifen Nachbar
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_5_run_time:
name: Terasse
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_6_run_time:
name: Mauer
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_7_run_time:
name: Grieche
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_8_run_time:
name: Garage
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
zone_9_run_time:
name: Hecke
min: 0
max: 45
step: 1
unit_of_measurement: min
icon: mdi:clock-start
sensor:
- platform: template
sensors:
zone_gesamt_time_remaining:
value_template: >
{% set update = states('sensor.time') %}
{% set ns = namespace(values=[]) %}
{% for i in expand('group.zone_gesamt') | selectattr('state', 'eq', 'on') | list %}
{% set t = [ (states('input_number.'~i.object_id~'_run_time')|int -
(now().timestamp() - i.last_changed.timestamp())/60) | round(0), 0 ] | max %}
{% set ns.values = ns.values + [ t ] %}
{% endfor %}
{% set t = ns.values | sum %}
{{ '{}h {}min'.format(t//60, t%60) }}
That’s not the same template as the one in the second version posted in the other topic. Everything you need has already been created and given to you. Here is again, copied from the other topic:
zone_wir_time_total:
value_template: >
{% set update = states('sensor.time') %}
{% set ns = namespace(values=[]) %}
{% for i in expand('group.sprinkler_zones') | list %}
{% set ns.values = ns.values + [ states('input_number.'~i.object_id~'_run_time')|int ] %}
{% endfor %}
{{ ns.values | sum }}
unit_of_measurement: "min"
Hi Taras,
I was too hasty.
The template doesn’t work quite right.
The total remaining time of the input_numbers shows me.
The problem is when a zone is finished, the time jumps back again.
It doesn’t count down all zones.
Only one zone at a time.
For example see below.
Zone Einfahrt and Eingang set for 1 minute each.
Total 2 minutes.
When the Einfahrtzone is off, starts the Eingan zone.
In between, of course, with a delay of 3 seconds.
And there we have the problem.
The time jumps back to 2 minutes.
I no longer understand what you want because it seems like the requirements keep changing. Perhaps someone else will understand it better than me and can help you or maybe you will solve it yourself. Good luck.