logo elektroda
logo elektroda
X
logo elektroda

Home Assistant & OpenBeken: Ensuring Long-Term Device Discovery Stability

thespooler 963 8
ADVERTISEMENT
  • #1 21340936
    thespooler
    Level 2  
    What is the best practice for setting up Home Assistant with OpenBeken? My devices are discovered, but after about 7 days they appear as Unavailable in HA. They have static IPs. The OpenBeken web UI for each device says they are still connected to MQTT.

    Built on Aug 6 2024 10:00:18 version 1.17.652
    Online for 23 days, 8 hours, 44 minutes and 53 seconds

    Wifi RSSI: Good (-56dBm)
    Reboot reason: 0 - Pwr
    MQTT State: connected RES: 0(ERR_OK)
    MQTT ErrMsg:
    MQTT Stats:CONN: 136 PUB: 267 RECV: 360 ERR: 0

    I've done what the YouTube video (https://www.youtube.com/watch?v=pkcspey25V4) on this says to do, it works initially, but it's not long term. I've noticed in other posts here, they are suggesting Auto Discovery needs to continually run, which seems overkill.

    "OpenBeken Device must report its status (regularly) to HomeAssistant. I recommend setting it up with a special Startup command. This is done in the Change Startup command text. You should add “scheduleHADiscovery 10”"

    If this is necessary, and that does seem to be the case, as clicking "HomeAssistant Configuration"->"Start Home Assistant Discovery" button will fix my issue (the problem being, I had already clicked it days ago), why isn't this done automatically? I did not enter the YAML as HA is moving away from that, I'm just clicking the Discovery button.

    I have flag 27 set.

    HomeAssistant MQTT:

    Diagnostic
    Build Unavailable
    IP Unavailable
    RSSI Unavailable
    SSID Unavailable
    Temperature Unavailable
    Uptime Unavailable

    Click the "Start Home Assistant Discovery" button and it comes right back:

    Diagnostic
    Build Unknown
    IP 192.168.0.215
    RSSI -58 dBm
    SSID xxxxxxxxxx
    Temperature 39.93 °C
    Uptime 1717337 s
    AI: Could you please specify the version of Home Assistant you are currently using?
    2024.12.1
    AI: Can you provide details about your network setup, such as the router model and any specific network configurations that might be relevant?
    Asus router running Merlin, just normal WIFI.
  • ADVERTISEMENT
  • #2 21341863
    p.kaczmarek2
    Moderator Smart Home
    I think similiar question was asked recently, but let's start with basic check - do they become available once you run "publishAll" command?
    Helpful post? Buy me a coffee.
  • #3 21342799
    thespooler
    Level 2  
    Thanks for the response. Unfortunately, "publishAll" says "OK" but Home Assistant still shows "Unavailable" under MQTT for the device in question:

    Diagnostic
    Build Unavailable
    IP Unavailable
    RSSI Unavailable
    SSID Unavailable
    Temperature Unavailable
    Uptime Unavailable

    If I click one of the above it says "This entity is no longer being provided by the mqtt integration. If the entity is no longer in use, delete it in settings."
  • ADVERTISEMENT
  • #4 21342801
    DeDaMrAz
    Level 19  
    @thespooler

    There is a flag in OBK (flag 2) that will publish values every 60 seconds to HA for example and also flag 10 to publish on mqtt connect.

    You can also add to your autoexec waitFor MQTTstate 1 to be sure mqtt is connected before broadcasting.
  • ADVERTISEMENT
  • #5 21344397
    thespooler
    Level 2  
    Thank you, DeDaMrAz. For MQTT, I have had Flags 7 and 10 set for many months to no positive effect. I'll keep the other options in mind.

    My device that is currently working will likely disappear soon. Are there some logs somewhere I should be capturing for when this happens?
  • #6 21344402
    DeDaMrAz
    Level 19  
    You can check logs in HA for example and see what is going on there as a starting point. You can install a HA addon called MQTT explorer and check what is going on with published values there as well. Also device reboot (not HA but your device you are adding to HA) is a good starting point as well.

    You can also check/enable retain values flag.

    Btw, a good practice when changing flags and settings is to repeat HA discovery - so delete old device from HA first and then add it again.
  • #7 21362714
    thespooler
    Level 2  
    I have two identical devices that suffer from this problem. First one I tried "(flag 2) that will publish values every 60 seconds to HA" and the second one I tried "autoexec waitFor MQTTstate 1 to be sure mqtt is connected before broadcasting"

    They both disappeared from HA days later.

    I was ready to give up and go with "scheduleHADiscovery 10". But as I researched it further, I see I've misunderstood what this meant. I thought it was triggering Discovery every 10 seconds, so it would be like me pressing the Discovery button and bringing my device back, but that isn't what it means at all. So it won't solve my problem either.

    It was a lot of work to get these devices flashed, many many hours of tinkering and it looks like they're going in the garbage. Saving $10 over a Kasa or Tapo wasn't worth the dozens of hours lost to these.
  • #8 21362783
    p.kaczmarek2
    Moderator Smart Home
    Why not just use what you wanted? If you check our docs, you can find:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    addRepeatingEvent
    The same is literally in our autoexec examples:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Sample:
    
    // every 10 seconds, request update from TuyaMCU
    addRepeatingEvent 10 -1 tuyaMcu_sendQueryState
    
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 21372565
    thespooler
    Level 2  
    >>21362783

    Oh thank you! That would work, however I realized I was fighting this all wrong.

    The solution to my problem was obvious from the start. Continually triggering discovery just seems like a waste of cycles. I should have just given up on discovery entirely.

    I added the YAML, I just need it to work.

Topic summary

The discussion revolves around the integration of Home Assistant with OpenBeken devices, specifically addressing the issue of devices becoming "Unavailable" after a period of time despite being connected to MQTT. Users suggest various troubleshooting steps, including using the "publishAll" command, setting specific flags in OpenBeken to ensure regular status updates, and utilizing the "scheduleHADiscovery" command. Some users express frustration with the reliability of their devices and the complexity of maintaining connectivity, while others recommend checking logs in Home Assistant and using tools like MQTT Explorer to diagnose issues. The conversation highlights the importance of proper configuration and the potential need for continuous discovery or status updates to maintain device availability.
Summary generated by the language model.
ADVERTISEMENT