In this write-up, we will install ESPHome to get ORP measurements into Home Assistant.
- We will be working in a terminal and using a few commands
- You'll need a Home Assistant installation running
- An ESP-device
- A Mod-ORP module and preferably a carrier board
1.
š¦ Install ESPHome
Follow the instructions on the ESPHome website.
2.
š Start a project
Type esphome wizard mod-orp.yaml
in the terminal. Make sure the path on the terminal is where you want the project to be. Follow the steps, and there should be a mod-orp.yaml file in the directory you ran the command in. If you type esphome compile mod-orp.yaml
you should see the project compile.
3.
š» Add some YAML and code
We'll make a custom sensor component to get the Mod-ORP module working. This is done by adding some lines to the YAML.
The YAML file should be changed to the following:
substitutions:
friendly_name: Microfire Mod-ORP
device_name: microfire-mod-orp
esphome:
name: $device_name
esp32:
board: esp32dev
framework:
type: arduino
logger:
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: $device_name
password: !secret wifi_failover
captive_portal:
# import the mod-orp component
external_components:
- source:
type: git
url: https://github.com/u-fire/ESPHomeComponents/
# https://esphome.io/components/i2c.html
i2c:
sda: 21
scl: 22
sensor:
- platform: mod_orp
id: orp
name: ORP
button:
- platform: template
id: orp_calibrate_low
name: ORP Calibrate Single 400 mV
icon: mdi:format-vertical-align-center
on_press:
lambda: |-
id(orp).calibrateSingle(400);
- platform: template
id: orp_calibrate_reset
name: ORP Calibrate Reset
icon: mdi:restore
on_press:
lambda: |-
id(orp).calibrateReset();
- platform: factory_reset
name: Restart with Factory Default Settings
Make sure you change the wifi
section to your network and password if you aren't using a secrets.yaml. Check that the i2c
section is using the correct pins.
4.
š Connect everything
Now is a good time to ensure the module is connected to the ESP-device.
- Connect the probe
- Make the I2C connections:
- Mod-ORP SDA to controller SDA
- Mod-ORP SCL to controller SCL
- Mod-ORP GND to controller ground
- Mod-ORP VCC to controller 3.3 or 5-volt
5.
ā”ļø Upload
Type esphome run mod-orp.yaml
It will compile the project and ask you which serial device to upload the code to. After that, you'll see the ESP debug output. If everything goes to plan, you should see a device has been discovered in Home Assistant.
6.
š Home Assistant
From within Home Assistant, press Settings > Devices & Services
and find the device in the ESPHome integration box. Click it and then click where it says 1 Device
. You should see a screen with all the information, Mod-ORP measurement, and some buttons to calibrate and reset the device. You can create dashboards, scripts, and anything else Home Assistant can do from here.