In this write-up, we will install ESPHome to get NTC temperature 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-NTC module and preferably a carrier board
1.
š¦ Install ESPHome
Follow the instructions on the ESPHome website.
2.
š Start a project
Type esphome wizard mod-ntc.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-ntc.yaml file in the directory you ran the command in. If you type esphome compile mod-ntc.yaml
you should see the project compile.
3.
š» Add some YAML and code
We'll make a custom sensor component to get the Mod-NTC 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-NTC
device_name: microfire-mod-ntc
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-ntc 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_ntc
id: ntc
name: Temperature
beta: 3950
button:
- 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: the probe has no polarity and can be connected either way
- Make the I2C connections:
- Mod-NTC SDA to controller SDA
- Mod-NTC SCL to controller SCL
- Mod-NTC GND to controller ground
- Mod-NTC VCC to controller 3.3 or 5-volt
5.
ā”ļø Upload
Type esphome run mod-ntc.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-NTC measurement, and a button to reset the device. You can create dashboards, scripts, and anything else Home Assistant can do from here.