logo elektroda
logo elektroda
X
logo elektroda

OpenBK7231N_1.17.224 firmware Change Module type and run TuyaMCU commands

tellblom 2877 16
Best answers

How can I replace Tasmota Module 54 with the equivalent OpenBK7231N TuyaMCU configuration for a gas sensor?

OpenBK7231N does not use Tasmota-style module selection; instead, you map Tuya MCU dpIDs to channels with `linkTuyaMCUOutputToChannel` and set each channel type in `autoexec.bat` [#20703081][#20703535] For this gas sensor, the working mapping was `startDriver TuyaMCU`, then `linkTuyaMCUOutputToChannel 1 2 1` / `setChannelType 1 toggle`, `linkTuyaMCUOutputToChannel 2 2 2` / `setChannelType 2 ReadOnly`, `linkTuyaMCUOutputToChannel 19 2 3` / `setChannelType 3 Temperature`, `linkTuyaMCUOutputToChannel 101 2 4` / `setChannelType 4 ReadOnly` or `Temperature`, `linkTuyaMCUOutputToChannel 16 1 5` / `setChannelType 5 toggle`, and `linkTuyaMCUOutputToChannel 8 1 6` / `setChannelType 6 toggle` [#20706372] The device uses 9600 baud, and if the values do not appear you should set `tuyaMcu_defWiFiState 4` and run `tuyaMcu_sendQueryState` to force a full state update [#20703887][#20703946] The working script also starts `tmSensor` and `NTP`, sets `ntp_timeZoneOfs 02:00`, sends the current time with `tuyaMcu_sendCurTime`, and can repeat `tuyaMcu_sendQueryState` every 20 seconds and `tuyaMcu_sendCurTime` every hour with `addRepeatingEvent` [#20706372][#20704133]
Generated by the language model.
ADVERTISEMENT
  • #1 20702133
    tellblom
    Level 3  
    Posts: 9

    I just installed OpenBK7231N_1.17.224 firmware on a gas sensor and have instructions on how to configure it.

    I should switch to Module 54 - How can I do that? In Tasmota, you just write Module 54 and reboot. When I try the same command in OpenBK, I just get "Unknown command".

    The configuration should be done like this:
    Backlog TuyaMCU 79,2; TuyaMCU 71,19; TuyaMCU 72,101; TuyaMCU 11,16; TuyaMCU 12,8; TempRes 0

    How can I configure that in OpenBK?
  • ADVERTISEMENT
  • #2 20703081
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    Hello, please see:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Obk is more flexible in that matter. We are using linkTuyaMCUOutputToChannel to link dpIDs to channels. This allows us to create more scriptable features because channels are like universal variable containers.

    You can search our forum for more information of usage of this command. For example, here is a TH06 temperature sensor tutorial:
    https://www.elektroda.com/rtvforum/topic3942730.html#20342890

    Is your device using 9600 baud or a high speed baud?
    Helpful post? Buy me a coffee.
  • #3 20703239
    tellblom
    Level 3  
    Posts: 9

    Thanks.

    So if I read this correctly, it should be like this or have I misunderstood everything?

    ##TuyaMCU 79,2; (this says it's a gas sensor or dpId 2 if I have understood it correctly) will be

    linkTuyaMCUOutputToChannel 2 2 2
    setChannelType 2 ReadOnly

    ##TuyaMCU 71,19; (this says it's a temp sensor or dpId 19 if I have understood it correctly) will be

    linkTuyaMCUOutputToChannel 19 2 3
    setChannelType 3 ReadOnly

    ##TuyaMCU 72,101; (this says it's a humidity sensor or dpId 101 if I have understood it correctly) will be

    linkTuyaMCUOutputToChannel 101 2 4
    setChannelType 4 ReadOnly

    ##TuyaMCU 11,16; (this says it's a relay or dpId 16 if I have understood it correctly) will be

    linkTuyaMCUOutputToChannel 16 1 5
    setChannelType 5 toggle

    ##TuyaMCU 12,8; (this says it's a relay or dpId 8 if I have understood it correctly) will be

    linkTuyaMCUOutputToChannel 8 1 6
    setChannelType 6 toggle

    Is your device using 9600 baud or a high-speed baud?
    Yes, it does not communicate when setting the baud rate to something else.

    Update:
    When I set the above, the buttons (channel 5 and 6) work, but I get no values on the other channels.
  • ADVERTISEMENT
  • #4 20703535
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    Something like that, you might want to use other channel type for temperature, see:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/channelTypes.md
    Table showing channel types including temperature and humidity, with highlighted words.
    If you don't know baud, please do first Tuya config extraction:
    https://www.youtube.com/watch?v=WunlqIMAdgw&ab_channel=Elektrodacom

    Have you looked at the other autoexec bat examples on our docs?
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20703887
    tellblom
    Level 3  
    Posts: 9
    Baud rate is 9600.

    But it seems like I need my USB -> TTL to get the other data.

    The autoexec.bat file looks like this:

    startDriver TuyaMCU
    startDriver tmSensor
    startDriver NTP
    linkTuyaMCUOutputToChannel 2 2 2
    setChannelType 2 ReadOnly
    SetChannelLabel 3 Gas
    linkTuyaMCUOutputToChannel 19 2 3
    setChannelType 3 ReadOnly
    SetChannelLabel 3 TempSet
    linkTuyaMCUOutputToChannel 101 2 4
    setChannelType 4 Temperature
    SetChannelLabel 4 Temperature
    linkTuyaMCUOutputToChannel 16 1 5
    setChannelType 5 toggle
    SetChannelLabel 5 Mute Alarm
    linkTuyaMCUOutputToChannel 8 1 6
    setChannelType 6 toggle
    SetChannelLabel 6 Alarm
  • #6 20703946
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    Please use:
    
    tuyaMcu_defWiFiState 4

    to force default "paired to cloud" TuyaMCU state, even if it's not online. This may cause more dpIDs to get send to WiFI module.

    To force full dpIDs update, you can use:
    
    tuyaMcu_sendQueryState
    

    Then in Web App see the log, in the log you will see all received packets, their dpIDs, etc.

    Read more: https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 20704090
    tellblom
    Level 3  
    Posts: 9

    Ahh, it seems to update the values when running the tuyaMcu_sendQueryState command.
    But it resets every 2 minutes. I suppose I should schedule the command tuyaMcu_sendQueryState to run every minute.
  • #8 20704133
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    I think those variables should be sent automatically, as long as you set wifi state 0x04 either in script or by connecting to MQTT. Still, if you want to do something repeatingly, search for repeating events:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    
    addRepeatingEvent [RepeatTime] [RepeatCount] [Command]
    
    Helpful post? Buy me a coffee.
  • #9 20704201
    tellblom
    Level 3  
    Posts: 9

    I found that,

    Thanks for the query. It gave me more data.

    The only thing I have left now, I think, is that the alarm states (gas and heat) have inverted values
    and they trigger the alarm when the state is OFF.
    Is there a way to invert this?

    linkTuyaMCUOutputToChannel 1 2 1
    setChannelType 1 toggle
    SetChannelLabel 1 GasAlarmTriggered
  • #10 20704250
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    What exactly would you like to invert? The colors of the toggle?

    I can create a "toggle_inv" channel type and push it, if you think that would suit your needs.
    Helpful post? Buy me a coffee.
  • #11 20704772
    tellblom
    Level 3  
    Posts: 9

    The problem is that if I just connect it to Home Assistant, the ON/OFF value received from the gas alarm will be ON normally (when not triggered).
    But, well, the alarm goes OFF :)
  • #12 20704799
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    Ah ok, so I have added a Toggle_Inv channel type for you. Please wait for build to finish, update, and try to use it. This should work like Toggle, but states will be inverted.

    Still, I think that I could come up with a better solution later, but maybe, for now, just try that Toggle_Inv and let me know if it works.

    It should be up in 1.17.226
    Helpful post? Buy me a coffee.
  • #13 20704809
    tellblom
    Level 3  
    Posts: 9
    Thanks

    I'll try it out
  • Helpful post
    #14 20704899
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    Version 1.17.226 is now live at Github:
    https://github.com/openshwprojects/OpenBK7231T_App
    Helpful post? Buy me a coffee.
  • #15 20706372
    tellblom
    Level 3  
    Posts: 9
    This is the autoexec.bat i now have that seems to work (not configured with the toggle_inv firmware yet)
    
    startDriver TuyaMCU
    startDriver tmSensor
    startDriver NTP
    // CET time
    ntp_timeZoneOfs 02:00
    
    tuyaMcu_sendCurTime
    
    tuyaMcu_defWiFiState 4
    
    
    //Gas larm triggered when this is OFF
    linkTuyaMCUOutputToChannel 1 2 1
    setChannelType 1 toggle
    SetChannelLabel 1 GasLarm
    
    // %LEL value (LEL= Lower Explosion Limit) 
    linkTuyaMCUOutputToChannel 2 2 2
    setChannelType 2 Readonly
    SetChannelLabel 2 Gas
    
    // Current temperature
    linkTuyaMCUOutputToChannel 19 2 3
    setChannelType 3 Temperature
    SetChannelLabel 3 Temperature
    
    
    // The temperature where the Heat Alarm will trigger
    linkTuyaMCUOutputToChannel 101 2 4
    setChannelType 4 ReadOnly
    SetChannelLabel 4 TempSet
    
    // Will silence the alarm if triggered
    linkTuyaMCUOutputToChannel 16 1 5
    setChannelType 5 toggle
    SetChannelLabel 5 Mute_Alarm
    
    //Then triggered the test alarm function will go off
    linkTuyaMCUOutputToChannel 8 1 6
    setChannelType 6 toggle
    SetChannelLabel 6 TestAlarm 
    
    //Heat alarm triggered when this goes OFF
    linkTuyaMCUOutputToChannel 18 4 7
    setChannelType 7 toggle
    SetChannelLabel 7 Heat_Alarm
    
    
    //Preheat mode status 
    linkTuyaMCUOutputToChannel 10 2 8
    setChannelType 8 ReadOnly
    SetChannelLabel 8 Preheat
    
    //Will trigger when sensor should be replaced
    linkTuyaMCUOutputToChannel 10 2 9
    setChannelType 9 ReadOnly
    SetChannelLabel 9 LifeCycle
    
    // Sets the Heat alarm to go off when the temperature is 55C
    tuyaMcu_sendState 101 2 55
    
    //addClockEvent 06:00 0xff 1 tuyaMcu_sendCurTime
    //So that the display has the correct time. It seems to los the time now and then 
    addRepeatingEvent 3600 -1 tuyaMcu_sendCurTime
    
    //Query the sensors every 20 seconds
    addRepeatingEvent 20 -1 tuyaMcu_sendQueryState
  • #16 20706411
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14404
    Help: 650
    Rate: 12336
    You don't need tmSensor if device is not a battery-powered TuyaMCU sensor like a door sensor or humidity/temperature sensor.
    Helpful post? Buy me a coffee.
  • #17 20707829
    tellblom
    Level 3  
    Posts: 9
    Ok thanks I missread then ..

Topic summary

✨ The discussion revolves around configuring the OpenBK7231N_1.17.224 firmware for a gas sensor using TuyaMCU commands. The user seeks guidance on switching to Module 54 and executing specific commands, as the firmware does not recognize the command format used in Tasmota. Responses highlight the flexibility of OpenBK, suggesting the use of the `linkTuyaMCUOutputToChannel` command to map dpIDs to channels, along with setting channel types. The user successfully configures the autoexec.bat file to manage various sensor outputs and alarm states. A solution for inverting alarm states is proposed with the introduction of a new channel type, `Toggle_Inv`, to address the issue of alarm triggers being inverted. The latest firmware version 1.17.226 is mentioned as available for download.
Generated by the language model.

FAQ

TL;DR: Set TuyaMCU WiFi state to 0x04; “paired to cloud” mode unlocks fuller dpID updates without internet. Then use linkTuyaMCUOutputToChannel and tuyaMcu_sendQueryState to map and refresh gas, temperature, and alarm values. [Elektroda, p.kaczmarek2, post #20703946]

Why it matters: This helps OpenBK7231N users migrating from Tasmota configure TuyaMCU sensors, invert alarm logic, and keep Home Assistant states accurate.

Quick Facts

How do I set “Module 54” in OpenBK?

You don’t use Tasmota’s Module numbers in OpenBK. Instead, link Tuya dpIDs to OpenBK channels with linkTuyaMCUOutputToChannel, then choose suitable channel types. As the developer notes, “Obk is more flexible in that matter.” This approach is more scriptable and maintains clean MQTT/Home Assistant integration. [Elektroda, p.kaczmarek2, post #20703081]

How do I map Tuya dpIDs to OpenBK channels?

Start TuyaMCU, then link a dpID to a channel and set its type. Example: startDriver TuyaMCU; linkTuyaMCUOutputToChannel 16 1 5; setChannelType 5 Toggle. Repeat for sensors (Value/ReadOnly/Temperature) and other dpIDs. Consult the command list for parameters and examples. [“OpenBK commands.md”]

Which channel types should I use for temperature and read-only values?

Use Temperature for degrees (e.g., dpID 19), Toggle for relays or buttons (e.g., dpIDs 16, 8), and ReadOnly for sensor values you shouldn’t write. These types render correctly in the UI and publish cleanly to MQTT. Review the channelTypes reference for details. [“OpenBK channelTypes.md”]

How do I force Tuya dpID updates and see them in logs?

Set the TuyaMCU WiFi state to 0x04, then run tuyaMcu_sendQueryState. Open the Web App log to inspect incoming packets and dpIDs. “Paired to cloud” mode works even when not online and often yields more dpIDs. [Elektroda, p.kaczmarek2, post #20703946]

How can I schedule periodic TuyaMCU queries?

Use the repeating events system. 1) Decide an interval, e.g., 20 seconds. 2) Run addRepeatingEvent 20 -1 tuyaMcu_sendQueryState. 3) Confirm updates in the log and UI. This keeps values fresh for MQTT/Home Assistant. [Elektroda, p.kaczmarek2, post #20704133]

My gas/heat alarm logic is inverted. How do I fix it for Home Assistant?

Update to firmware v1.17.226 or later, then set the channel type to Toggle_Inv for those dpIDs. This inverts the reported state so “OFF means normal,” avoiding false alarms in Home Assistant. Set with: setChannelType Toggle_Inv. [Elektroda, p.kaczmarek2, post #20704799]

Do I need the tmSensor driver for this Tuya gas sensor?

No. tmSensor is intended for battery-powered TuyaMCU sensors, such as door or temp/humidity sensors. For a mains-powered gas sensor, you can omit tmSensor. Keep TuyaMCU (and NTP if needed) only. [Elektroda, p.kaczmarek2, post #20706411]

How do I set the heat alarm threshold via TuyaMCU?

Send a state update to the dpID that controls the setpoint. Example from the thread: tuyaMcu_sendState 101 2 55 to set 55°C. Confirm the dpID from logs before writing. This enables device-side alarm thresholds without cloud access. [Elektroda, tellblom, post #20706372]

How do I keep the device’s clock correct on the display?

Run the NTP driver, set your timezone offset, push time to the MCU, and refresh hourly. Example: startDriver NTP; ntp_timeZoneOfs 02:00; tuyaMcu_sendCurTime; addRepeatingEvent 3600 -1 tuyaMcu_sendCurTime. That 3600-second sync stabilizes on-device time. [Elektroda, tellblom, post #20706372]

Do I need a USB-to-TTL adapter to get sensor values?

Usually no. When you set TuyaMCU WiFi state to 0x04 or connect MQTT, the MCU should send dpIDs automatically. If needed, add a repeating tuyaMcu_sendQueryState. Use USB‑TTL only for low-level UART troubleshooting. [Elektroda, p.kaczmarek2, post #20704133]

What baud rate did this gas sensor use?

It worked at 9600 bps. Communication failed at other rates during testing. If your device differs, confirm via Tuya config extraction and logs. [Elektroda, tellblom, post #20703239]

Where can I download firmware 1.17.226?

Get it from the OpenBK7231T_App repository on GitHub. The developer announced 1.17.226 availability there; update before using Toggle_Inv. [Elektroda, p.kaczmarek2, post #20704899]

Why do values seem to reset after a few minutes?

Some devices stop pushing updates passively, causing values to appear stale after about two minutes. Schedule periodic queries to maintain fresh states. Example: addRepeatingEvent 20 -1 tuyaMcu_sendQueryState for 20‑second refreshes. [Elektroda, tellblom, post #20704090]
Generated by the language model.
ADVERTISEMENT