Power failure caused all TASMOTA devices to reset to default settings

I was on vacation this past week, and my home area had a power failure. Internet came back up, and I could reach my router from the internet, but my Home Assistant instance did not come back up. This isn’t entirely abnormal for my setup. Here’s the weird part.

When I got home, I found that all my tasmota devices (NodeMCUs, Kuled switches, Sonoff Basics, and Geeklink IR blasters) had all been reset to their default settings. Noneof them even remembered my wifi information.Luckily, I had everything set to use the wifi manager, so although it was tedious, I could connect to each one’s access point and configure them again.

Why might this have happened? My neighbours said the power was off for about 3 hours. I’ve had longer outages before, and nothing has happened to my devices. Has anyone worked out a periodic backup stragegy for TASMOTA configuration? I’m thinking it should be based on the MAC address of the device because when the power came back, they were all configured as Sonoff Basics! I couldn’t tell which was which easily at first.

I don’t know about the backup solution other than that, you can do it manually.
But, as for the reset, I heard something, once the power will flick frequently on and off, it can cause a tasmota device to reset itself.

Did you use SaveData:“OFF” ?

Even when this never happend to me - i do have backups of my config :wink:

  • get a binary for your OS tasmota decode-config
  • write simple script like this (this is 4 Winblows): and my Tasmotas have static IPS from 192.168.199.21 to 192.168.199.45 you need to change that to your setup and run it (best before upgrading or after changes to the devices)
cd /d D:\sonoff\backup

for /l %%a in (21,1,45) do (
	@ping -n 1 192.168.199.%%a |findstr "TTL" && (
		..\decode-config_x64.exe -d 192.168.199.%%a --backup-file Config-@f --backup-type json)
	)

I’ve never touched the ‘savedata’ attribute. It’s at 1, which is the default. Never had a problem like this before.

I’m going to implement a script similar to that. I found decide-config earlier today while looking for solutions, and I already collect statistics on all my tasmota devices which includes their IP addresses and MAC addresses. I’ll probably even automate it with home assistant :slight_smile:

Isn’t this a question for Tasmota support?

You can write a script that executes the backlog command to set the Sonoff up again - I have these for my various devices. Then once you have WiFi working on it again you can push the settings via the console or use the script if MQTT is also configured.

Probably. But I just thought to ask it here first.

I think the backup/restore solution is superior in my case, because in that case you don’t even have to set the wireless network settings. Just connect to the ad-hoc AP that a default TASMOTA instance puts up, and run the restore.

I do have a couple of lengthy backlog commands that I regularly run when provisioning new TASMOTA devices though.

The script is for which OS?

It’s going to be run by Home Assistant, so probably bash or python for Linux

hmm
didnt sound like a great idea…

Remember when ever this happens again you need to connect to the lost tasmota over its AP function so you (and all your running wifi gear) loose your wifi connection to hassio…

This is just for the backup that’s going to run periodically, which assumes that everything is functioning normally.

I don’t know of an automated way to connect to all tasmota access points in sequence and restore a particular backup based on the AP’s MAC address, but if you happen to, I’m interested :slight_smile:

I think you problem may be related to SetOption65 i tasmota. Check this video around 1:23:00

2 Likes

I had no idea about tasmota’s ‘fast power cycle device recovery’. Sounds like SetOption65 could have definitely saved me a lot of trouble.

1 Like

How did you configure SetOption65 on tasmota devices??
I had a power outage and all devices were reset…