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?
1 out of 1
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
Adding Listen only device to my system.
Development • 26 Feb 2025, 00:39 • dpcons 26 Feb 2025, 06:26 -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
PJON and Minicore not working
Development • 20 days ago • Trand 20 days ago