mysensors / MySensors

MySensors library and examples
https://www.mysensors.org
1.32k stars 895 forks source link

Add support for Factory reset - I_FACTORY_RESET #1204

Open jkandasa opened 6 years ago

jkandasa commented 6 years ago

At this moment I do not see any option to do a factory reset(erase EEPROM completely) via default library.

It may be a good idea to implement I_FACTORY_RESET to perform complete EEPROM erase. This will help us to perform a factory reset from our favorite controller(without toucing the hardware).

As MySensors library supports more than one hardware(ATMEGA328P, ESP8266, etc.,) this feature should be implemented for each platform. End user simply trigger I_FACTORY_RESET, when there is a need.

fallberg commented 6 years ago

This might be a good idea for systems that don't use encryption. Currently all encryption solutions rely on EEPROM for key storage. Distributing a reset command to a node would then effectively exclude that node from future communications. So if this is implemented, care must be taken for users that rely on encryption.

nekitoss commented 5 years ago

@jkandasa MYSController has an option debug->!! clear EEPROM !! and option MYSCBootloader CMDs-> Clear EEPROM these commands with original bootloader in serial monitor looks like:

17716 TSF:MSG:READ,0-0-5,s=0,c=3,t=28,pt=0,l=1,sg=0:E
17774 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=28,pt=0,l=2,sg=0,ft=0,st=OK:OK

and

93721 TSF:MSG:READ,0-0-5,s=0,c=3,t=13,pt=0,l=1,sg=0:0

respectively (you can parse them)

FYI i've just tested:

So at the moment in case of MYSBootloader you can FOTA empty sketh to node and then do eeprom erase... - i think you will get what you want?

jkandasa commented 5 years ago

@nekitoss Thank you! Yes, I want to clear EEPROM in all cases. Not only with MYSBootloader.

flatsiedatsie commented 5 years ago

This might be a good idea for systems that don't use encryption. Currently all encryption solutions rely on EEPROM for key storage. Distributing a reset command to a node would then effectively exclude that node from future communications. So if this is implemented, care must be taken for users that rely on encryption.

You could also say that users who have unsecured networks are just as much at risk, since it becomes very easy for a neighbor or war-driver to reset the nodes.

fallberg commented 5 years ago

Indeed. Just another reason for people to secure their networks :)