Select Git revision
water_ph.yaml
water_ph.yaml 3.04 KiB
substitutions:
ph400_raw: '2.06785'
ph686_raw: '1.57897'
ph700_raw: '1.54883'
ph918_raw: '1.21447'
globals:
- id: ph400_raw # raw V value from probe using pH 4.0 calibration solution.
type: float
restore_value: yes
initial_value: ${ph400_raw}
- id: ph700_raw # raw V value from probe using pH 7.0 calibration solution.
type: float
restore_value: yes
initial_value: ${ph700_raw}
- id: ph686_raw # raw V value from probe using pH 6.86 calibration solution.
type: float
restore_value: yes
initial_value: ${ph686_raw}
- id: ph918_raw # raw V value from probe using pH 9.18 calibration solution.
type: float
restore_value: yes
initial_value: ${ph918_raw}
sensor:
- platform: ads1115
ads1115_id: ads1115_phec
id: analog_ph
internal: true
#name: "pH: Analog Voltage"
multiplexer: 'A0_GND'
gain: 4.096 # max: 3.0V
update_interval: 5s
accuracy_decimals: 5
<<: !include filter.yaml
# - platform: template
# name: "pH: 4.00 Calibration Value"
# unit_of_measurement: "V"
# accuracy_decimals: 5
# update_interval: 5s
# lambda: !lambda return id(ph400_raw);
# - platform: template
# name: "pH: 6.86 Calibration Value"
# unit_of_measurement: "V"
# accuracy_decimals: 5
# update_interval: 5s
# lambda: !lambda return id(ph686_raw);
# - platform: template
# name: "pH: 7.00 Calibration Value"
# unit_of_measurement: "V"
# accuracy_decimals: 5
# update_interval: 5s
# lambda: !lambda return id(ph700_raw);
# - platform: template
# name: "pH: 9.18 Calibration Value"
# unit_of_measurement: "V"
# accuracy_decimals: 5
# update_interval: 5s
# lambda: !lambda return id(ph918_raw);
- platform: template
name: "pH"
id: ph
unit_of_measurement: "pH"
accuracy_decimals: 2
update_interval: 5s
lambda: |-
float slope;
if (id(ph_slope_points).active_index() == 1) {
slope = (id(ph918_raw) - id(ph400_raw)) / (9.18 - 4.00);
} else {