Kabala
(Cata)
October 4, 2020, 3:54pm
1
I have an irrigation and I want to show how much time is left until the stop.
my configuration as it is unfortunately does not work.
no sensor is shown.
What am I doing wrong?
rainbird:
- host: ###########
password: ##########
trigger_time: 0:40
zones:
1:
friendly_name: zone_1
sensor:
- platform: template
sensors:
zone_1_time_remaining:
friendly_name: 'Time Remaining'
entity_id:
- input_number.zone_1_time_remaining
- sensor.time
- switch.zone_1
value_template: >
{% if is_state('switch.zone_1', 'on') %}
{{ [ (states('input_number.zone_1_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_1.last_changed))/60)|round(0) ,0 ] | max }}
{% else %}
0
{% endif %}
unit_of_measurement: "min"
input_number:
zone_1_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
tom_l
October 4, 2020, 4:17pm
2
That looks familiar.
If you are running v0.115 this no longer works , remove it:
entity_id:
- input_number.zone_1_time_remaining
- sensor.time
- switch.zone_1
and adjust your template to:
value_template: >
{% set update = states('sensor.time') %}
{% if is_state('switch.zone_1', 'on') %}
{{ [ (states('input_number.zone_1_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_1.last_changed))/60)|round(0) ,0 ] | max }}
{% else %}
0
{% endif %}
If you are running 0.114 or earlier make sure you actually have a sensor.time
.
Kabala
(Cata)
October 4, 2020, 4:31pm
3
Thanks again,
will try in a moment
How can I display time remainig from a group of zones?
Thanks again,
will try in a moment
How can I display time remainig from a group of zones?
for example:
group:
zone_wir:
name: Zonen wir
entities:
- switch.zone_5
- switch.zone_6
- switch.zone_7
- switch.zone_8
- switch.zone_9
zone_schwiegereltern:
name: Zonen schwiegereltern
entities:
- switch.zone_1
- switch.zone_2
- switch.zone_3
- switch.zone_4
input_number:
zone_1_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_2_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_3_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_4_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_5_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_6_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_7_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_8_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
zone_9_run_time:
name: Run Time
min: 0
max: 90
step: 5
unit_of_measurement: min
icon: mdi:clock
tom_l
October 4, 2020, 4:36pm
4
It’s going to be the same as for any one of the switches in that zone, so use the same template.
Kabala
(Cata)
October 4, 2020, 5:12pm
5
your suggestion did not help.
I currently have home assistant v0.115
entity_id: I removed it, there is no sensor with zone_1_time_remaining
sensor:
- platform: template
sensors:
zone_1_time_remaining:
friendly_name: 'Time Remaining'
value_template: >
{% set update = states('sensor.time') %}
{% if is_state('switch.zone_1', 'on') %}
{{ [ (states('input_number.zone_1_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_1.last_changed))/60)|round(0) ,0 ] | max }}
{% else %}
0
{% endif %}
unit_of_measurement: "min"
zone_2_time_remaining:
friendly_name: 'Time Remaining'
value_template: >
{% set update = states('sensor.time') %}
{% if is_state('switch.zone_2', 'on') %}
{{ [ (states('input_number.zone_2_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_2.last_changed))/60)|round(0) ,0 ] | max }}
{% else %}
0
{% endif %}
unit_of_measurement: "min"
Kabala
(Cata)
October 5, 2020, 6:46am
9
Hi everyone,
How can I get total time from input number?
automation:
- id: 'start zone wir'
alias: start zone wir
description: ''
trigger:
- platform: state
entity_id: input_boolean.zone_wir
to: 'on'
condition: []
action:
- service: script.sprinkler_zone_wir
data: {}
mode: single
- id: 'stop zone wir'
alias: stop zone wir
description: ''
trigger:
- platform: state
entity_id: input_boolean.zone_wir
to: 'off'
condition: []
action:
- service: switch.turn_off
data: {}
entity_id: switch.zone_5
- service: switch.turn_off
data: {}
entity_id: switch.zone_6
- service: switch.turn_off
data: {}
entity_id: switch.zone_7
- service: switch.turn_off
data: {}
entity_id: switch.zone_8
- service: switch.turn_off
data: {}
entity_id: switch.zone_9
mode: single
tom_l
October 5, 2020, 7:07am
10
Use a template sensor with a value template that add up all the input numbers.
value_template: "{{ states('input_number.zone_1_run_time')|int + states('input_number.zone_2_run_time')|int + states('input_number.zone_3_run_time')|int + ... states('input_number.zone_9_run_time')|int }}"
Where I have written ...
keep adding your input numbers.
Kabala
(Cata)
October 5, 2020, 8:41am
11
it worked
great thank you.
Kabala
(Cata)
October 5, 2020, 10:21am
12
hi, i don’t get the hang of how to integrate the switch group.
Can you give me an example
For one switch it is clear to me, but not for several.
tom_l
October 5, 2020, 10:23am
13
As I said before, every member of the group is going to have the same time remaining. So just use any member of the group.
Kabala
(Cata)
October 5, 2020, 12:51pm
14
how do i define the members of the group.
With (if is state) or (and) or (is state)?
Do they have to define one after the other?
Or among each other?
Like here in the example?
- platform: template
sensors:
luxtronik_id_web_wp_bz_akt:
value_template: >-
{%- if is_state("luxtronik.id_web_wp_bz_akt", "heating") %}
Heizen
{%- elif is_state("luxtronik.id_web_wp_bz_akt", "hot water") %}
Warmwasser
{%- elif is_state("luxtronik.id_web_wp_bz_akt", "evu") %}
EVU Sperre
{%- elif is_state("luxtronik.id_web_wp_bz_akt", "defrost") %}
Abtauen
{% else %}
Keine Anforderung
{%- endif %}
tom_l
October 5, 2020, 1:37pm
15
You cant use templates in group configurations.
Kabala
(Cata)
October 5, 2020, 7:35pm
16
Is that correct?
zone_wir_time_remaining:
friendly_name: 'Zone wir Time Remaining'
value_template: >
{% set update = states('sensor.time') %}
{% if is_state('switch.zone_5', 'on') %}
{% elif is_state('switch.zone_6', 'on') %}
{% elif is_state('switch.zone_7', 'on') %}
{% elif is_state('switch.zone_8', 'on') %}
{% elif is_state('switch.zone_9', 'on') %}
{{ [ (states('input_number.zone_5_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_5.last_changed))/60)|round(0) ,0 ] | max }}
{{ [ (states('input_number.zone_6_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_6.last_changed))/60)|round(0) ,0 ] | max }}
{{ [ (states('input_number.zone_7_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_7.last_changed))/60)|round(0) ,0 ] | max }}
{{ [ (states('input_number.zone_8_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_8.last_changed))/60)|round(0) ,0 ] | max }}
{{ [ (states('input_number.zone_9_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_9.last_changed))/60)|round(0) ,0 ] | max }}
{% else %}
0
{% endif %}
unit_of_measurement: "min"