EzloPi build a Temperature Sensor with open source

I did one with an ESP32 mini. Then its set up as a IP Device under Ezlo.

Ezlo polls the ESP32 with a GET and then the IP template parses the response string to stuff the temperature reading into a temp probe device.

The code to read the sensor is trivial once you load the Dallas Semi library, just a couple lines to initialize and read the probe(s). Would be easy to make this native in Ezlo Pi.

Init Section:
#include <OneWire.h>
#include <DallasTemperature.h>

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire, ONE_WIRE_PULLUP);


sensors.requestTemperatures(); // Goes out and polls all the attached DS18B20 Sensors attached and each gets a row in the output
for (int i = 0; i < sensors.getDeviceCount(); i++) {
row = "Temperature P ";
row += String(i + 1);
}

1 Like