Github Devices Community Docs Blog

Reset OMG devices

Is it somehow possibe to reset OMG device. Maybe over MQTT or by adding a reset button?

Do you refer beside pressing the physical button the boards (various ESP8266/Arduino flavors) usually have?

If wanting to reset an unresponsive board then you have basically two options:

  • add software instructions to reboot the board case it is not reachable (ie. by periodically testing MQTT broker connection); but if the required process for monitoring crashed too, it won’t be able to reboot;
  • restart the external power source (ie. by using a smart plug); this one will require external intervention (something like: HA monitors the LWT topic for the board and then turns the smart plug off and on again); I use something like this with ESP32 for MiFlora monitoring as I cannot get the damn board to stay online for more than several hours a day (in fact the issue is probably in the firmware not middleware like OMG as none of the other projects I tried with can keep it working for more than several days; once the board losses Wifi connection, it is able to reconnect the first 2 - 3 times for about 2-3 hours, however subsequent tries end up in failure); by restarting the 220 V plug the ESP32 comes online again.

Sry, I wasn’t concrete enough. I didn’t meant to simple restart the device.

I meant reseting to defaults. So deleting wifi and mqtt settings.

very interesting. See my other thread here. So I’m not alone. Could you join the conversation over there?

I see.

MQTT settings get reset each time a new sketch is uploaded; however, for Wifi settings I think that “Erase flash -> All flash contents” option in Arduino IDE Tools needs to be selected when uploading a new sketch as the credentials are written in a protected area (to allow the board connect to same Wifi even after uploading a different sketch). I cannot advise on Platform.io settings. Maybe @1technophile can update on this.

I kind of gave up on the goal to have the MiFlora readings online all the time. It is sufficient that it reads the settings several times per day (and then HA issues a restart for the plug) as I’m no horticulturist :smile:

@1technophile it would be great being able to rest the device to factory defaults somehow.

When we first set up the device with WiFi Manager there is an option to erase WiFi settings.
Would it be possible to add this somehow in a already configured device (maybe with publishing a message in a certain „reset2factory“ topic.

Would it be better by an mqtt command or a reset button long press ?

Well maybe it would be best to have both options.

So physical with a hardware button and via software (mqtt).

Hello everyone! o)

I’m in the same boat and probably spoiled by how Tasmota does things, but pls don’t hate me for that! o)

I flashed OMG onto a Sonoff RF Bridge, tested some things and reassembled its case. Then I wanted to change settings and started to dig through all the OMG docs/pages to find something on how to get OMG back to AP mode (at least, if there is no other way to change specific items like the mqtt credentials).

I was expecting the web interface to work as well once the settings have been made.
To my surprise this does not seem to be the case, so if there is a way to re-set settings easily in the future, this would surely be very more convenient. o)

I’m not into PlattformIO and compiling source on my own yet, I simply downloaded the binary and flashed it. Not being able to change settings afterwards now probably means I need to disable my Wifi at home (which is undesirable) or dissamble the RF bridge, toggle the switch on the bridge pcb, connect to computer again and eventually learn PlattformIO. o)

In any way, thanks for doing OMG! o)
I registered here because I think I will post some more! So see you! o)

1 Like

Hello,

No problem :slight_smile:

I understand this is not convenient, we will do something for the next release

1 Like

I have add this functionnality here for tests:

For ESP8266 the button must be connected to D5, for ESP32 you can use the BOOT button.
Regarding the ESP8266 you can also use flash button if you set TRIGGER_PIN 0 of user_config.h . In this case you should not use GPIO0 D3 for other usage like RF receiver.

The button must be pressed (at LOW) during more than 10s and it will trigger a settings erase + an ESP reset.

1 Like

Will test it. BTW could you please change your text above from

to TRIGGER_PIN (as it is used in the code).

Of course, thanks for the remark

1 Like

I tried the new reset options with ESP32 and ESP8266.

ESP32 Boot-Button Reset worked perfectly.

ESP8266 (TriggerPin 0) worked ok with the Flash Button. It reseted fine. But I had to fill configure Wifi and MQTT two times and than plug out/in the device. After that i reconnected.

Anyway reset seems to work fine. Thanks!

You mean It didnt saved the credentials once entered into the portal?

Yes, seemed like it did not. It reopened the AP and than I reentered the settings.
Even after this it reopened a AP.
But after plugging out/in it was fine.

So probably it was fine after the first try, but it needed to be unplugged. This wasn’t needed for the ESP32

Maybe you can reproduce this.

I will try to reproduce it

I didn’t reproduced your exact behaviour but I have found that the erase method was not consistent. I’ve made some modifications.