Help with Electric Smoker Control using a sonoff TH16 and a DS18B20 Sensor

I have flashed a Sonoff TH16 with tasmota and I have put this my config.yaml file and I can get the data I need. I tried using the generic thermostat template but it will not work for my application as I’m trying to control my electric smoker temperature to between 225-250F. The generic thermostat has a max setting of 95. I thought about using an Arduino, but I like the fact I can integrate this into my home assistant platform. I’m new at using this platform but I think it has some promise. I’m using the mosquitto MQTT broker and like what I’m seeing. I already have about 8 other light switches running and also polling my weather data I’m collecting with an Arduino polling misc temp/humidity sensors over the 433 MHz output of the sensors. Just wondering if there might be anyone out there that might be able to give me some pointers.
Thank you

Did you set the max temp in your config. 95F is the same as the default max of 35C.

You might just use a mqtt sensor. No limits. If you have a mqtt temp sensor and mqtt sonoff switch, you can create a automation to control the switch based on the sensor temp.

I don’t see a key value to set the units to F from C.

I’m guessing in the basic config you have units set to imperial based on you seeing a 95 degree max.

What I’m not sure about is if you enter 250 for the max if it will default to Fahrenheit based on that imperial setting or use the input as Celsius and convert it from there. I assume the former.

Worth a try and once you figure it out submit a pull request to update the docs so it’s clearer for others in the future.

I’m getting closer to getting this generic thermostat to work. I had to create a sensor and a switch for the Sonoff Th16 to use in the setup. This is the setup using the tasmota firmware:

sensor:
  - platform: mqtt
    name: "Smoker Temperature"
    state_topic: "tele/sonoff13/SENSOR"
    value_template: "{{ value_json.DS18B20.Temperature }}"
    unit_of_measurement: "°F"
switch:
  - platform: mqtt
    name: "Smoker"
    state_topic: "stat/sonoff13/POWER"
    command_topic: "cmnd/sonoff13/POWER"
    brightness_state_topic: "cmnd/sonoff13/Dimmer"
    brightness_command_topic: "cmnd/sonoff13/Dimmer"
    brightness_scale: 100
    qos: 1
    retain: true
    payload_on: "ON"
    payload_off: "OFF"
climate:
  - platform: generic_thermostat
    name: Smoker Control
    heater: switch.smoker
    target_sensor: sensor.smoker_temperature
    min_temp: 200
    max_temp: 250
    ac_mode: False
    target_temp: 225
    cold_tolerance: 0.3
    hot_tolerance: 0
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 1
    initial_operation_mode: "off"

However there is a HUGE overshoot to the point where I toggled off the switch as the temperature went over 250 F. More work needs to be done.
chart1

I was wondering about this, there is no intelligence built into the thermostat for overshoot. Even if the heat source it taken out, its going to continue to rise a bit. How often does the temp probe report to HA, if it is to long it can contribute to overshoot also.

Another thing to think about is your temp probe. Is it capable of these temps and accurate at these temps? Simple thing to check with another thermometer.

Yes I had two separate thermomters in the chamber. One is a bi-metallic manual one and the other is the one I use for normal cooking. The stated range of the DS18B20 thermocouple is -55C to +125C (-67F to 257F). That’s why I shut off the system when the temp went over 250F and was still toggled on. All were within reason. I’m doing testing without any load in the chamber so the response times will be much faster than normal. The sonoff DS18B20 reading on the ip of the TH16 is continuous but I’m venturing a guess the polling through HA is not as quick. I would like to write a formula for the control but not sure where to put it. That is the reason the switch has a “brighness” defined where I hope to be able to cut the power when the delta T between the setpoint and actual temperature gets smaller.

Just found the command for the teleperiod with tasmota. Entering teleperiod in the sonoff counsole showed it defaults to 300 seconds which is way too long. Will chage and try again.

I am going to add here in case someone finds this in the future.
The DS18B20 is NOT a thermocouple. It is a digital thermometer and should not be used for high heat. Even though some of the DS18B20 devices are waterproofed with a stainless steel casing, the inner sensor is encased in plastic.
Thermocouples are a totally different animal. You will find them in furnaces and hot water heaters but also available for diy projects. http://a.co/7HZQL4S

You are absolutely correct about the sensor not being a thermocouple. The specs state the maximum temperature is 250F so this is well within my cooking temperature range of 220. I’ve actually got is working quite well with some tweaking hot_tolerance of the config file to reduce the overshoot.

  - platform: generic_thermostat
    name: Smoker Control
    heater: switch.smoker
    target_sensor: sensor.smoker_temperature
    min_temp: 150
    max_temp: 250
    ac_mode: False
    target_temp: 220
    cold_tolerance: 1
    hot_tolerance: -20
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 1
    initial_operation_mode: "off"

The temperature range might suit but I think you are cutting it close. What might the continuous close to max heat cycles do to the sensor over time. Suppose it fails open. Perhaps it is just burnt food, but make sure. People don’t usually stand and watch a smoker.

Smoked some ribs. Overall the system worked great!! Need to up the setpoint the next time to 230. I like to finish the pork at 205 and the current settings don’t quite get there.

53a

1 Like

Curious how this has worked out for you. I’m looking at a solution I can implement in to home assistant myself and ran across this thread. Has the sensor held up?

Sorry for the delay. It’s working great for me!. I will eventually move to a thermocouple system but this is fantastic for now.
Greg

Hi I know its a old post but have you any photo of the part ds18b20 placement into the smoker? Thanks

Hi, I’ve been following this conversation and trying to build my own approach on how to control the temperature of the freezer. The idea is that minimum temperature is 0 celsius degree and max is 5 celsius degree. When the temperature goes over 5 the freezer is powered on. Once the temperature goes to 0 the freezer should be powered off. Below is my code but unfortunately it does not react to the temperature at all. Could someone help a newbie a bit.
configuration.yaml
switch:

  • platform: mqtt
    name: “Sonoff_th16_pistoke”
    #unique_id: “0319A2794368”
    command_topic: “cmnd/sonoffth16/power”
    state_topic: “stat/sonoffth16/POWER”
    availability_topic: “tele/sonoffth16/LWT”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    payload_available: “Online”
    payload_not_available: “Offline”
    #optimistic: false
    retain: true

sensor:

  • platform: mqtt
    name: “sonoff_th16_lampo”
    state_topic: “tele/sonoffth16/SENSOR”
    value_template: “{{ value_json.DS18B20.Temperature }}”
    unit_of_measurement: “°C”

climate:

  • platform: generic_thermostat
    name: Pakastimen_ohjaus
    heater: switch.sonoff_th16_sahko
    target_sensor: sensor.sonoff_th16_lampo
    min_temp: 0
    max_temp: 5
    #ac_mode: False True = becomes cooler
    ac_mode: True
    target_temp: 3
    cold_tolerance: 0.5
    hot_tolerance: -2
    min_cycle_duration:
    seconds: 5
    keep_alive:
    seconds: 60
    initial_hvac_mode: “off”

This is what I use for an old window air conditioner that only has the dials to operate. It works great. For any device used for cooling there is a compressor that cannot be cycled quickly. That is why I use the minimum cycle duration.

climate:
  - platform: generic_thermostat
    name: Landing T-Stat
    heater: switch.landing_tstat
    target_sensor: sensor.living_room_temp
    min_temp: 60
    max_temp: 80
    ac_mode: True
    target_temp: 73
    cold_tolerance: 1
    hot_tolerance: 1
    min_cycle_duration:
      minutes: 3
    keep_alive:
      minutes: 1
    initial_hvac_mode: "off"
    away_temp: 78

Yes it’s been working great. I had plans to replace the sensor but it’s been holding up just fine at these temperatures. Only 1/4" of it is in the heating chamber. It’s so nice to start it up and let it go and monitor it on my phone.

@4Square
Amazing work buddy.
This has inspired me to make the same contraption.

Have you got a picture that shows its placement in the heating chamber?
Do I need home assistant to get the fancy graphs or can I view these graphs from the tasmoto interface?
Any idea on how to install a higher capacity sensor? I like to cook at higher temperatures eg. 275f

Kind regards
CF

I’ll get a picture tomorrow. I bought a different thermocouple (Type K) for higher Temp but have to installed it as I’ve not cooked that high. Planning on posting a video this spring. Works great!