Atlas Scientific Wi-Fi Hydroponics Kit example yaml

Here is my code which has calibration via buttons, temperature compensation, and switches to enable the pins that power the sensors.

esphome:
  name: <pool_sensor>

esp8266:
  board: huzzah

i2c:
    scan: false
    sda: 4
    scl: 5

button:
  - platform: template
    name: "Clear PH Calibration" 
    id: ph_calibrate_clear
    on_press:
      then: 
        - lambda: id(ph_ezo).clear_calibration();
  - platform: template
    name: "PH 7 Calibrate" 
    id: ph_calibrate_7
    on_press:
      then: 
        - lambda: id(ph_ezo).set_calibration_point_mid(7.00);
  - platform: template
    name: "PH 10 Calibrate" 
    id: ph_calibrate_10
    on_press:
      then: 
        - lambda: id(ph_ezo).set_calibration_point_high(10.00);
  - platform: template
    name: "PH 4 Calibrate" 
    id: ph_calibrate_4
    on_press:
      then: 
        - lambda: id(ph_ezo).set_calibration_point_low(4.00);     

switch:
  - platform: gpio
    pin: 15
    name: "Temp Enabled"
    restore_mode: ALWAYS_ON

  - platform: gpio
    pin:
      number: 14
      inverted: true
    name: "pH Enabled"
    restore_mode: ALWAYS_ON

  - platform: gpio
    pin:
      number: 12
      inverted: true
    name: "ORP Enabled"
    restore_mode: ALWAYS_ON

sensor:
  - platform: ezo
    id: rtd_ezo
    name: "Temperature Measurement"
    address: 102
    accuracy_decimals: 2
    unit_of_measurement: "°F"
    update_interval: 60s
    on_raw_value:
      then:
        lambda: |-
          id(ph_ezo).set_tempcomp_value(id(rtd_ezo).state);
    filters:
      - lambda: return x * (9.0/5.0) + 32.0;

  - platform: ezo
    id: ph_ezo
    name: "pH Level"
    address: 99
    accuracy_decimals: 2
    unit_of_measurement: "pH"
    state_class: "measurement"
    update_interval: 60s

  - platform: ezo
    id: ph_orp
    name: "ORP Level"
    unit_of_measurement: "mV"
    address: 98
    state_class: "measurement"
    update_interval: 60s

3 Likes