Eeprom access via mySensors

  • Hi i hope you can help me finding a solution for my requirement. I want eeprom content to be fully manageable via mySensors protocol using payload.
    The previous days I've tried a few solutions but I'm unsatisfied with all of them, here are some of my unusable solutions:

    • Each eeprom value has it's own function for accessing --> stupid solution e.g. Payload: readValue1
    • Direct access eeprom addresses --> hassle solution without structured access, datatype length problem. e.g. Payload: %command%,%address%,%value% --> write,0x10,255

    Please note, the above Payload examples aren't real, they are just for better description.

    I want a generic solution to manage eeprom values with the use of structured eeprom access, optionally where the node can give information about it's structure (variables and datatypes) to the controller for easier management. Do you have any ideas who to do that, please?

  • Admin


    I have noted the request.

  • Hi, just wanted to ask about any ideas, not to make a feature request. But in general i think this could be useful for the whole mySensors project.
    What i built already:

    -Used the EEPROMAnything.h library for structured eeprom access
    -Wrote a Payload parser for: command,section,value e.g. write,value1,199
    -But then i've a problem to access the struct sections

    Here's an excerpt about my solution:

    struct store_t {
    byte version;
    int value1;
    unsigned long value2;
    char code[5];
    } configuration;

    The parser separates the Payload into:
    -command <-- e.g. write
    -section <-- e.g. value1
    -value <-- e.g. 199

    To read data from the struct i can simply use** configuration.value1** which works fine.
    But i want to use the data from the Payload like ** configuration.section** where the section holds the struct section name to access.
    The only nasty solution i figured out was, comparing the Payload section with a string.

    if (strcmp(payload,"value1") == 0) {
    } else
    if (strcmp(payload,"value2") == 0) {

    How could i do that better?

  • Admin

    It is a hard to solve it any other way if you use a string as identifier.

  • Thanks for reply. This means, my it is not possible do it that way, right?
    Any other ideas to generalize eeprom access?

  • Admin

    You could for instance use a index + length to access a certain a region in the eeprom pretty easy. But remember there are a limit on the size of payload.

  • I already mentioned direct access eeprom addresses. I don't like it, because of loosing all the benefits of structured eeprom access.

  • Admin

    You could read-up on and get inspired of protocol buffers. Pretty neat.

  • thanks, i'll give it a try.

Suggested Topics