logo elektroda
logo elektroda
X
logo elektroda

Tuya TYTE-D1 Smart Switch: Relay Works, Temperature Sensor find

marcolueck1976 6723 39
Best answers

How can I make the external temperature sensor on a Tuya TYTE-D1 smart switch work in OpenBeken?

The TYTE-D1 uses a DS18B20/DS1820-style one-wire sensor on GPIO P26, so the relay can work while temperature stays empty unless that pin is configured and the DS18B20 driver is running [#21147604][#21138205] The device template shown in the thread maps this as `one_wire_pin: 26`, and the sensor was later identified as a Sensylink CT1820B clone, which still needs the DS18B20/DS1820 driver support [#21147604][#21158431] In OpenBeken, start the driver with `startDriver DS1820` and make it persistent in startup if needed [#21155826][#21501442] If you want the temperature to appear properly in MQTT/Home Assistant, set the temperature channel type to `Temperature_div100` for the DS1820/DS18B20 channel and rerun HA discovery [#21688949][#21689034][#21689056][#21689460]
Generated by the language model.
ADVERTISEMENT
  • #31 21445968
    akm97
    Level 12  
    Posts: 274
    Rate: 78
    Gentlemen an interesting topic, but me from a different angle. I own such a fully working sensor. Although the load capacity of the relay is 3kW, it is only 1 KW with the heater. It is with such a heater that I use it, or rather try it. And so sometimes, when the heater just happens to have an intake of less than 1 kW, it is OK, but other times, when it exceeds this value, it disconnects the relay after about 5 seconds. Is it possible to increase its "load capacity" by 10%?
  • ADVERTISEMENT
  • #32 21501442
    ok2vuv
    Level 9  
    Posts: 4
    >>21379314 Driver for DS18B20 starts with this key startDriver DS1820 by inserting it into Config and Execute Custom Command. To start after startup, insert into Configure Startup a startup command as well as startDriver NTP and ntp_timeZoneOfs 2
    I just can't get the temperature into MQTT and Home Assistant.
    Please help.
    Radek
    Screenshot with data on energy and temperature of a device.
  • ADVERTISEMENT
  • #33 21687944
    buenogy
    Level 4  
    Posts: 4
    Hello ok2vuv,
    Have you found a solution to publish temperature on MQTT and HA?
  • #34 21688767
    ok2vuv
    Level 9  
    Posts: 4
    >>21687944 Not yet, but I haven’t looked very thoroughly. I’m also not a complete IT specialist…
  • #35 21688949
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    You can configure the channel to hold the temperature in the second field after the pin for DS1820_IO on the config page.
    In the screenshot I see you configured channel 2 - channel 2 has (temperature * 100) = 2468 there.
    I'm not sure, but isn't this channel published on every change of channel = change of temperature?
  • ADVERTISEMENT
  • #36 21689000
    buenogy
    Level 4  
    Posts: 4
    >>21688949 Thanks max4electroda.
    Yes, I found that but it's possible to publish only the channel 2 because I can publish it with all MQTT channels. Not only the number 2. What's the command for that?
  • Helpful post
    #37 21689034
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    I'm not really fit in MQTT / HA.
    I just tired here and looks like if you set the "channel type" for the channel with temperature value to "Temperature_div100" (like her in Web App on "Config" page)


    Screenshot of pin and channel configuration with DS18B20 sensor highlighted

    then in HA a new (separate) temperature for the same device is shown (after starting a new "HA Discovery" on OBK):

    Diagnostic panel of W800 device with network data and temperature reading

    If you edit your device entities, you can add a second "Temperature" (there will be two, check out which one is chip internal and which DS1820 - for me it was the one without "_2"):

    Entity card configuration titled W800_Testing showing five listed entities
  • ADVERTISEMENT
  • #38 21689039
    buenogy
    Level 4  
    Posts: 4
    Thanks for your help.

    I will test it.

    Added after 20 [minutes]:

    >>21689039 >>21689034

    Work Very Well !!!

    Thanks
  • #39 21689056
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    buenogy wrote:
    Work Verry Well !!!

    Great!

    If you configure channel type, the temperature will also appear a third time on OBK main Page (beside the drivers value and the channels value) as "Temperature <value> (<channel>)"


    Screenshot of OpenW800 interface showing temperature and system status

    BTW: You don't need Web App to configure channel, it can also be configured with the command (e.g. in "Execute Custom Command)

    setChannelType 2 Temperature_div100
  • #40 21689460
    ok2vuv
    Level 9  
    Posts: 4
    >>21688949 Thank you very much, it works. The temperature is in HA.

Topic summary

✨ The discussion centers on the Tuya TYTE-D1 smart switch featuring a BK7231N chip and an external DS18B20 temperature sensor connected via a 3.5mm jack. The relay and power measurement functions operate correctly, but temperature readings are initially unavailable due to missing driver support. GPIO 26 is identified as the One-Wire data pin for the DS18B20 sensor. Community members have been developing and porting a DS18B20 driver for the OpenBeken firmware, with progress including pull requests and testing on the CB3S board variant. The One-Wire protocol characteristics and sensor clone identification (Sensylink CT1820B) were discussed. Users seek guidance on enabling temperature reporting to MQTT and Home Assistant, with suggestions to start the DS1820 driver via custom commands and configure startup scripts. Additional features like relay state retention after power failure were queried, with configuration options suggested. Some users report partial success with the driver on GPIO 26, while others face issues with driver activation and temperature data publishing. The relay's load capacity and behavior under varying heater loads were also discussed. The latest OpenBeken builds include a DS18B20 driver and device template for TYTE-D1, facilitating integration of temperature sensing alongside relay control and power monitoring.
Generated by the language model.

FAQ

TL;DR: For TYTE-D1 owners, the fix is simple: map the 3.5 mm probe to GPIO P26, then start the DS18B20 driver. As one expert put it, "The GPIO for DS18B20 on the TYTE-D1 is P26." This FAQ solves the common OpenBeken problem where relay and BL0937 power metering work, but temperature does not. [#21147604]

Why it matters: If you use the TYTE-D1 for heaters or aquariums, correct sensor setup determines whether the device can switch loads based on real probe temperature instead of relay state alone.

Option GPIO / Setting Status in thread Main limitation
TYTE-D1 on BK7231N/CB3S P26 + DS1820_IO Eventually working in later builds Early builds needed manual driver start and had CRC/timing issues
BL602 test path startDriver DS1820 18 discussed Better results reported earlier Not the TYTE-D1 hardware
Power metering path BL0937 on P6/P9/P24 Worked from the start Unrelated to probe detection

Key insight: GPIO mapping alone was not enough. The thread shows the TYTE-D1 needed both the correct pin assignment on P26 and a working DS18B20 driver path in OpenBeken before temperature, MQTT, and Home Assistant reporting became reliable. [#21276251]

Quick Facts

  • TYTE-D1 template data identified a BK7231N chip on a CB3S module, with relay on P8, button on P7, Wi-Fi LED on P14, and BL0937 metering on P6/P9/P24. [#21135746]
  • Tuya configuration exposed one_wire_pin:"26", which directly led to the TYTE-D1 external probe being mapped to GPIO P26. [#21147604]
  • The final OpenBeken template added "26": "DS1820_IO;2" and device keywords including DS18B20, DS1820B, and sensylink. [#21276251]
  • One user reported the relay is labeled AC85-250V, 3000W/16A, yet with a heater it could trip after about 5 seconds when load rose slightly above 1 kW. [#21445968]
  • For Home Assistant, setting the sensor channel type to Temperature_div100 made the external probe appear as a separate temperature entity after HA Discovery. [#21689034]

How do I get the temperature sensor working on a Tuya TYTE-D1 after flashing OpenBeken when the relay and power metering already work?

Set the probe pin to P26 as DS1820_IO and start the DS18B20 driver. The thread shows relay and BL0937 metering can work first, while temperature stays missing until the one-wire probe is mapped and the driver is active. The later TYTE-D1 template explicitly added "26": "DS1820_IO;2", which was the turning point for temperature support on this device. [#21276251]

Which GPIO pin is used for the external temperature probe on the Tuya TYTE-D1, and how was P26 identified as the one-wire pin?

The external temperature probe uses GPIO P26. It was identified from the extracted Tuya configuration, which exposed one_wire_pin:"26"; that matched the device’s external probe design and later template work. A key thread conclusion stated directly: "The GPIO for DS18B20 on the TYTE-D1 is P26." [#21147604]

What does the OpenBeken command "startDriver DS1820" do, and where should I add it so the DS18B20 driver starts automatically after reboot?

startDriver DS1820 starts the DS18B20 one-wire temperature driver in OpenBeken. To make it persistent, add it once under Execute Custom Command for testing, then place the same command in Configure Startup so it runs after every reboot. A later user confirmed this exact startup method, alongside other startup commands like NTP, on March 30, 2025. [#21501442]

Why does the TYTE-D1 boot log show repeated "ds18b20 reset fail" messages, and what does that usually mean during troubleshooting?

Those messages usually mean OpenBeken is trying to talk to a DS18B20-class sensor but the bus is not responding. In the thread, repeated ds18b20 reset fail lines appeared because the test unit was booted without the sensor attached, so the firmware could not complete one-wire reset detection. During troubleshooting, treat that log as a sign to check probe presence, wiring, driver start, and the selected GPIO. [#21135749]

How can I configure GPIO 26 as DS1820_IO correctly on a BK7231N / CB3S-based TYTE-D1 in OpenBeken?

Configure P26 as DS1820_IO and bind it to a data channel, typically channel 2 on this device. The working TYTE-D1 template for the BK7231N / CB3S hardware used "26": "DS1820_IO;2", which means GPIO 26 carries the one-wire sensor and reports into channel 2. After that, start the driver so readings actually begin. [#21276251]

What is One-Wire, and how does it relate to DS18B20 temperature probes used in Tuya devices like the TYTE-D1?

One-Wire is the protocol used by the TYTE-D1’s DS18B20-style probe on P26. "One-Wire" is a serial communication standard that uses a single data line, supports uniquely addressed devices, and is commonly used by DS18B20-class temperature sensors for simple low-speed sensing over minimal wiring. That is why the Tuya config named the probe line one_wire_pin. [#21147604]

What is the CB3S module in the TYTE-D1, and why does it matter when setting up OpenBeken on a BK7231N device?

CB3S is the TYTE-D1’s Wi-Fi module, and it matters because it tells you the device uses a BK7231N platform. "CB3S" is a Tuya Wi-Fi module that hosts the BK7231N chip, defines the device’s GPIO environment, and determines which OpenBeken firmware and pin mapping you must use. In this thread, the extracted Tuya config explicitly identified module:"CB3S". [#21135746]

How do I make the TYTE-D1 relay remember its last state after a power failure using OpenBeken's startup configuration?

Use the Configure startup tab and set the relay channel to remember its previous state. The thread answer was short but clear: OpenBeken lets you configure the channel there so it restores the last known relay state after power returns. That matters for heater use, where an unexpected off-state after an outage can be a practical problem. [#21147868]

What's the difference between a genuine DS18B20 and a Sensylink CT1820B clone, and could that affect compatibility on the TYTE-D1?

Yes, the difference can affect compatibility because the TYTE-D1 probe in one tested unit was identified as a Sensylink CT1820B clone, not a genuine Maxim/Analog DS18B20. The thread linked that finding to driver maturity and timing behavior, which helps explain why early OpenBeken work showed CRC problems and inconsistent results on BK7231N. A clone can look compatible yet still stress marginal timing. [#21158431]

How do I trace the 3.5 mm temperature probe wiring on a TYTE-D1 with a multimeter to find where the sensor connects on the board?

Use continuity mode and trace from the 3.5 mm jack to the CB3S module or nearby routing points. 1. Put one probe on each jack contact. 2. Check continuity to exposed pads, vias, or module pins. 3. Match the traced line against known TYTE-D1 GPIO assignments, especially P26. The thread suggested this method before the one-wire pin was fully confirmed. [#21138205]

Why does OpenBeken show "0 drivers active" even after setting P26 to DS1820_IO, and what additional steps should I check?

OpenBeken can show "0 drivers active" if you mapped the pin but did not actually start the DS18B20 driver. Check three things: 1. P26 is set to DS1820_IO. 2. startDriver DS1820 was executed. 3. The firmware version is recent enough to include the working driver path. In January 2025, this exact symptom appeared even though relay, button, LED, and MQTT were already working. [#21379314]

How can I publish the TYTE-D1 external temperature to MQTT and Home Assistant instead of only seeing the raw channel value?

Map the DS18B20 reading to a channel and then expose that channel with the correct type so Home Assistant treats it as temperature. A later thread fix showed that once the sensor value sat on channel 2 and the channel type was set properly, HA Discovery created a usable temperature entity instead of only leaving a raw numeric channel. That also solved the MQTT/HA visibility issue for at least two users. [#21689460]

Which OpenBeken channel settings are needed so a DS18B20 reading appears properly in Home Assistant, including the Temperature_div100 channel type?

Use the DS18B20 data channel, then set its type to Temperature_div100. One working example used channel 2, where a raw value of 2468 represented 24.68°C, and after a new HA Discovery run the external probe appeared as a separate temperature entity. You can also set it by command: setChannelType 2 Temperature_div100. [#21689056]

BK7231N vs BL602 for DS18B20 support in OpenBeken — which platform had better results in the thread and what timing or powersave issues were reported?

BL602 showed better DS18B20 results earlier in the thread. For BK7231N on the TYTE-D1, the best report was with startDriver DS1820 18, PR build 1296_merge_7117258cf00e, and powersave 0; the user said they did not find a working timing with powersave 1. That makes BK7231N the trickier platform here, especially during the driver’s development phase. [#21177339]

How can I troubleshoot a TYTE-D1 relay that disconnects a heater after about 5 seconds when the load goes slightly above 1 kW, and what options exist to handle that safely?

Treat it as a protection or load-handling limit and do not raise limits blindly. In the thread, a user saw shutdown after about 5 seconds when a heater exceeded roughly 1 kW, despite a 3000W/16A label. Safe options from the thread are limited: verify real load with metering, test with lower power, and avoid modifying protection thresholds without understanding the hardware. The discussion did not provide a safe +10% increase method. [#21445968]
Generated by the language model.
ADVERTISEMENT