logo elektroda
logo elektroda
X
logo elektroda

OpenBK7231N_1.17.224 firmware Change Module type and run TuyaMCU commands

tellblom 1128 16
ADVERTISEMENT
  • #1 20702133
    tellblom
    Level 3  

    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
    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.
  • ADVERTISEMENT
  • #3 20703239
    tellblom
    Level 3  

    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
    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  
    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
    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.
  • #7 20704090
    tellblom
    Level 3  

    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
    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  

    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
    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  

    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
    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  
    Thanks

    I'll try it out
  • Helpful post
    #14 20704899
    p.kaczmarek2
    Moderator Smart Home
    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  
    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
    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  
    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.
Summary generated by the language model.
ADVERTISEMENT