Skip to content
Snippets Groups Projects
Select Git revision
  • 37d05dd5bf877a4629f4c5a440c58c5b5018834f
  • main default protected
  • growscreen
3 results

dosing_pca9685.yaml

Blame
  • dosing_pca9685.yaml 1.77 KiB
    globals:
      - id: pump1_ml_sec
        type: float
        initial_value: !secret pump1_ml_sec
      - id: pump1_dose_ml
        type: int
        initial_value: !secret pump1_dose_ml
      - id: pump2_ml_sec
        type: float
        initial_value: !secret pump2_ml_sec
      - id: pump2_dose_ml
        type: int
        initial_value: !secret pump2_dose_ml
    
    pca9685:
      - id: pca9685_dosing
        frequency: 100Hz
    
    output:
      - platform: pca9685
        id: output_ph_down
        pca9685_id: pca9685_dosing
        channel: 8
      - platform: pca9685
        id: output_ph_up
        pca9685_id: pca9685_dosing
        channel: 7
        
    switch:
      - platform: output
        output: output_ph_down
        id: ph_down
        name: "pH Down"
        on_turn_on:
          - then:
            - logger.log:
                level: INFO
                tag: "dosing"
                format: "Dosing %d ml of 'pH Down' (%.1f seconds @ %.2f ml/s)"
                args: [ 'id(pump1_dose_ml)', 'id(pump1_dose_ml) / id(pump1_ml_sec)', 'id(pump1_ml_sec)' ]
            - delay: !lambda return id(pump1_dose_ml) / id(pump1_ml_sec) * 1000;
            - switch.turn_off: ph_down
        on_turn_off:
          - then:
            - logger.log:
                level: INFO
                tag: "dosing"
                format: "Stopped dosing 'pH Down'"
      - platform: output
        output: output_ph_up
        id: ph_up
        name: "pH Up"
        on_turn_on:
          - then:
            - logger.log:
                level: INFO
                tag: "dosing"
                format: "Dosing %d ml of 'pH Up' (%.1f seconds @ %.2f ml/s)"
                args: [ 'id(pump2_dose_ml)', 'id(pump2_dose_ml) / id(pump2_ml_sec)', 'id(pump2_ml_sec)' ]
            - delay: !lambda return id(pump2_dose_ml) / id(pump2_ml_sec) * 1000;
            - switch.turn_off: ph_up
        on_turn_off:
          - then:
            - logger.log:
                level: INFO
                tag: "dosing"
                format: "Stopped dosing 'pH Up'"