Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. MyMessage entity number in stead of name

MyMessage entity number in stead of name

Scheduled Pinned Locked Moved Development
mymessageotgw
1 Posts 1 Posters 690 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • rubenverhoefR Offline
    rubenverhoefR Offline
    rubenverhoef
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    13

    Online

    11.7k

    Users

    11.2k

    Topics

    113.1k

    Posts


    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular