logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] Issues with Magnetic Sensor Not Working After Openbk Firmware Flash

calcu 1149 14
ADVERTISEMENT
  • #1 20884079
    calcu
    Level 5  
    Hi,

    Like i wrote in another post i purchased 2 parking door controllers.
    I was able to load Openbk firm finally to both of them.

    But now i have only 1 problem, the magnet sensor doesn't work.

    This is the TUYA config read with your tool from device (using webapp Download Tuya Gpio Config):

    
    {
    	"rl1_lv":"1",
    	"alarm1_time":"600",
    	"bt1_pin":"6",
    	"netled_lv":"0",
    	"door_alarm_st1":"12",
    	"switch1":"1",
    	"net_trig":"2",
    	"door_mag1":"3",
    	"jv":"1.0.0",
    	"bt1_type":"0",
    	"nety_led":"2",
    	"tracetime1":"4",
    	"alarm_t1":"5",
    	"voice_ctrl1":"6",
    	"netled_pin":"26",
    	"bt1_lv":"0",
    	"door1_magt_pin":"8",
    	"reset_t":"5",
    	"indep_cfgbt":"false",
    	"rl1_dr_type":"2",
    	"door1_magt_lv":"0",
    	"module":"CB2S",
    	"voice_ctrl_set1":"11",
    	"cntdown1":"2",
    	"ch_num":"1",
    	"rl1_pin":"7",
    	"trl1_time":"20",
    	"netn_led":"0",
    	"crc":"56",
    	"}@BAgw_di{abi":"0",
    	"id":"null",
    	"swv":"1.1.2",
    	"bv":"40.00",
    	"pv":"2.2",
    	"lpv":"3.4",
    	"pk":"key8tg9kykj4g8dw",
    	"firmk":"key8tg9kykj4g8dw",
    	"cadv":"1.0.5",
    	"cdv":"1.0.0",
    	"dev_swv":"1.1.2",
    	"s_id":"null",
    	"dtp":"0",
    	"sync":"0",
    	"attr_num":"1",
    	"mst_tp_0":"9",
    	"mst_ver_0":"1.1.2",
    	"mst_md5_0":"null",
    	"mst_tp_1":"0",
    	"mst_ver_1":"null",
    	"mst_md5_1":"null",
    	"mst_tp_2":"0",
    	"mst_ver_2":"null",
    	"mst_md5_2":"null",
    	"mst_tp_3":"0",
    	"mst_ver_3":"null",
    	"BAtimer_arr0uIAtls_ca_cnt0{lastFetchTime":"0",
    	"cnt":"0}0{abi",
    	"mst_md5_3":"null }[{trigger",
    	"type":"obj",
    	"mode":"rw",
    	"property":"{type",
    	"{type":"obj",
    	"max":"86400",
    	"scale":"0",
    	"step":"1",
    	"{trigger":"direct",
    	"lckey":"^tR0n)+4sIC3Avt>",
    	"h_url":"http",
    	"h_ip":"42.192.25.216",
    	"hs_url":"null",
    	"hs_ip":"null",
    	"hs_psk":"https",
    	"hs_psk_ip":"81.69.183.170",
    	"mqs_url":"null",
    	"mqs_ip":"null",
    	"mq_url":"m2.tuyacn.com",
    	"mq_ip":"121.5.97.151",
    	"ai_sp":"null",
    	"ai_sp_ip":"null",
    	"mq_psk":"m2.tuyacn.com",
    	"mq_psk_ip":"121.5.97.151",
    	"lp_url":"baal.tuyacn.com",
    	"lp_ip":"42.192.35.108",
    	"time_z":"+08",
    	"s_time_z":"[]",
    	"wx_app_id":"null",
    	"wx_uuid":"null",
    	"dy_tls_m":"0",
    	"cloud_cap":"1025",
    	"psk21_key":"null }{nc_tp",
    	"ssid":"VFAtTElOS19DMEVFIDIuNA==",
    	"passwd":"YWJzNTQzMjE=",
    	"md":"0",
    	"random":"0",
    	"wfb64":"1",
    	"stat":"2",
    	"token":"USAGKhwt",
    	"re gion":"AY",
    	"reg_key":"3mrC",
    	"dns_prio":"0 }2iAgw_wsm{nc_tp",
    	"region":"null",
    	"psk_key":"A5mXQX3X23GTtLlaE25oKix8asj3rBGTdRPO6",
    	"auth_key":"EOIgzgEy3pnF1JrCxYqmLAKA8S4PafwY",
    	"ap_ssid":"SmartLife",
    	"ap_passwd":"null",
    	"country_code":"null",
    	"bt_mac":"null",
    	"bt_hid":"null",
    	"prod_test":"false",
    	"fac_pin":"deyeioifmyvdalnc }{nc_tp",
    	"index":"0}#HAble_beaconkeyAFE938CD573E6503EA348BAA0EC8D770eAem_sys_envbk7231n{key"
    }
    


    I have updated the firm with Version: 1.17.382

    On Home assistant after a reboot, they seems to be fine:

    Screenshot of control panel displaying controls and sensor information.

    The relay (marked as 1) is working fine, but the magnet sensor (55) is not working at all

    Any help?

    This is what i'm finding at index from the device:

    Device configuration screen for ParkingE1 with active channel.
  • ADVERTISEMENT
  • #2 20884433
    p.kaczmarek2
    Moderator Smart Home
    Okay, let's start with your config, can you show your GPIO settings?
    Helpful post? Buy me a coffee.
  • #3 20884486
    calcu
    Level 5  
    Sure:
    This is the text description from Extract Config from Tuya binary:

    Device configuration, as extracted from Tuya: 
    - Button (channel 1) on P6
    - WiFi LED on P26
    - Door Sensor (channel 1) on P8
    - Relay (channel 1) on P7
    Device seems to be using CB2S module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424
    


    Attached the 2mgs backup file .
    This are the pins used:
    Screenshot of a device configuration with highlighted pins P6, P7, and P8, all set to High value. Screenshot of pin P26 configuration for a Tuya device.
    Attachments:
    • readResult_BK7231N_QIO_parking2_2023-30-12-21-28-44.bin (2 MB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #4 20884537
    calcu
    Level 5  

    I don't have any active driver, in the meantime I will play with TuyaMcu to see if I'm capable of doing something :-)
  • #5 20884652
    p.kaczmarek2
    Moderator Smart Home
    No, there is no TuyaMCU in this device.

    Okay, so P8 is a door sensor, right? Does the sensor react to closing the door and opening it? Or, to be precise, by moving the magnet to the hall sensor and moving it away? Or does it stay same all the time?
    Helpful post? Buy me a coffee.
  • #6 20884684
    calcu
    Level 5  

    In original form, it was reacting.

    Now no reaction at all, but I can't see displayed anywhere, nor it's not published to HA

    Screenshot of ParkingE1 interface showing status OFF.

    It seems it's sending the binary sensor, but it's not:

    Screenshot of MQTT connection logs showing configuration attempts and Home Assistant discovery.
  • #7 20884689
    p.kaczmarek2
    Moderator Smart Home
    Are you really sure that there is no change on P8?
    On this screenshot, P8 is high:
    Screenshot of a configuration panel with three ports P6, P7, P8 set to high values.
    On this screenshot, it's low:
    Screenshot of a control panel showing the Open status for channel 1.

    I will ask again - is the WWW panel showing "Open" all the time? Even if you "close the door"?

    If you are really sure that it's showing "Open" all the time, then you may consider changing dInput role to,, for example, dInput_noPullUp, etc, to check various pull up options.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #8 20884719
    calcu
    Level 5  

    This open reacts at Relay.

    The WWW panel doesn't show anything about the magnet status.

    And it was showing open because I played with commands at this post:

    https://www.elektroda.com/rtvforum/topic3936372.html#20300142

    I just reset everything and now:

    Control panel interface showing ON status.

    Only shows Toggle (relay) (pin7)

    Screenshot of the configuration panel with pin settings for P6, P7, and P8, all set to high.

    All 3 pins are high, if I change the relay value, all 3 changes to LOW, but together, it's like P8 and P7 were linked somehow.

    Added after 5 [minutes]:

    If I change P8 this way

    Screenshot of pin configuration for P6, P7, and P8 with settings and High values.

    When I use the magnet with this config, the relay is reacting, I mean, if I move the magnet to the hall sensor and moving it away the relay reacts and opens/closes.

    But I don't want that xD, I only want to show the status of the magnet sensor.
  • #9 20884735
    p.kaczmarek2
    Moderator Smart Home
    So you configured P8 correctly now. This means P8 should be dInput with no pull up (see role name).

    The values are linked because you assigned them all to channel 1.

    If you want to separate P8 from relay, change P8 channel to let's say, channel 2, and keep relay at channel 1.

    Then they will be split. Please try.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #10 20884753
    calcu
    Level 5  

    Ok, Finally!

    With this config:

    Control panel showing configuration of ports P6, P7, and P8 with high and low values.

    It's finally working!
  • #11 20884758
    p.kaczmarek2
    Moderator Smart Home
    That's good to hear, now... now, are you aware that you need to configure this sensor for power saving? Deep sleep usage?

    Otherwise battery will drain in one day...
    Helpful post? Buy me a coffee.
  • #12 20884880
    calcu
    Level 5  

    Well, no problem with that, it's powered at 220V.

    No battery at all.

    Thanks!
  • #13 20884926
    p.kaczmarek2
    Moderator Smart Home
    Ah, so you've made a modification, right? Some kind of DIY? Then please consider posting it as a DIY/guide here:
    https://www.elektroda.com/rtvforum/forum513.html
    We can also send you a free set of gadgets for submitting a DIY article, but keep in mind that for our gadget program you need to write at least some explanation, how was DIY made, why, how it works, provide photos, maybe demonstration, etc.

    Or.... by "parking" you mean a garage door controller? The one that works at 5V out of the box? Is it on our list here?
    https://openbekeniot.github.io/webapp/devicesList.html
    If it's not, then again, please provide some information, photos, etc, maybe info where it was bought, and your current config template from Web App, so we can add it to our list. Thanks.

    Our teardowns list is almost at 500 devices mark, we want to reach 500 entries soon.
    Helpful post? Buy me a coffee.
  • #15 20885075
    p.kaczmarek2
    Moderator Smart Home
    I haven't seen that model yet, so it may be interesting.
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion revolves around issues faced after flashing Openbk firmware on two parking door controllers, specifically regarding a non-functional magnetic sensor. The user provided a Tuya configuration, detailing GPIO settings and pin assignments. Initial troubleshooting involved verifying the sensor's response to magnet proximity, which was found to be unresponsive. After several exchanges, it was determined that the sensor was incorrectly configured, linking it to the relay channel. By reassigning the door sensor (P8) to a separate channel, the magnetic sensor began functioning correctly. The user confirmed that the device is powered by 220V, eliminating concerns about battery drain.
Generated by the language model.

FAQ

TL;DR: How do I fix a BK7231N garage controller whose magnetic sensor stopped after an OpenBK flash? Address channel linking and input-pull configuration; "Otherwise battery will drain in one day" if you run on batteries. [Elektroda, p.kaczmarek2, post #20884758]

Why it matters: Misconfigured roles/channels hide door status and can unintentionally toggle the relay, breaking automations and safety.

Quick Facts

How do I fix the magnetic sensor not working after flashing OpenBK?

Give the sensor its own channel and correct input role. 1) Set P8 Role to dInput_noPullUp. 2) Set P8 Channel to 2 while keeping Relay on Channel 1. 3) Save and reboot, then move the magnet to verify P8 toggles independently. This separates the door status from the relay action. [Elektroda, p.kaczmarek2, post #20884735]

Why do the relay (P7) and magnetic sensor (P8) change together?

They share the same channel. “The values are linked because you assigned them all to channel 1.” Change P8 to channel 2 and keep Relay on channel 1 to decouple states. Save, reboot, and recheck the web panel. [Elektroda, p.kaczmarek2, post #20884735]

Which GPIO pins map to which functions on this controller?

Extracted Tuya config shows: P6 Button (channel 1), P7 Relay (channel 1), P8 Door Sensor (channel 1), P26 WiFi LED. Device uses a Tuya CB2S module with BK7231N, so configure these in OpenBK roles accordingly before fine-tuning channels or pull settings. [Elektroda, calcu, post #20884486]

Do I need TuyaMCU on this BK7231N device?

No. “There is no TuyaMCU in this device.” Configure everything via OpenBK GPIO roles and channels. That’s why fixing roles and channels restores the door sensor without involving a secondary MCU. [Elektroda, p.kaczmarek2, post #20884652]

How can I confirm the hall/magnet sensor is changing the P8 state?

Open the OpenBK UI and watch P8 while moving the magnet to and from the sensor. You should see P8 flip between high and low states. “On this screenshot, P8 is high; on this screenshot, it’s low.” If not, revisit the role and channel. [Elektroda, p.kaczmarek2, post #20884689]

Why does the web UI only show a Toggle (relay) and not the door status?

If P8 lacks a proper dInput role and a separate channel, only the relay control appears. Assign P8 a digital input role and its own channel, then Save and reboot so the door status becomes visible as a separate entity. [Elektroda, calcu, post #20884719]

After setting dInput, the magnet still toggles the relay. What now?

You likely left P8 on the same channel as the relay. Change P8 to channel 2, keep the relay on channel 1, then Save and reboot. This prevents the sensor from triggering the relay directly. [Elektroda, p.kaczmarek2, post #20884735]

Which OpenBK firmware version was used in the reported case?

The OP updated to OpenBK Version 1.17.382. After a reboot, Home Assistant entities appeared, though the magnet needed role/channel fixes to function as desired. [Elektroda, calcu, post #20884079]

Do I need power saving if the controller is powered from 220V mains?

No. The OP runs it at 220V, with no battery installed. Power-saving tweaks like deep sleep are unnecessary in that mains-powered configuration. [Elektroda, calcu, post #20884880]

What happens if I skip deep sleep on a battery-powered build?

Your battery may drain quickly. “Otherwise battery will drain in one day.” If using batteries, configure deep sleep and wake strategies to extend life. [Elektroda, p.kaczmarek2, post #20884758]

Is this AliExpress garage-door controller already on the OpenBK devices list?

A moderator noted, “I haven’t seen that model yet,” suggesting it wasn’t listed at the time. Share details so the team can add it if still missing. [Elektroda, p.kaczmarek2, post #20885075]

How can I contribute a template/teardown and get recognized?

Post a DIY/guide with photos, explanation, and config so it can be added. “We can also send you a free set of gadgets for submitting a DIY article.” The teardowns list is almost at 500 devices, so contributions help. [Elektroda, p.kaczmarek2, post #20884926]

What’s an edge case where sensor status controls the relay unexpectedly?

If P8 is assigned to the same channel as the relay, magnet movement can toggle the relay. Separate channels to avoid this behavior and expose a clean status sensor for automations. [Elektroda, calcu, post #20884719]

If P8 still doesn’t change after setup, what should I try next?

Switch the input role variant to adjust pull configuration, such as dInput_noPullUp. Test again with the magnet while monitoring P8. This addresses sensors that require a specific pull setting to switch reliably. [Elektroda, p.kaczmarek2, post #20884689]
Generated by the language model.
ADVERTISEMENT