MyMessage entity number in stead of name



  • Hi!

    I'm new to MySensors and i'm currently making a OTGW logger (see http://otgw.tclcode.com)
    I want to make the code flexible because not everybody wants to log every message of the OTGW. The code is already finished but i only have one thing i want improve.
    Now i have:

    MyMessage pressure(1,V_PRESSURE);
    MyMessage set_temp(2,V_TEMP);
    ...... many more
    

    And at the sending part i have:

    switch(ID) {
    case 1:
        send(pressure.set(value));
        break;
    case 2: 
        send(set_tep.set(value));
        break;
    ....many more cases....
    }
    

    I want to do something like:

    MyMessage 1(1,V_PRESSURE);
    MyMessage 2(2,V_TEMP);
    .......
    

    and at the sending part i can just do:

    send(ID.set(value));
    

    But that wouldn't compile because it is a number i think in stead of a name.
    Does anyone know a nice way to do it?


Log in to reply
 

Suggested Topics

37
Online

11.4k
Users

11.1k
Topics

112.6k
Posts