-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,289 @@ | ||
#------------ | ||
#INPUT SELECT | ||
#------------ | ||
# | ||
# | ||
# | ||
input_select: | ||
clack_water_softener_status: | ||
name: Water softener status | ||
options: | ||
- Backwash | ||
- Brine | ||
- Backwash2 | ||
- Rinse | ||
- Fill | ||
- Idle | ||
initial: Idle | ||
|
||
#----------- | ||
#TIMERS | ||
#----------- | ||
# Remark: change the timer settings, upon your own timing (measure time with stopwatch on the complet regen. cycle) | ||
timer: | ||
timer_ws_backwash: | ||
name: Backwash | ||
# duration: '0:00:57' | ||
duration: '0:00:10' | ||
|
||
timer_ws_brine: | ||
name: Brine | ||
# duration: '0:01:07' | ||
duration: '0:00:10' | ||
|
||
timer_ws_backwash2: | ||
name: Backwash2 | ||
# duration: '0:00:57' | ||
duration: '0:00:10' | ||
|
||
timer_ws_rinse: | ||
name: Rinse | ||
# duration: '0:01:14' | ||
duration: '0:00:10' | ||
|
||
timer_ws_fill: | ||
name: Fill | ||
# duration: '0:01:10' | ||
duration: '0:00:10' | ||
|
||
timer_ws_total: #sum of all above values | ||
name: Total | ||
# duration: '0:05:44' | ||
duration: '0:00:50' | ||
|
||
#----------- | ||
#SENSORS | ||
#----------- | ||
template: | ||
sensor: | ||
- name: "time_to_regeneration" # custom sensor that calculates the expected number of days till the next regeneration | ||
state: > | ||
{%- set time = (states('number.clack_capacity_in_days') | int * 86400) - (as_timestamp(now()) - as_timestamp((strptime(states('sensor.clack_regenerated_on')[4:15], '%d %b %H:%M').replace(year=now().year)))) | int %} | ||
{%- set hours = ((time % 86400) // 3600) %} | ||
{%- set hours = '{}h '.format(hours) if hours > 0 else '' %} | ||
{%- set days = (time // 86400) %} | ||
{%- set days = '{}d '.format(days) if days > 0 else '' %} | ||
{{days + hours}} | ||
unique_id: "time_to_regeneration" | ||
icon: mdi:calendar-clock | ||
|
||
#----------- | ||
#UTILITY METER | ||
#----------- | ||
utility_meter: | ||
clack_waterusage_this_quarter: | ||
source: sensor.clack_water_meter | ||
cycle: quarter-hourly | ||
clack_waterusage_this_hour: | ||
source: sensor.clack_water_meter | ||
cycle: hourly | ||
clack_waterusage_today: | ||
source: sensor.clack_water_meter | ||
cycle: daily | ||
clack_waterusage_this_month: | ||
source: sensor.clack_water_meter | ||
cycle: monthly | ||
clack_waterusage_this_year: | ||
source: sensor.clack_water_meter | ||
cycle: yearly | ||
|
||
automation: | ||
#################################################### | ||
- id: set_water_softener_start_backwash | ||
alias: Set water softener start Backwash | ||
trigger: | ||
- platform: state | ||
entity_id: | ||
- binary_sensor.clack_regeneration_pulse | ||
to: 'on' | ||
- platform: state | ||
entity_id: button.clack_test_button_regen_pulse | ||
condition: | ||
- condition: and | ||
conditions: | ||
- condition: state | ||
entity_id: input_select.clack_water_softener_status | ||
state: Idle | ||
action: | ||
- service: input_select.select_option | ||
data: | ||
entity_id: input_select.clack_water_softener_status | ||
option: Backwash | ||
- service: timer.start | ||
entity_id: timer.timer_ws_backwash | ||
- service: timer.start | ||
entity_id: timer.timer_ws_total | ||
initial_state: true | ||
#################################################### | ||
- id: set_water_softener_start_brine | ||
alias: Set water softener start Brine | ||
trigger: | ||
- platform: event | ||
event_type: timer.finished | ||
event_data: | ||
entity_id: timer.timer_ws_backwash | ||
condition: | ||
- condition: and | ||
conditions: | ||
- condition: state | ||
entity_id: input_select.clack_water_softener_status | ||
state: Backwash | ||
action: | ||
- service: input_select.select_option | ||
data: | ||
entity_id: input_select.clack_water_softener_status | ||
option: Brine | ||
- service: timer.start | ||
entity_id: timer.timer_ws_brine | ||
initial_state: true | ||
#################################################### | ||
- id: set_water_softener_start_backwash2 | ||
alias: Set water softener start Backwash2 | ||
trigger: | ||
- platform: event | ||
event_type: timer.finished | ||
event_data: | ||
entity_id: timer.timer_ws_brine | ||
condition: | ||
- condition: and | ||
conditions: | ||
- condition: state | ||
entity_id: input_select.clack_water_softener_status | ||
state: Brine | ||
action: | ||
- service: input_select.select_option | ||
data: | ||
entity_id: input_select.clack_water_softener_status | ||
option: Backwash2 | ||
- service: timer.start | ||
entity_id: timer.timer_ws_backwash2 | ||
initial_state: true | ||
#################################################### | ||
- id: set_water_softener_start_rinse | ||
alias: Set water softener start Rinse | ||
trigger: | ||
- platform: event | ||
event_type: timer.finished | ||
event_data: | ||
entity_id: timer.timer_ws_backwash2 | ||
condition: | ||
- condition: and | ||
conditions: | ||
- condition: state | ||
entity_id: input_select.clack_water_softener_status | ||
state: Backwash2 | ||
action: | ||
- service: input_select.select_option | ||
data: | ||
entity_id: input_select.clack_water_softener_status | ||
option: Rinse | ||
- service: timer.start | ||
entity_id: timer.timer_ws_rinse | ||
initial_state: true | ||
#################################################### | ||
- id: set_water_softener_start_fill | ||
alias: Set water softener start Fill | ||
trigger: | ||
- platform: event | ||
event_type: timer.finished | ||
event_data: | ||
entity_id: timer.timer_ws_rinse | ||
condition: | ||
- condition: and | ||
conditions: | ||
- condition: state | ||
entity_id: input_select.clack_water_softener_status | ||
state: Rinse | ||
action: | ||
- service: input_select.select_option | ||
data: | ||
entity_id: input_select.clack_water_softener_status | ||
option: Fill | ||
- service: timer.start | ||
entity_id: timer.timer_ws_fill | ||
initial_state: true | ||
#################################################### | ||
- id: set_water_softener_idle | ||
alias: Set water softener Idle | ||
trigger: | ||
- platform: event | ||
event_type: timer.finished | ||
event_data: | ||
entity_id: timer.timer_ws_fill | ||
condition: | ||
- condition: and | ||
conditions: | ||
- condition: state | ||
entity_id: input_select.clack_water_softener_status | ||
state: Fill | ||
action: | ||
- service: input_select.select_option | ||
data: | ||
entity_id: input_select.clack_water_softener_status | ||
option: Idle | ||
- service: esphome.clack_meterstand_clack | ||
data: | ||
meter_value: 0 | ||
- service: input_number.set_value | ||
data_template: | ||
entity_id: input_number.clack_water_softener_meter_liters | ||
value: 0 | ||
initial_state: true | ||
#------------------------------------------------------------------ | ||
# Extra options: Salt level alarm and hardness measurement alarm. | ||
# Fill in your own mobile_app_iphone_van_xxx in. (as an example) | ||
#------------------------------------------------------------------ | ||
- id: salt_level_alarm_notify | ||
alias: Salt level alarm notify | ||
description: '' | ||
trigger: | ||
- platform: state | ||
entity_id: sensor.clack_fill_salt | ||
to: "yes" | ||
condition: | ||
- condition: time | ||
after: 07:30:00 | ||
before: '22:00:00' | ||
action: | ||
- service: notify.mobile_app_iphone_van_a_c_a | ||
data: | ||
title: Be aware! | ||
message: Salt level watersoftener is low! Fill salt today! | ||
data: | ||
push: | ||
sound: | ||
name: default | ||
critical: 1 | ||
volume: 1 | ||
- delay: | ||
minutes: 30 | ||
initial_state: 'true' | ||
mode: single | ||
#################################################### | ||
- id: measure_hardness_notify | ||
alias: Measure Hardness | ||
description: '' | ||
trigger: | ||
- platform: numeric_state | ||
entity_id: | ||
- sensor.clack_watermeter | ||
above: 3000 | ||
condition: | ||
- condition: time | ||
after: 07:30:00 | ||
before: '22:00:00' | ||
action: | ||
- service: notify.mobile_app_iphone_van_a_c_a | ||
data: | ||
title: Be aware! | ||
message: 'Measure hardness softener: used 3000 ltr' | ||
data: | ||
push: | ||
sound: | ||
name: default | ||
critical: 1 | ||
volume: 1 | ||
- delay: | ||
minutes: 30 | ||
mode: single | ||
initial_state: 'true' |