I’m thinking have finishing my work but need validation.
I created lovelace carte like :
when auto mode is on :
when auto is off and calibration on :
Working also with the both on.
Activating calibration send a notification to check bubbles in tube and if it’s not empty :
when calibration is running i use 15 sec but think to add a input-number to choice a period time:
At end of this period, a notification come and ask to report qty value:
This value impact normally daily runtime:
value_template: "{{ (float(states('input_number.reefdoser1_pump1_daily_dosage')) / float(states('input_number.reefdoser1_pump1_calibration_dosage'))/15 ) | round(2) }}"
friendly_name: 'R1P1 Durée ajout quotidien'
See here entire code with Lovelace code at the end :
###################################################################################
# Customize Gobal #
###################################################################################
homeassistant:
customize_glob:
"input_boolean.r2d*":
icon: mdi:calendar-clock
"input_boolean.r1d*":
icon: mdi:calendar-clock
"sensor.reefdoser*_pump*_daily_runtime":
icon: mdi:history
"sensor.reefdoser*_pump*_dosage_split":
icon: mdi:beaker
"sensor.reefdoser*_pump*_time_split":
icon: mdi:update
"input_number.reefdoser*_pump*_daily_mins":
icon: mdi:clock
"input_select.reefdoser1_pump*_daily_freq":
icon: mdi:progress-clock
#switch:
# - platform: mqtt
# name: "Reefdoser1 Pump1"
# state_topic: "homeassistant/stat/Reefdoser1/POWER1"
# command_topic: "homeassistant/cmnd/Reefdoser1/POWER1"
# qos: 1
# payload_on: "ON"
# payload_off: "OFF"
# retain: True
###################################################################################
# input_boolean #
###################################################################################
input_boolean:
r1p1:
name: "Kh (R1P1) : Mode auto"
icon: mdi:arrow-decision-auto-outline
# Pump calibration
calibr1p1on:
name: "Mode calibration"
icon: mdi:tape-measure
calibr1p1start:
name: "start calibration for 15 sec"
icon: mdi:clock-start
###################################################################################
# sensor #
###################################################################################
sensor:
- platform: template
sensors:
# Reefdosers ONLINE status sensors
reefdoser1:
value_template: '{% if is_state("device_tracker.reefdoser1", "home") %}Online{% else %}OFFLINE{% endif %}'
friendly_name: 'État Reefdoser1'
icon_template: >-
{% if is_state('device_tracker.reefdoser1', 'home') %}
mdi:power-plug
{% else %}
mdi:power-plug-off
{% endif %}
# Reefdoser1 Runtime sensors
reefdoser1_pump1_daily_runtime:
value_template: "{{ (float(states('input_number.reefdoser1_pump1_daily_dosage')) / (float(states('input_number.reefdoser1_pump1_calibration_dosage'))/15)) | round(2) }}"
friendly_name: 'R1P1 Durée ajout quotidien'
unit_of_measurement: 'sec'
reefdoser1_pump1_dosage_split:
value_template: "{{ (float( states('input_number.reefdoser1_pump1_daily_dosage')) / float(states('input_select.reefdoser1_pump1_daily_freq'))) | round(2) }} "
friendly_name: 'R1P1 Qté ajout fractioné'
unit_of_measurement: 'ml'
reefdoser1_pump1_time_split:
value_template: "{{ (float(states('sensor.reefdoser1_pump1_daily_runtime')) / float(states('input_select.reefdoser1_pump1_daily_freq'))) | round(2) }}"
friendly_name: 'R1P1 Durée ajout fractioné'
unit_of_measurement: 'sec'
###################################################################################
# device_tracker: #
###################################################################################
device_tracker:
- platform: ping
hosts:
reefdoser1: 192.168.1.49
###################################################################################
# input_numbers #
###################################################################################
input_number:
reefdoser1_pump1_daily_dosage:
name: Ajout quotidiens
min: 1
max: 500
step: 1
unit_of_measurement: ml
icon: mdi:beaker
# initial: 30
reefdoser1_pump1_daily_mins:
name: Décal. min. /H. réf.
min: 00
max: 59
step: 1
mode: box
# initial: 00
unit_of_measurement: mins
reefdoser1_pump1_calibration_dosage:
name: Résultat calibration en ml
min: 1
max: 50
step: 0.5
unit_of_measurement: ml
mode: box
icon: mdi:flask-outline
# initial: 30
###################################################################################
# input_select #
###################################################################################
input_select:
reefdoser1_pump1_daily_freq:
name: Nbr d'ajouts quotidiens
options:
- "1"
- "2"
- "3"
- "4"
- "6"
- "8"
- "12"
- "24"
icon: mdi:target
###################################################################################
# automations #
###################################################################################
automation:
# Reefdoser1 Section
# R1P1 Subsection Automations
- alias: Reefdoser1 Pump1 at the specified frequency
trigger:
- platform: time_pattern
hours: "/1"
seconds: "00"
condition:
condition: and
conditions:
- condition: template
value_template: "{{ now().hour % ( 24 / float(states('input_select.reefdoser1_pump1_daily_freq')))|int == 0 }}"
- condition: template
value_template: "{% if now().minute | int == states.input_number.reefdoser1_pump1_daily_mins.state | int %}true{% endif %}"
- condition: state
entity_id: sensor.reefdoser1
state: 'Online'
- condition: state
entity_id: input_boolean.r1p1
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.pompe_doseuse_kh
- delay: '00:00:{{ states.sensor.reefdoser1_pump1_time_split.state | int }}'
- service: switch.turn_off
entity_id: switch.pompe_doseuse_kh
# Calibration start
- alias: Notify ready calibration R1P1
trigger:
platform: state
entity_id: input_boolean.Calibr1p1on
to: 'on'
action:
service: notify.mobile_app_iphone_x_raphael
data:
title: "Calibration R1P1 - Kh"
message: "Vérifiez le tuyau ; plein et sans bulles d'air. Placez le recipient doseur en sortie et enclanchez calibration start"
data:
push:
thread-id: "activité_reef-group"
# Calibration view reset with auto statut
# Allow to mask calibration card in lovelace if off
- alias: Reset calibration view
trigger:
platform: state
entity_id: input_boolean.r1p1
to: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.calibr1p1on
# Calibration view reset with auto statut
# Allow to mask calibration card in lovelace if off
- alias: Calibration pump for 15 sec
trigger:
platform: state
entity_id: input_boolean.calibr1p1start
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: sensor.reefdoser1
state: 'Online'
- condition: state
entity_id: input_boolean.calibr1p1on
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.pompe_doseuse_kh
- delay: '00:00:15'
- service: switch.turn_off
entity_id: switch.pompe_doseuse_kh
- service: input_boolean.turn_off
entity_id: input_boolean.calibr1p1start
- service: notify.mobile_app_iphone_x_raphael
data:
title: "Fin calibration"
message: "Reporter la qté delivrée par la pompe"
data:
push:
thread-id: "activité_reef-group"
###################################################################################
# group #
###################################################################################
group:
aqua_view:
view: yes
name: Pompes Doseuses
entities:
- group.r1p1
r1p1:
name: R1P1 - Kh
control: hidden
entities:
- switch.pompe_doseuse_kh
- input_boolean.r1p1
- input_number.reefdoser1_pump1_daily_mins
- input_select.reefdoser1_pump1_daily_freq
- input_number.reefdoser1_pump1_daily_dosage
- sensor.reefdoser1_pump1_dosage_split
- sensor.reefdoser1_pump1_daily_runtime
- sensor.reefdoser1_pump1_time_split
###################################################################################
# Dynamic Card in lovelace #
###################################################################################
#cards:
# - card:
# entities:
# - entity: switch.pompe_doseuse_kh
# - entity: input_boolean.r1p1
# - entity: input_boolean.calibr1p1on
# show_header_toggle: false
# title: Kh - R1P1
# type: entities
# conditions:
# - entity: input_boolean.r1p1
# state: 'off'
# title: Réveil - Aube
# type: conditional
# - card:
# entities:
# - entity: switch.pompe_doseuse_kh
# - entity: input_boolean.r1p1
# - entity: input_number.reefdoser1_pump1_daily_mins
# - entity: input_select.reefdoser1_pump1_daily_freq
# - entity: input_number.reefdoser1_pump1_daily_dosage
# - entity: sensor.reefdoser1_pump1_dosage_split
# - entity: sensor.reefdoser1_pump1_daily_runtime
# - entity: sensor.reefdoser1_pump1_time_split
# - entity: sensor.reefdoser1
# - entity: input_boolean.calibr1p1on
# show_header_toggle: false
# title: Kh - R1P1
# type: entities
# conditions:
# - entity: input_boolean.r1p1
# state: 'on'
# type: conditional
# - card:
# entities:
# - entity: input_boolean.calibr1p1start
# - entity: input_number.reefdoser1_pump1_calibration_dosage
# show_header_toggle: false
# title: Calibration Kh - R1P1
# type: entities
# conditions:
# - entity: input_boolean.calibr1p1on
# state: 'on'
# type: conditional
#type: vertical-stack
#
Sorry for the French in code but it long to do a second time in english. It’s 1am30 here. Say me what you think about it. It’s my first project DIY.