logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CB3S] Tuya Smart Air Box Air Quality Monitor, 5 sensors

lars4 2625 33
ADVERTISEMENT
  • #31 21595031
    p.kaczmarek2
    Moderator Smart Home
    Just like our docs says:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/README.md
    setChannel sets given channel to given value, so it will not affect P8 directly if you don't set P8 role and channel, you need to assign a channel to P8 and also set it to Relay (or Rel_n, or LED, or LED_n, etc), in this case, channel 8, but in reality it can be any channel ...
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 21595589
    io2345
    Level 8  
    >>21595031 Surprisingly enough: Not working. This is the autoexec.bat:

    tuyaMcu_defWiFiState 4
    tuyaMcu_setBaudRate 9600
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 18 val 1
    setChannelType 2 Humidity_div10
    linkTuyaMCUOutputToChannel 19 val 2
    setChannelType 3 Custom
    SetChannelLabel 3 CH2O mg/m^3
    linkTuyaMCUOutputToChannel 2 val 3
    setChannelType 4 Custom
    SetChannelLabel 4 VOC ppm
    linkTuyaMCUOutputToChannel 21 val 4
    setChannelType 5 Custom
    SetChannelLabel 5 CO2 ppm
    linkTuyaMCUOutputToChannel 22 val 5
    tuyaMcu_sendQueryState
    
    alias ALARM_ON setChannel 8 1
    alias ALARM_OFF setChannel 8 0
    again:
    
    delay_s 5
    if $CH1>265
    then ALARM_ON 
    else ALARM_OFF
    goto again
    

    Channel 8 (for IO 8) is set as LED, but doesn't change when the value of 265 is exceeded (more than 26,5°C) . When toggled manually from the Webpage, there is power on IO 8.

    Startup commands are:

    backlog startdriver tuyamcu
    PowerSave 1



    I tried using IO 20 instead of 8 and type relay instead of LED,without success.
  • ADVERTISEMENT
  • #33 21595612
    p.kaczmarek2
    Moderator Smart Home
    We do not have multiline if else syntax.
    Helpful post? Buy me a coffee.
  • #34 21595628
    io2345
    Level 8  
    >>21595612 Thank you for your fast response. Now it's working fine!

    For all others out there who are noobs like me: The autoexec.bat is now

    startDriver TuyaMCU
    tuyaMcu_defWiFiState 4
    tuyaMcu_setBaudRate 9600
    setChannelType 1 Temperature_div10
    linkTuyaMCUOutputToChannel 18 val 1
    setChannelType 2 Humidity_div10
    linkTuyaMCUOutputToChannel 19 val 2
    setChannelType 3 Custom
    SetChannelLabel 3 CH2O mg/m^3
    linkTuyaMCUOutputToChannel 2 val 3
    setChannelType 4 Custom
    SetChannelLabel 4 VOC ppm
    linkTuyaMCUOutputToChannel 21 val 4
    setChannelType 5 Custom
    SetChannelLabel 5 CO2 ppm
    linkTuyaMCUOutputToChannel 22 val 5
    tuyaMcu_sendQueryState
    alias ALARM_ON setChannel 8 1
    alias ALARM_OFF setChannel 8 0
    again:
    delay_s 10
    if $CH1>550||$CH2>800||$CH3>50||$CH4>50||$CH5>700 then ALARM_ON else ALARM_OFF
    goto again

Topic summary

The discussion addresses issues with reading sensor values from the Tuya Smart Air Box Air Quality Monitor (BK7231N/CB3S) after switching to OpenBeken firmware. The original firmware correctly outputs sensor data including CH2O, temperature, humidity, VOC, and CO2 via specific data points (DPIDs). Initial troubleshooting involved verifying baud rates (default 9600), module connection integrity, and driver configurations in autoexec.bat. The key solution was to send the command "tuyaMcu_sendQueryState" after startup to retrieve sensor values, as values do not appear automatically on reboot. The working autoexec.bat includes starting the TuyaMCU driver, setting WiFi state, baud rate, defining channel types and labels, linking DPIDs to channels, and issuing the query state command. Further discussion identified the temperature/humidity sensor as a DHT20 and the VOC sensor as an HGS1000 from Hefei Micro Nano Sensing Technology Co. Ltd (HMNST), which uses UART communication but lacks direct OpenBeken support. Suggestions included periodic sending of the query state command and enabling power-saving modes. An additional topic explored adding an alarm buzzer on GPIO P8 (Pin 13) triggered by threshold exceedances on sensor channels, implemented via autoexec.bat scripting with conditional loops and channel control commands. The conversation also referenced firmware backup sharing and device templates for integration.
Summary generated by the language model.
ADVERTISEMENT