Peristaltic Pump / Autodoser upgrade / conversion to Home Assistant Control Project

So recently, we’ve seen a new trend develop of budget consumer grade peristaltic pump / auto-doser products introduced on the market that sport WiFi and Mobile App control technology. Whether your into Hydroponics or Aquarium applications for your auto-dosers, or perhaps some other application entirely, these new products may seem rather attractive. However, some of us may also have invested substantially in previous generation technology, that still performs quite nicely and reliably, just without all the elegant graces of Mobile App technology and/or possibility to integrate into a centralised automated controller like Home Assistant.

Myself, I am in the later camp in that I have TWO 4 channel peristaltic pump devices from the aquarium vendor AquaMedic. I just looked them up on the web, and they are still available today from said manufacture and cost up to 400 Euros or more. My first one is now over 12 years old, although I had to replace the stepper motors eventually around 4-5 years of use, I discovered I can replace these individually myself for about 15 Euros. And I did that again, not long ago and the motors are still fine at this time. But I’ve longed for centralised control of both my Reefdosers for a long time, and certainly wanted a far, far, far more elegant and intuitive interface.

Now if you’ve already read my thread on heading off to use Home Assistant as a dedicated Coral Reef Aquarium Controller for my 10 tanks here --> ( https://community.home-assistant.io/t/going-to-next-level-of-aquarium-automation-whos-with-me/ ) You’ll know that I’m already invested heavily in my Home Assistant setup, which employs ESP32s, ESP8266s and Sonoff devices. With that knowledge in hand, I decided to do something this last week about my AutoDosers. And this is what I came up with.

I started off with two 4-Channel Sonoff devices; one for each doser. My AquaMedic Reefdosers’ stepper motors are 220V AC so using the base 4-Channel Sonoff device was my preference for costs. I believe this solution should also be applicable to pumps that run on DC as well, perhaps using the 4-Channel PRO Sonoff version, but I’ve not yet the opportunity to try that as I have no DC based doser.

BTW - if you do this yourself, all standard SAFETY / WARNING / ACHTUNG disclaimers of working with 110/220V AC power mains apply. PLEASE do not flash your Sonoff devices with the Power Mains connected - you may melt your computer and may fry yourself.

First you need to remove the cover of the Sonoff 4CH device and flash your Sonoff with the appropriate TASMOTA Firmware. Detailing the instructions of how to Flash your firmware is a bit beyond this instructional, but you can find all the info you need on how to do this, along with the firmware itself, here:

Do pay attention to setting all the declared variables under ‘user_config.h’ or your results may vary a bit. And one thing I will draw your attention to is this specific line of ‘user_config.h’ which I recommend to set to as POWER_ALL_OFF, because you probably do not want your AutoDosers to immediately turn on after a power blackout / power outage:

#define APP_POWERON_STATE      POWER_ALL_OFF     // [PowerOnState] Power On Relay state
                                                 //   (POWER_ALL_OFF, POWER_ALL_ON, POWER_ALL_SAVED_TOGGLE, POWER_ALL_SAVED, POWER_ALL_ALWAYS_ON, POWER_ALL_OFF_PULSETIME_ON)

You’ll also want to ensure you have all the core network connectivity and MQTT configuration already pre-set so you don’t have to deal with any of that after you’ve flashed it - it should just work.

After flashing your firmware, you should be able to connect to your Sonoff 4CH to check to see that in basic principle it all functions, and you can activate each channel individually. Double check all your pre-configured settings, and adjust if necessary.


BTW, realistically - if all you wanted was a WiFi programmable upgrade for your Autodoser, software wise, you’re effectively done at this point. There’s a scheduling component in this firmware that will allow you to program up to 16 individual events! That’s not what the objective of this upgrade is, but just saying it’s there if you want it.

All that remains is to install the hardware & setup Home Assistant now.

The case design of the AquaMedics is pretty cool in that it’s very modular and seemed to be a perfect candidate for this modification. But I’ll come back to how cool that is, later. :slight_smile:

For now, I decided to start off with leaving the original Microcontroller in place and just wiring the Sonoff into the doser just by-passing the previous controller all together.

BTW, In Europe, Blue is Neutral and Brown is the LIVE wire. (Blue is the colour of life giving water, brown is the colour of the earth they cover you with when you die. Don’t touch the brown wire. :wink: )

Again - ensure both your Autodoser and your Sonoff are not plugged into the power mains before going any further than this. This is your final warning.

Now the main AC input comes from the far right (that upper right most white electrical block is where it comes in at, and it routes over to the lower-most left GREEN terminal block on the PCB. That is the brown wire that must go in the left most hole in the central orange terminal block of the Sonoff.

Then place that paired blue wire in the first left-most hole of the GREY terminal block of the Sonoff device.

Now, the remaining 4 upper terminal blocks of your Reefdoser should still have blue and brown wires still attached also. These are the 220V switchable AC Feeds that go to the stepper motors of the AutoDoser. On the PCB they are labelled CH1, CH2, CH3, and CH4. Starting with CH1 repeat the same steps of transferring these wires to the Sonoff in the same steps described above. Brown wire goes in the next available hole in the ORANGE terminal block of the Sonoff device and the matched BLUE wire from that pair should go to the next available GREY Terminal Block of the Sonoff device. Proceed in sequence with the same procedure for CH2 and then CH3 and finally CH4.

At the end, you should have something like this:


If you’ve done everything properly, congratulations, you just gave your Doser a Brain Transplant.

Another cool thing about this upgrade you may have just realised - there’s no reason you cannot reverse the process just described to “back out” of this upgrade at a later date, should. you choose too. You can quite literally restore the autodosers original factory state, if you decide to sell them or send them in for service, etc. :wink:
Just saying…

Additionally - and this is the cool thing about the case of the AquaMedic Reefdosers - you can even decide to completely remove the entire original Microcontroller, put it in a box and reduce the width of your upgraded AutoDoser, and still even later “back out” of this upgrade and removal of the modular micro controller and rebuild it to it’s original state.

Originally, I left it for about 4 days, before deciding to finally remove it.

I carefully attached the Sonoff to the remains condensed housing with two threaded screws after carefully measuring out and tapping some new screw holes in the plastic casing. I never hang my AquaMedic losers on the wall, so the modified “backpack configuration” works for me, but if you have your’s mounted via the back of the doser, you’ll have to find some other solution for mounting your Sonoff to your Autodoser.

Once you have it all wired together and snapped all safely away behind the protect housings, go ahead and plug it in and toggle those pumps on and off for about 5 minutes via your mobile phone or computer. Isn’t that already pretty cool? :smiley:

If you made it this far, congratulations, now all you should have to do is setup Home Assistant. And below is all the YAML CODE I wrote specifically for these AutoDosers, so I’ve done all the hardworking for you.

BTW, since this implementation is based on MQTT as the communication protocol, this HA code should work for any kind of Peristaltic Pump designed for measuring out fluids - not just the AquaMedic. You’ll just need to tweak the values for how much it pumps within a given timeframe. For the AquaMedic Reefdosers, it’s 0.41666667 ml per second.

Also - although my implementation is for a 4 x Pump doser, I’m only going to copy and paste the necessary code for controlling a single pump. All you have to do is copy and paste and modify to reflect the names (and numbers) of your device pumps and channels you want to control. (In otherwords, for a Sonoff 4CH controller, you’ll need to duplicate the entries created under SWITCH, INPUT_BOOLEAN, SENSOR, INPUT_SELECT, INPUT_NUMBERS, and AUTOMATIONs for every pump you want to control. In my case with two Reefdosers upgraded with two Sonoffs I also had to duplicate the entry for the second Sonoff / Reefdoser under DEVICE_TRACKER below.

customize_glob.yaml:
  "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:history
  "input_number.reefdoser*_pump*_daily_mins":
    icon: mdi:clock
  "input_select.reefdoser*_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:
  r1d1:
    name: R1D1 Automatic Mode

sensor:
  - platform: template
    sensors:
# Reefdosers ONLINE status sensors
      reefdoser1:
        value_template: '{% if is_state("device_tracker.reefdoser1", "home") %}Online{% else %}OFFLINE{% endif %}'
        friendly_name: 'Reefdoser1 Status'
        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')) / 0.4166666666667 ) | round(2) }}"
        friendly_name: 'R1D1 Total Dosing Time'
        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: 'R1D1 Individual Dosage Amount'
        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: 'R1D1 Individual Dosing Time'
        unit_of_measurement: 'sec'


device_tracker:
  - platform: ping
    home_interval: 10
    hosts:
    reefdoser1: 192.168.1.50

input_numbers.yaml:
  reefdoser1_pump1_daily_dosage:
    name: Daily Dosage
    min: 1
    max: 500
    step: 1
    unit_of_measurement: ml
    icon: mdi:beaker
#    initial: 30
  reefdoser1_pump1_daily_mins:
    name: Dosing Start Minute
    min: 00
    max: 59
    step: 1
    mode: box
#    initial: 00
    unit_of_measurement: mins

input_selects.yaml:
  reefdoser1_pump1_daily_freq:
    name: Daily Dosing Frequency
    options:
      - "1"
      - "2"
      - "3"
      - "4"
      - "6"
      - "8"
      - "12"
      - "24"
    icon: mdi:target

automations.yaml:
# Reefdoser1 Section
# R1D1 Subsection Automations

- alias: Reefdoser1 Pump1 at the specified frequency
  trigger:
    - platform: time
      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.r1d1
        state: 'on'
  action:
    - service: switch.turn_on
      entity_id: switch.reefdoser1_pump1
    - delay: '00:00:{{ states.sensor.reefdoser1_pump1_time_split.state | int }}'
    - service: switch.turn_off
      entity_id: switch.reefdoser1_pump1

groups.yaml:
  aqua_view:
    view: yes
    name: AquaMedic Reefdosers
    entities:
    - group.r1d1

  r1d1:
    name: R1D1 - Calcium
    control: hidden
    entities:
    - switch.reefdoser1_pump1
    - input_boolean.r1d1
    - 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

Now, if you’ve copy and pasted the above into your HA configuration and made the appropriate modifications correctly, you should be able to restart HA. And once it restarts, you should get something that looks a lot like the very top original screenshot (just depending on how many Pumps you actually setup).

If you like this and end up using it in your own solutions, please let us know! I’d really like to see how useful this becomes for others.

And of course, I hope you’ll share any improvements and or unique application ideas for this. :slight_smile:

PS - A very special shout out to @pnbruckner who helped me yesterday realise a mistake and because of his brilliant direction helped me reduce the number of necessary automations per pump from EIGHT to a single ONE Automation rule. He rocks. :slight_smile:

16 Likes

Interesting, great write-up. Now that I (mostly) have a module written for the AquaIllumination lights, I’m hoping to write a module to interface with the coral box wifi doser. I’ll have to come back to this afterwards to see if I can modify it, to include a wifi doser, as an option.

1 Like

Actually @mcclown if you can just get it to speak MQTT over wifi for actuating the power to the pumps, that’s about all you need. Plug in the above HA Configuration above and you’re done. :slight_smile:

Very nice project. I do have a planted freshwater tank and need to dose everyday. For me it’s a tedious job and some days I forget, I hope doing this later. Great job and thanks for sharing

1 Like

Hey @cowboy,
Thanks for sharing this info. Great read up!
Am looking at using my first peristaltic pumps for hydroponics and pool control. I’d love to get some example of such budget pumps you mentioned earlier, if these can be used beyond the world of aquariophilia… Any tip welcome!

1 Like

Hi,
I’m trying to do dosing pump DIY. This topic is welcome for me ^^. I will try to do it with a 4 channel relay with ESP via EspHome. Pumps are ready and working. I’m starting the “yaml project”.
Have you plan a calibration script ?

2 Likes

Did you check Aliexpress / Alibaba or Amazon? I’m still looking to get my hands on a very cheap / free unit to tinker with and try myself.

Hi @Twinsen68,

I never got around to doing a calibration function, because at least 4 of my AquaMedic pump channels did prove to still be accurate to the manufactures stated values and that was all I needed for Calcium, Mag, Iron and Alkalinity.

However, the other unit does appear to have lost some of it’s accuracy - and now I’m thinking about and considering trying my hand with Carbon dosing in the coming months. In which case, I will need to probably suss out the calibration function / script to maintain it’s accuracy. Can’t make any promises at the moment in regards to when I’ll have time for this however, as client/customer work at the moment has priority.

But my initial idea for the function would work something like this:

1.) Acquire the test calibration receptacle with volume demarcations in ml;
2.) ensure the pump hose lines are full with the fluid (ensuring all air bubbles are removed)
3.) Set the calibration receptacle volume (i.e.-25 ml, 100ml, 500ml, whatever) in the HA peristaltic pump calibration interface
4.) Press a button / toggle to begin the calibration process
5.) When the fluid in the receptacle volume reaches the set amount described in the HA calibration field, press / toggle the calibration switch to stop the pump
6.) The calibration script will then perform the necessary math behind the scenes to determine the flow rate of the pump & set that calibration value to be used until the next calibration is performed.

Does that seem legit & easy enough to use? Or are there better methods to calibrate which I’m not aware of, which you could suggest?

@cowboy Th for you answer.
Pumps work great ! I’m thinking to calibration. If i dot something I will publish it. I also thinking to a solution to know remaining volume in flask.

1 Like

From aliexpress. I take 12v peristaltic pump and 4 ch relay with ESP in 12V.

2 Likes

Please do keep us posted how it goes.

If you have time to do a write up of your build, I’m sure it would be appreciated by others who join us in our endeavours. :slight_smile:


I must work on a box to range them.

I used a 4 channel really as describe here : 4 channel Relay ESP8266 Wifi board WORKING with esphome. I got inspired by you project where i replace sonnoff by this est relay.
I made integration with Esphome.

esphome:
  name: 4ch_reef_pompes_doseuse
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "yours"
  password: "yours"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "4Ch Reef Pompes Doseuse"
    password: "yours"

captive_portal:

# Enable Home Assistant API
api:

ota:

logger:
  baud_rate: 0 #need this to free up UART pins

uart:
  baud_rate: 115200 # speed to STC15L101EW
  tx_pin: GPIO1
  rx_pin: GPIO3

switch:
  - platform: template
    name: 'Pompe doseuse Kh'
    id: PomdosKh
    turn_on_action:
      - uart.write: [0xA0, 0x01, 0x01, 0xA2]
    turn_off_action:
      - uart.write: [0xA0, 0x01, 0x00, 0xA1]
    optimistic: true
  - platform: template
    name: 'Pompe doseuse Ca'
    id: PomdosCa
    turn_on_action:
      - uart.write: [0xA0, 0x02, 0x01, 0xA3]
    turn_off_action:
      - uart.write: [0xA0, 0x02, 0x00, 0xA2]
    optimistic: true
  - platform: template
    name: 'Pompe doseuse Min'
    id: PomdosMin
    turn_on_action:
      - uart.write: [0xA0, 0x03, 0x01, 0xA4]
    turn_off_action:
      - uart.write: [0xA0, 0x03, 0x00, 0xA3]
    optimistic: true
  - platform: template
    name: 'Pompe doseuse Mg'
    id: PomdosMg
    turn_on_action:
      - uart.write: [0xA0, 0x04, 0x01, 0xA5]
    turn_off_action:
      - uart.write: [0xA0, 0x04, 0x00, 0xA4]
    optimistic: true
  - platform: restart
    name: "RS4switch_a Restart"

As relay can be activated by wifi as independent switch. So, one card = 4 switch.
1 switch on pump and all in 12V.

I simply use your code for Boolean, sensors, input-select, automatisation… without the MQTT part and replace your switch item in automation action by mine.
Sorry if my english is bad. I her not partake a lot.

2 Likes

@Twinsen68 which pumps have you ordered at ali ?

From Kramoer : KFS in 12V. prefer the two gear in B10. The single one I have are quite speed with 87ml/min.

2 Likes

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.

3 Likes

My question is : what’s happened with calibration value when HA restart ?

1 Like

Hey @cowboy, ok found some 4 channel pumps on Aliexpress @70USD. They’re called Jebao Doser3.4. There is a version called Jebao Doser2.4 with manual control as well for 80USD. Seeing that this is not tested, does not work with corrosive liquids and costs almost the same, I’ll probably go the way described by @Twinsen68

1 Like

@Twinsen68 - Oh wow! Nice one!

I have you beat - I’ve stayed up until 5:30am (I’m in Netherlands) - but was working on customer / client assignments. I need to go to bed for at least a few hours before getting back up & going to work again.

But I look forward to testing out the calibration function this weekend.

As far as your question about calibration value - if you set that to an input_number, AND you do not declare an initial value for that input_number.reefdoser1_pump1_calibration_dosage in your YAML config (and it looks like you do not, as I see it commented out) - than it should take the last known value from the HA database instead.

I’ll make you a proposal - you don’t have to apologise for your French if I don’t have to apologise for my American English. Deal? :slight_smile: Besides, if you and I can’t figure it out how to translate something, I’ve got several French friends I can ask, including one who is also a fellow marine aquarist too.

Are you using HA just for dosing pumps, or are you making a full aquarium controller with Home Assistant?

And if you feel comfortable with sharing, I’m always happy to see a photo of your aquarium you are using this with. :slight_smile:

Here’s a recent photo of mine:

I don’t blame you. I almost want to try his build myself too. :smiley:

@monkey-house
In jebao pump, peristaltic pump cost 2-4$.
The use high quality by choice.

1 Like