logo elektroda
logo elektroda
X
logo elektroda

BK7231N Switches with OpenBK in HA Turning On at 3 AM - Firmware Issue?

4139ggn 2517 35
ADVERTISEMENT
  • #1 20895546
    4139ggn
    Level 5  

    Hello!
    For months, I have had several switches with BK7231N and OpenBK in their latest versions integrated into HA. Always updated via OTA once a month or so.
    The problem is that for some time, some lights have been turning on when waking up.
    They are set to remember their last state upon reboot. And I have noticed that they always turn on at approximately the same time, 03:00 am.
    Could someone tell me what could be happening?
  • ADVERTISEMENT
  • #2 20896313
    p.kaczmarek2
    Moderator Smart Home
    That's a very strange issue. Do they also reboot at that 03:00 AM?

    Do they also turn on when you disconnect them from MQTT (clear IP, username, password and client name of your HA)?
    Helpful post? Buy me a coffee.
  • #3 20897585
    4139ggn
    Level 5  

    I haven't tried leaving it disconnected from MQTT.
    But tonight, again. This is the record he leaves in HA.

    Graph showing on and off cycles of the living room light. Event logs for living room light with date and time of turning on and off.
  • #5 20897656
    4139ggn
    Level 5  
    is at -1. May it maintain its status
  • ADVERTISEMENT
  • #6 20897704
    p.kaczmarek2
    Moderator Smart Home
    What is -1? It seems that you have misunderstood me.

    I have asked about OBK uptime, the one that can be read here:
    Screenshot of a user interface showing device information.
    Helpful post? Buy me a coffee.
  • #7 20898164
    4139ggn
    Level 5  
    Okay! Today that I added another device, I realized that this particular one (the one that turns on by itself), when it restarts, turns on.
    I do not understand why...
  • #8 20898234
    p.kaczmarek2
    Moderator Smart Home
    You can configure your device to either keep state after restart, or to always set high value after restart, or to set low value after restart. You can also do the same manually in autoexec.bat by executing channel-related commands there.

    So, tell me, does the device reboot at that 3AM? You can tell that by looking at the device uptime.
    Helpful post? Buy me a coffee.
  • #9 20899305
    4139ggn
    Level 5  

    Today, again.
    Now I have looked at the connection time:
    "Online for 16 hours, 38 minutes, and 8 seconds"
    From what I understand, there has been no reboot....
  • #10 20901913
    4139ggn
    Level 5  

    Hello! I've been reviewing the history of Home Assistant. And from what I see, every day around 03:01:00 it does this cycle:
    "It became Unavailable"
    "It is turned off"
    "It's on"

    So it stays on all night...
  • ADVERTISEMENT
  • #11 20901925
    p.kaczmarek2
    Moderator Smart Home
    Maybe you have your router scheduled to reboot at 3AM?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #12 20902319
    4139ggn
    Level 5  

    I have been able to verify that there are MQTT devices that reboot every night and others do not.
    I have to find out why.
    Anyway, why doesn't it save its status like the others?
  • #13 20902352
    p.kaczmarek2
    Moderator Smart Home
    You can set OBK device to remember it's last state. It's possible to configure it in the Configure Startup menu.
    Helpful post? Buy me a coffee.
  • #14 20902458
    4139ggn
    Level 5  
    This is how I have it configured...
    The same thing has happened to me with some other lamp with OpenBK. But every time I update it, it has disappeared...
    But this time no matter how much I update, nothing

    User interface for configuring device channels.
  • #15 20904882
    4139ggn
    Level 5  
    This night there were two lights that turned on. And they have waited a little longer, until 04:00:00.
    Both devices run OpenBk. And I have found that they have been connected for more than two days.
    That is, they have not been restarted...
    Any ideas?
  • #16 20904909
    p.kaczmarek2
    Moderator Smart Home
    As I said, disable MQTT and check if they still turn on.

    If only MQTT devices reboot, then check your Home Assistant uptime and Home Assistant logs, I don't think that OBK device can turn itself on its own, I think HA must be sending something.

    You can also post device config here. Which drivers you have enabled? Anything like DGR, Wemo? Still, you said it does not happen without MQTT, right?
    Helpful post? Buy me a coffee.
  • #17 20905085
    4139ggn
    Level 5  

    No, that is connected to MQTT.
    Tonight I'll disable "mosquitto" to see what happens.
    But I checked again and it seems that something happens between 3 and 4 at night.
    Many devices become unknown and reconnect a few seconds later. I don't know if it's some kind of glitch that does "something" and throws everything away for a few seconds.
    Mosquitto perhaps?
  • #18 20922408
    4139ggn
    Level 5  

    Hello, good!
    Well, I updated to version 1.17.405 and that power-up disappeared at 03:00.
    But... This morning when I woke up, I had another switch on!
    I have reviewed it, and I want to remember that it was at version 1.0.0, so I have updated it to the latest (1.17.442).

    What happened? It is true that this one had already done it once. But since the last time I updated it, it stopped doing that.
    Why did it do it again today? Why at 03:00?

    In the image, it looks like three different lights (03:00, 04:00, and 05:00). We were all asleep at home.

    Chart showing switch activity from 18:00 to 10:00 with highlighted periods of being on between 3:00 and 8:00.
  • #19 20924127
    4139ggn
    Level 5  

    Today when I woke up, I had two switches on!
    I have updated again to the latest version (1.17.424).
    I have discovered that when the switch is reset, it starts with the switch on!

    I don't understand what's wrong...

    Screenshot of start value settings for channels with the option to remember the last state.
  • #20 20924149
    p.kaczmarek2
    Moderator Smart Home
    Can you setup a clear instance of Home Assistant and check if it also restarts then?

    Added after 47 [seconds]:

    4139ggn wrote:

    I have discovered that when the switch is reset, it starts with the switch on!
    Screenshot of start value settings for channels with the option to remember the last state.

    You have set it to "remember last state"..
    Helpful post? Buy me a coffee.
  • #21 20924406
    4139ggn
    Level 5  
    p.kaczmarek2 wrote:
    Can you setup a clear instance of Home Assistant and check if it also restarts then?

    I do not know what you mean

    p.kaczmarek2 wrote:
    You have set it to "remember last state"..

    Yes, if it is off, let it be off and the other way around. But if I restart it, it turns on!
  • #22 20939156
    4139ggn
    Level 5  
    Today without any update two switches have turned on.
    I have updated them again to the latest version. And when it reboots with the update, they turn on again.
    I have looked at the OpenBK registry and what catches my attention is what is marked in bold. I don't know why the state changes when it restarts.


    Quote:
    Info:MAIN:Time 12, idle 252346/s, free 73344, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 3/38
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to Interruptor barra/+/set
    Info:MQTT:mqtt_subscribed to cmnd/Interruptor barra/+
    Info:MQTT:mqtt_subscribed to Interruptor barra/+/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic Interruptor barra/0/set
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 1 for ch 0
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    Info:MQTT:Channel has changed! Publishing 1 to channel 0
    Info:MQTT:Publishing val 1 to Interruptor barra/0/get retain=0
    Info:CFG:####### Flash Save Channel 0 as 1 #######

    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic Interruptor barra/0/get
    Info:MAIN:Time 13, idle 236018/s, free 85048, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Time 14, idle 256572/s, free 85048, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Time 15, idle 252747/s, free 85048, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Time 16, idle 258704/s, free 85048, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MQTT:Channel has changed! Publishing 0 to channel 0
    Info:MQTT:Publishing val 0 to Interruptor barra/0/get retain=0
    Info:CFG:####### Flash Save Channel 0 as 0 #######
  • #23 20939162
    p.kaczmarek2
    Moderator Smart Home
    This is a very big progress, @4139ggn ! But you haven't marked enough on your log dump.

    Here, look:
    Screenshot of a log with a highlighted section in a red box.
    The fragment in red frame indicates that your HA sends value 1 to OBK just when OBK connects to it.

    Now, the question is, why HA sends it?

    I am not sure if I have asked about it already, but have you tried to enable "retain" on a device, in flags settings? Maybe it can help as a work around.
    Helpful post? Buy me a coffee.
  • #24 20939175
    4139ggn
    Level 5  

    Where should I look at this, what do you say about retaining?
    In the configuration.yaml the configuration is this:

    Quote:
    - unique_id: "Interruptor barra"
    state_topic: "Interruptor barra/0/get"
    name: "Interruptor barra"
    command_topic: "Interruptor barra/0/set"
    qos: 1
    payload_on: 1
    payload_off: 0
    retain: false
    availability:
    - topic: "Interruptor barra/connected"

  • #25 20939224
    p.kaczmarek2
    Moderator Smart Home
    Wait, so you're not using automatic hass discovery? You can try to set retain to true, instead of false.
    Helpful post? Buy me a coffee.
  • #26 20939306
    4139ggn
    Level 5  

    I have switched to automatic detection of Home Assistant.
    I have also made sure to have Flags enabled:
    "Flag 21 - [MQTT] Retain power channels (Relay channels, etc)"
    I restart the device and it turns on.
    I have tried restarting Mosquitto. And it also lights up!
  • #27 21092693
    Nakano
    Level 10  

    Hello, have you managed to solve the problem?
    I have a similar situation, only it is not about the lights, but about the gate. Every call after losing the connection to the MQTT triggers the switches (2ch) and opens or closes the gate.
  • #28 21097124
    jtauscher87
    Level 5  

    I have the same problem, I have two Bekens with identical config/flags etc and still, one is turning on after reboot or wifi loss, whereas the other device works like a charm. Retain true/false doesn't make any difference. As soon as it connects to HASS MQTT broker the device turns on.

    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 1 for ch 0
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    Info:MQTT:Channel has changed! Publishing 1 to channel 0 
    Info:MQTT:Publishing val (303 bytes) to tele/GarageLicht/STATE retain=0
    Info:MQTT:Publishing val 1 to GarageLicht/0/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic tele/GarageLicht/STATE
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic GarageLicht/0/get
    Info:MQTT:Publishing val (303 bytes) to stat/GarageLicht/RESULT retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic GarageLicht/0/set
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 1 for ch 0
    Info:GEN:No change in channel 0 (still set to 1) - ignoring

  • #29 21097127
    p.kaczmarek2
    Moderator Smart Home
    Well this clearly means that your Home Assistant send value 1, doesn't it?
    
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 1 for ch 0
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    

    How is it configured in HA?
    Helpful post? Buy me a coffee.
  • #30 21097137
    jtauscher87
    Level 5  

    Its configured as suggested. Retain true/false doesn't make any difference. Its clearly a mosquitto fault but i have no clue why one bekens works fine and one doesn't.

    # GarageLicht:
    - unique_id: "GarageLicht_relay_0"
    name: "GarageLicht 0"
    state_topic: "GarageLicht/0/get"
    command_topic: "GarageLicht/0/set"
    qos: 1
    payload_on: 1
    payload_off: 0
    retain: true
    availability:
    - topic: "GarageLicht/connected"

Topic summary

The discussion revolves around the issue of BK7231N switches running OpenBK in Home Assistant (HA) that unexpectedly turn on at approximately 3 AM. Users report that the switches are configured to remember their last state upon reboot, yet they activate without user intervention. Various troubleshooting steps are suggested, including checking MQTT connections, device uptime, and Home Assistant logs. Some users find that disabling MQTT resolves the issue, while others discover that the problem persists despite configurations to retain the last state. A common theme is the need to ensure proper integration with Home Assistant, with some users resolving their issues by enabling automatic detection and removing manual configurations from configuration.yaml. The discussion highlights the complexity of MQTT interactions and the importance of device settings in preventing unintended activations.
Summary generated by the language model.
ADVERTISEMENT