Tasmota (Arduino) and CraftbeerPi RIMS Configuration using DS18B20 and MQTT

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.


Well-Known Member
Jun 20, 2011
Reaction score
My journey started with the issue of my DS18B20 sensors not reporting data in CraftBeerPi 4 after many hours of uptime. I tried many things, different resistors, capacitors, 5v rails, etc (though two different busses seemed to help). It seems that in conjunction with not great OneWire support, OneWire bus not being able to handle 4 sensors, and wiring issues (length, I didn't want to chain) I had to find an alternative. And I wanted to a find an alternative using off the shelf hardware and firmware that would be connected fairly close to the sensor powered by a USB adapter, then that would send sensor data to CraftbeerPi. Initially I was going to write custom code for the Arduino but fell short as my knowledge/time for this is limited. I finally settled on Tasmota for its simplicity to configure for the layman. However, using MQTT for sensor data the lowest possible reporting interval is 10 seconds. While potentially fast enough for a boil kettle, it was not fast enough for my RIMS tube. So what is required for stable 1 second response times? Just an FYI on pre-requisites, you really should already know how to configure a DS18B20 sensor on an Arduino ESP32/8266, as well as some Linux based file editing and commands. I didn't do anything really "new", simply gathered various pieces of what others have done to develop a process that seems to work, but had not been documented in a single thread. Also, currently CraftbeerPi 4 does NOT have a temperature offset control for MQTTSensor. Though I did ask for that enhancement.

Core Configuration for Hardware and Software:
  • For the Raspberry Pi
  • For Tasmota (most Arduino ESP32/8266 boards), install and configure - https://tasmota.github.io/install/
    • On the newly flashed Tasmota's dashboard, browse to
      • Configure your network to reserve the DHCP IP address of the Tasmota OR assign a specific IP address via Tools > Console, then type the command and press enter -- IPAddress1 <IP Address>
      • Go to Configuration
        • Configure MQTTand then click save -- enter Host IP, user and password (if configured previously), the port should be 1883. You can change the client and topic if so desired, but keep it default for now to make sure things work
          • You'll want to remember the "topic" displayed, or you can use MQTT Explorer to find it
        • Configure Module and then click save -- select the GPIO pin that has your sensor, I chose GPIO27. In the dropdown select DS18x20, and set it to 1.
      • (OPTIONAL but likely) To set the sensor to Fahrenheit instead of the default Celsius go to Tools > Console
        • Type the command and press enter --- SetOption8 1
      • (OPTIONAL) To configure the Teleperiod (the time that sensors will report) to something faster for testing (default is 300s), you can to to Configuration > Configure Logging. Set Telemetry Period to 10. Click Save.
      • The Arduino should be powered off before connecting DS18B20 sensor hardware to the Arduino - https://tasmota.github.io/docs/DS18x20
      • Within the Tasmota dashboard landing page you should see the sensor display the temperature like so

Configuring Basic MQTT Sensor on CraftbeerPi 4: This will be based on the Tasmota Teleperiod, a minimum of 10 seconds. This is just to validate we're getting sensor data into CraftbeerPi, but this configuration would be useful for fermenters (as shown in the example image below).
  • Navigate to Hardware
    • Click the + sign to add a sensor
    • Assign a name to the sensor
    • Select from Type > MQTTSensor
    • From the Tasmota Topic you had saved previously, type tele/<topic>/SENSOR
    • For PayloadDictionary, type DS18B20.Temperature
    • For testing, disable ReducedLogging and Timeout by changing these to 0
    • Click Save
  • After the Teleperiod elapses you should now see the temperature (either in F or C)

Configure Advanced MQTT Sensor Polling on the Raspberry Pi and CraftbeerPi:
Basic process, we will use a python script on the Raspberry Pi with an HTTP query to command Tasmota to report every second the status of all connected sensors via MQTT.
  • Configure your Raspberry PI --- https://github.com/stamandster/TasmotaAutoStatus
    • For testing, follow the alternative at the end of the readme
  • In CraftbeerPi configure MQTT Sensor as before, however the following changes occur
    • Topic will become stat/<topic>/STATUS8
    • PayloadDictionary will become StatusSNS.DS18B20.Temperature
    • All other settings same as before
    • Click Save
  • If all has gone well, when you hold your hand to the sensor you should be an almost immediate change in the dashboard.

Hopefully I've clearly described how to configure properly. Also, this configuration has been tested for over 24hrs without dropping a beat. Hopefully this saves others a similar frustration. You can also configure the same Tasmota to be an MQTT Actor (relay), but that's a store for another day.
Last edited:
Excellent guide, thank you for the resource.
You should be able to add a temperature offset in tasmota or will that not work?
Also, I'm surprised that the ds18b20 sensors are crapping out, I haven't used them for more than a few hours so haven't run into this problem. Did you try resetting them in software? BrewPi must get around this problem since it also uses one-wire protocol on a raspberry pi...
Correct, Tasmota allows for temperature offset, however it affects all sensors on the device, not individual. There's a way to create a rule that adjusts and publishes to MQTT. But then you're at the mercy of the Teleperiod minimum of 10s intervals. Also, at lengths and in a star topology, the raspberry pi implementation is very finicky. Otherwise, yes it can be very very stable with a single sensor or short cabling length on a single GPIO pin.
Last edited:
Great resume . Thanks.
I have several long lines with 6 to 8 sensors on rpi.
Most stuck from time to time.
I power them from 5v thru a 100ohms R , and a transistor could short the line to gnd to reset all sensors in that bus.
A cron job checks every 5 min for missing sensors and reset the bus with a diferent gpio.
For fermenters a few min with the same value don’t be noticeable.
Thanks! Yeah, I also adapted another script called "onewiremonitor" to reset a GPIO pin controlling a relay/VDD passthrough OR powering the VDD directly. Thanks also for posting on the Git regarding the MQTTSensor temperature offset.


Though, I've made some adjustments to my wiring by adding a 0.1uF cap between GND and VDD, and a 100ohm resistor on data at the sensor and they've been rock solid for 24hrs thus far.
Instead of polling every second may be a rule with DS18B20#Temperature, could keep changes of the sensor in a Var and send the mqtt only on change.
Instead of polling every second may be a rule with DS18B20#Temperature, could keep changes of the sensor in a Var and send the mqtt only on change.
I've tried that, but, the tasmota rule's aren't fast enough to do this. You only get about 5s at best. But, as I said above, adding the caps and resistors in line seems to have stabilized my sensors to a point where no 00-x ghosted sensors are created (when error's happen).
Last edited: