Giter VIP home page Giter VIP logo

Comments (7)

quangvankts avatar quangvankts commented on September 23, 2024 2

from enigmaiot.

gmag11 avatar gmag11 commented on September 23, 2024

Actually registration will be longer as several random delays are placed to avoid registration collisions.

You idea makes sense but I did no implemented like this for a couple reasons:

  1. This data is written on every packet to update message counters. If you use SPIFFS to write so often it may happen that it wears out too soon. Remember that each flash position may be written about 10000 times.
  2. Having session key on flash may reduce security in case an attacker have physical access to your device. Then key may be easily read. Then it may be used to decode commands and messages.

If you have all this in mind, it may be some situations that this may be a good idea, either.

Nodes that send a message not too often may be completely off to improve battery duration significatively.

Let me think if I can implement this with a parameter in begin call of as a configuration in EnigmaIOTconfig.h

from enigmaiot.

gmag11 avatar gmag11 commented on September 23, 2024

I've added a new branch to implement this (https://github.com/gmag11/EnigmaIOT/tree/flash_storage)

@quangvankts Test it if you like. This feature is controlled by a parameter on EnigmaIoTconfigAdvanced.h

#define USE_FLASH_INSTEAD_RTC 1 

If it is 1 context data will be stored on flash, if it is 0 it will be stored on RTC mem.

Storing data on flash adds around 10 ms to processing time

Notice that you should increase MAX_KEY_VALIDITY and MAX_NODE_INACTIVITY on EnigmaIoTconfig.h according message frequency.

Remember that flash may be stressed if messages are sent too often. Actually, I do not know how fast the flash would degrade. If you can sacrify one esp8266 flash module you may do a burn test :))))))

from enigmaiot.

quangvankts avatar quangvankts commented on September 23, 2024

Thanks !
Yes I just want to try EnigmaIOT in a very specific case where timing and battery life is more important than security. So using flash instead of RTC is very helpful. I have some further questions:

  1. Does gateway need the same save RTC to flash implementation for this to work as well (in case gateway is not always power on) ? If yes can you add this to gateway ?
  2. Is there a way to save RTC to flash only after node registration is done, and not every time a message is sent if I don't use message counter ? (same for gateway)
  3. Will defining MAX_KEY_VALIDITY and MAX_NODE_INACTIVITY as -1 make shared key last forever ? If not how do I do so ?

from enigmaiot.

gmag11 avatar gmag11 commented on September 23, 2024

Here my answers

  1. Gateway does not store node related data persistently, it is only on RAM. So, it it is restarted all nodes will have to reconnect again, what may take something between 1 and 10 seconds, depending the number of nodes that try to register at the same time.
  2. Not easily, Context is updated at least on every message because each one is tagged with a counter. I have included the possibility to disable counter but context is still updated. I may study if adding a condition can reduce the number of writes.
  3. No, but it is a nice idea. I'll check if there is any type conflict doing that. Having infinite MAX_NODE_INACTIVITY may force to reboot gateway if you remove a node from network. Adding a management panel on Gateway my be a solution but I'm really far from implementing that feature yet.

If you test last development successfully let me know to include it in next release. I've tested on ESP8266 and works fine. I have to do same test on ESP32 yet.

from enigmaiot.

gmag11 avatar gmag11 commented on September 23, 2024
  1. I've noticed that this was already implemented. This requires that Gateway is compiled with counter checking disabled. You may use EnigmaIOTGateway.begin (&Espnow_hal,NULL,false); to start gateway in setup (). You need to do the same on every node with EnigmaIOTNode.begin (&Espnow_hal,NULL,NULL,false);.
  2. Commit 0a0d909 adds this feature. Setting MAX_NODE_INACTIVITY or MAX_KEY_VALIDITY to 0 makes them infinite.

from enigmaiot.

gmag11 avatar gmag11 commented on September 23, 2024

Integrated in main branch on release 0.9.5. @quangvankts Let me know if you find any bug.

from enigmaiot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.