Elektroda.com
Elektroda.com
X

[BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)

dskw 519 6
  • #1
    dskw
    Level 2  
    Hello everyone!
    A reseller on Amazon delivered me a new set of devices when I tried to older some old ESP-based window/door sensors.
    They don't have a name or model printed anywhere, but I found a label on the board:
    JM-WFMC01-CB3S
    2021/06/15 V1.0


    [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)
    [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0) [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)

    The board does not have a Tuya MCU chip on it. The only other IC that I could find does not tell me anything through google:
    [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)

    Beside the sensor status the Tuya integration also provides battery charge information (0% - 100%) and the board has a button accessible on the back side. You have to detach the sensor from the mount to access it.


    So far I have managed to get it running using these pin configurations:
      "pins": {
        "8": "DoorSnsrWSleep_nPup;1",
        "24": "Btn;2",
        "26": "WifiLED_n;3"
      },


    And with the following startup arguments:
    addEventHandler OnHold 24 DSTime 2400
    DSTime 5
    DSEdge 0


    Flags used:
    Flag 10 - [MQTT] Broadcast self state on MQTT connect
    Flag 37 - [WiFi] Quick connect to WiFi on reboot (TODO: check if it works for you and report on github)



    So far it works as intended. The sensor updates the state in Homeassistant correctly.
    Deepsleep also works and wakes up on a change. The LED is showing Wifi status and the button works for extending deepsleep for debugging uses.

    Some issues remain though:

    Update time is ~18 seconds from sensor change to entering deep sleep.
    (fast boot flag and static IP make no difference)
    The original firmware managed to do an update in ~1 second.

    I was unable to find a way to read the battery charge. Tuya is able to tell in percent how much charge is left in the batteries, but I cannot find any pin with usable data. ADC is always 0.00 and I don't see any specific IC that would provide the information via 1-wire or similar.
    Except for the one labeled MG2 L2AA, but I could not find any information about this online.

    With 18 seconds update time battery life will be sub-optimal.
    I have 5 of these sensors and would very much like getting rid of the original firmware as the Tuya Homeassistant integration is getting more and more unstable.

    Any help would be appreciated!
  • #2
    p.kaczmarek2
    Moderator Smart Home
    Hello, do you have a 2MB dump for analysis? Maybe I could find something ADC there.
    Here's a ADC battery driver tutorial:
    https://www.elektroda.com/rtvforum/topic3959103.html
    Regarding battery thing - how fast does your device get to MQTT?
    Open Web App log, let device go to sleep, clear log, wake it up, and paste log here. It will have timestamps.
    (Maybe also remove your SSID/pass from that).

    Btw, does your MAC ends with 00 00 00? It may indicate corrupted RF partition and partially refresh so long, 18 seconds, time. It should be 9 seconds or so, I had OBK devices connecting to MQTT in 5 or so seconds.
  • #3
    dskw
    Level 2  
    I hope you meant the "Time:" entry with timestamp, because that's the only thing I got in the logs.
    I changed the deep sleep timer to 30 seconds for further testing, but it looks like it fails to connect at the beginning and only succeeds on the second try.
    The MAC address seems ok to me:

    Info:MAIN:Main_Init_Before_Delay
    Info:CFG:####### Boot Count 250 #######
    Warn:CFG:CFG_InitAndLoad: Correct config has been loaded with 328 changes count.
    Error:CMD:no file early.bat err -2
    Info:MAIN:Started DoorSensor.
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Info:MAIN:Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:ssid:****** key:******
    Info:MAIN:Using SSID [******]
    Info:MAIN:Using Pass [******]
    Info:MQTT:MQTT_RegisterCallback called for bT window1/ subT window1/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT sensor/ subT sensor/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/window1/ subT cmnd/window1/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/sensor/ subT cmnd/sensor/+
    Info:MQTT:MQTT_RegisterCallback called for bT window1/ subT window1/+/get
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:MAIN:Main_Init_After_Delay done
    Info:EVENT:CMD_AddEventHandler: added OnHold with cmd DSTime 2400
    Info:MAIN:Time 1, idle 287690/s, free 72704, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 2, idle 185563/s, free 71064, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 3, idle 69270/s, free 70104, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Boot complete time reached (2 seconds)
    Info:CFG:####### Set Boot Complete #######
    Info:MAIN:Time 4, idle 0/s, free 70104, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 5, idle 0/s, free 70104, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 6, idle 114499/s, free 69512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_DISCONNECTED - 2
    Info:MAIN:Time 7, idle 300676/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 8, idle 188760/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 9, idle 188972/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 10, idle 188915/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=a0:92:08:4c:8f:04
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:Time 11, idle 186380/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 12, idle 188995/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 13, idle 187805/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 14, idle 188882/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 15, idle 185990/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_AUTH_FAILED - 3
    Info:MAIN:Time 16, idle 182554/s, free 70816, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 17, idle 186523/s, free 70816, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 18, idle 184093/s, free 68888, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MQTT:mqtt_userName ******
    mqtt_pass ******
    mqtt_clientID window1
    mqtt_host homeassistant:1883
    Info:MAIN:Time 19, idle 170155/s, free 71240, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to window1/+/set
    Info:MQTT:mqtt_subscribed to sensor/+/set
    Info:MQTT:mqtt_subscribed to cmnd/window1/+
    Info:MQTT:mqtt_subscribed to cmnd/sensor/+
    Info:MQTT:mqtt_subscribed to window1/+/get
    Info:MQTT:Publishing val window1 to window1/host retain=0
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 20, idle 183320/s, free 71040, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.23.164 gate=192.168.23.1 mask=255.255.255.0 mac=a0:92:08:4c:8f:04
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-55,ssid=skynet,bssid=74:42:7f:ba:69:ce,channel=11,cipher_type:CCMP
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val Build on May 16 2023 19:54:07 version 1.17.115 to window1/build retain=0
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 21, idle 180144/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val a0:92:08:4c:8f:04 to window1/mac retain=0
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 22, idle 183420/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val skynet to window1/ssid retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 23, idle 184995/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val 2 to window1/sockets retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 24, idle 184303/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val -54 to window1/rssi retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 25, idle 184157/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val 25 to window1/uptime retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 26, idle 184597/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val 71280 to window1/freeheap retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 27, idle 178039/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Publishing val 192.168.23.164 to window1/ip retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 28, idle 180666/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 29, idle 186093/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 30, idle 185890/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.23.164 gate=192.168.23.1 mask=255.255.255.0 mac=a0:92:08:4c:8f:04
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-54,ssid=skynet,bssid=74:42:7f:ba:69:ce,channel=11,cipher_type:CCMP
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 31, idle 178948/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 32, idle 191849/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 33, idle 183760/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 34, idle 188929/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 35, idle 184855/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 1 
    Info:MQTT:Publishing val 0 to window1/1/get retain=0
    Info:MAIN:Time 36, idle 185160/s, free 71280, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic window1/1/get
    


    About the dump:
    Do you need the 2MB Dump from the OpenBeken webinterface, or would you need some dump of the original firmware? That could be done if you can give me some advice or tutorial link. The other 4 devices are still untouched.

    I have seen those battery tutorial posts, but the ADC pin only returns "0" regardless of the charge of the inserted battery.
  • #4
    p.kaczmarek2
    Moderator Smart Home
    This is totally new to me:
    
    
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 6, idle 114499/s, free 69512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_DISCONNECTED - 2
    Info:MAIN:Time 7, idle 300676/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 8, idle 188760/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 9, idle 188972/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 10, idle 188915/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=a0:92:08:4c:8f:04
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:Time 11, idle 186380/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 12, idle 188995/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 13, idle 187805/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 14, idle 188882/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 15, idle 185990/s, free 71512, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_AUTH_FAILED - 3
    Info:MAIN:Time 16, idle 182554/s, free 70816, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 17, idle 186523/s, free 70816, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 18, idle 184093/s, free 68888, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    

    Here's how it looks like on my side (also on BK7231N):
    
    Info:MAIN:Main_Init_Before_Delay
    Info:CFG:####### Boot Count 44 #######
    Warn:CFG:CFG_InitAndLoad: Correct config has been loaded with 23 changes count.
    Error:CMD:no file early.bat err -2
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Info:MAIN:Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:ssid:qqqqqqqqqqqqqq key:qqqqqqqqqqq
    Info:MAIN:Using SSID [qqqqqqqqqqqqq]
    Info:MAIN:Using Pass [qqqqqqqqqqqqq]
    Info:MQTT:MQTT_RegisterCallback called for bT obk174083A4/ subT obk174083A4/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/obk174083A4/ subT cmnd/obk174083A4/+
    Info:MQTT:MQTT_RegisterCallback called for bT obk174083A4/ subT obk174083A4/+/get
    Info:CMD:LFS_ReadFile: failed to file autoexec.bat
    Info:CMD:CMD_StartScript: failed to get file autoexec.bat
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Time 1, idle 274343/s, free 72424, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 2, idle 186757/s, free 72424, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 3, idle 71717/s, free 72528, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 4, idle 0/s, free 72528, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 5, idle 0/s, free 72528, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MQTT:mqtt_userName homeassistant
    mqtt_pass qqqqqqqqqqqqqqqqqqqqq
    mqtt_clientID obk174083A4
    mqtt_host 192.168.0.113:1883
    Info:MAIN:Time 6, idle 104776/s, free 72744, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    

    See? 5 seconds to get WiFi in this case.

    The "Tuya config dump" from Web Panel->Flash can be enough, although 2MB taken via UART by this tool is also ok:
    https://github.com/openshwprojects/BK7231GUIFlashTool

    The full 2MB dump via Web Panel is not needed and not implemented.

    Do you get that connect problem on all OBK devices?
  • #5
    dskw
    Level 2  
    Looks like the 2MB dump is implemented in the webui, not sure if it gets corrupted with multiple retries. I've attached it just in case.

    For the UART dump I'll have to dig out my flasher and hook everything up. I will try this on the weekend and give an update.
    I have some Nous1 smart sockets with latest OpenBeken. I did notice they take a long time for the initial connection, but have not checked the log. It could be they have the same issue. I'll have a look for that as well, good idea.

    I could also try to hook up one of those devices to a different AP, to see if my network/wifi setup is causing this initial rejection/failure. Not sure how that could be though
  • #6
    p.kaczmarek2
    Moderator Smart Home
    The Tuya Config dump is good.
    [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)
    Here's content:
    Code: json
    Log in, to see the code

    It looks like this device supports ADC check of battery, for example here are voltage ranges:
    Code: json
    Log in, to see the code

    Did you made sure to enable correct transistor (gpio) before doing ADC voltage check? Please refer to the linked Battery driver topic, but basically, battery voltage divider is only enabled via transistor.

    Is it your only OBK device? Do other devices also have that problem with connection to WiFi? Please try with another one (or router), if you can. I don't know what's the source of the problem yet.
  • #7
    dskw
    Level 2  
    Alright, I had some more time to test this out.
    I got the battery reading working thanks to your advice!
    [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)
    Compared to the readout of my multimeter I get fitting values to the state of different battery packs.
    (changed to a max of 2800 since I'm using rechargeables with lower voltage)
    Battery_Setup 2200 2800 2.02 2400 4096
    Battery_Cycle 4

    [BK7231N / CB3S] Another Door/Window sensor without TuyaMCU (JM-WFMC01-CB3S V1.0)

    Regarding the Wifi issue:
    I do have some sockets with OBK as mentioned. I've checked with one of them and you were right, the same issue is visible there too:
    The first Wifi connection fails and it needs a second try:
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 11, idle 102809/s, free 70232, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_DISCONNECTED - 2
    Info:MAIN:Time 12, idle 188533/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 13, idle 189672/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 14, idle 190377/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 15, idle 189116/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 16, idle 190716/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 17, idle 190319/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 18, idle 190132/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 19, idle 197643/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 20, idle 387872/s, free 72320, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=cc:8c:bf:63:e1:5b 
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_AUTH_FAILED - 3
    Info:MAIN:Time 21, idle 183813/s, free 71624, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 22, idle 187056/s, free 70840, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 23, idle 184798/s, free 69600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Time 25, idle 189854/s, free 72232, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:mqtt_userName *****
    mqtt_pass *****
    mqtt_clientID nous2
    mqtt_host homeassistant:1883


    I do not have the issue using the wifi hotspot on my phone! There it connects in 6 seconds like your device.

    Now I'm wondering, what could be causing this in my network?
    None other device showed such issues yet and the original firmware also does not have the problem.
    My EspHome and Tasmota devices also manage to connect on the first try.

    It's a very standard setup using an AVM Fritzbox with WPA2, static IP configured on the Router and no repeaters involved.