logo elektroda
logo elektroda
X
logo elektroda

[MCU] MOES BHT-002 MCU Auto-Restart via CB3S GPIO and OpenBK Script for Hang Recovery

tomik67 192 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21183612
    tomik67
    Level 12  
    I have a MOES BHT-002 thermostat from a series affected by an unpleasant ailment, the MCU hanging up. I am not the only one as the series of faulty thermostats was quite large.
    Unfortunately, I don't yet have enough experience in using and writing scripts in OpenBK to create what I describe below, hence my plea to the experts for help.
    The hang-up manifests itself as a complete unresponsiveness of the thermostat, a reboot is needed which brings it back to life for a while, this happens completely irregularly, sometimes after two weeks and then the next day, there is no rule.
    At the same time, the CB3S module in the thermostat works without problems all the time.
    I have managed to technically prepare a manual reboot of the MCU itself by placing a MOSFET transistor as a ground cut from the microcontroller, I control it via GPIOP_8 in the CB3S set as Relay on channel 10 (toggle), and manually it works perfectly.
    I would like to automate this so that reboots are done independently when the MCU is found to be suspended.
    The only clear symptom showing the current state of the MCU is this report in the logs:.

    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=20
    .

    whereby with the suspension state TuyaMCU heartbeat_valid = 0 , wifi_state_valid = 0 and product_information_valid=0 have state 0, during normal operation 1.
    This is what an example log looks like in a suspended state every second...:

    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=5
    .

    Now the questions:
    1. is it possible to write a script for the OBK which, when receiving the suspend information a couple of times, would start/shut down the GPIOP_8 for 1 second, thus restarting the MCU ?
    or:
    2. is it possible to send the TuyaMCU heartbeat_valid status via MQTT to Home Assistant ?. There I would be able to run the automation restarting the MCU.
  • ADVERTISEMENT
  • #2 21185926
    p.kaczmarek2
    Moderator Smart Home
    You can publish heartbeat_valid when you modify the code:
    System online builds OpenBeken - firmware compilation for all platforms on Github .
    An example, untested modification that does this:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1307
    You have the binaries and a list of code changes to download there

    Added after 49 [seconds]:

    [MCU] MOES BHT-002 MCU Auto-Restart via CB3S GPIO and OpenBK Script for Hang Recovery .
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21191444
    tomik67
    Level 12  
    Thank you for your help, I will test the modified firmware.
    By the way, I'll ask if any expert is working out the WBR3 modules ?
    I have a couple of pieces for sale, soldered out of thermostats to replace with WB3S. I will give them away to be worked on.
  • ADVERTISEMENT
  • #4 21191445
    p.kaczmarek2
    Moderator Smart Home
    It's in the queue, we're now dealing with OPL1000: https://www.elektroda.com/rtvforum/topic4007556-30.html#21190897
    Helpful post? Buy me a coffee.
  • #5 21191450
    tomik67
    Level 12  
    p.kaczmarek2 wrote:
    It is in the queue


    OK. When it's his turn I'll ask for his address, I'll send without delay.
ADVERTISEMENT