EventHelper for multiple sensors

9 years 1 month ago #2400 by mihai.aldea
Hi guys,
I have a question regarding the way I can aggregate multiple node sensors values to another node.
Basically I built a bunch of DS18B20 and DHT22, they all send their data to the EasyIoT server and everything's great. But I'd like to be able to get a quick overview of all the sensors without opening a browser, going through menus and so on. So I built another sensor to which I hooked up a 20x4 LCD screen.
I did managed to get the temperature of one of the sensors in there, but I don't see the other three. Most likely I didn't fully understand the NxSy algorithm but I'll try to explain.

If have the physical sensors:
N1S0, N2S0, N3S0, N3S1, N3S2, N4S0
The LCD sensors is N9Sy. Let's say that I want to get the temperature data from N1S0, N2S0, N3S0, N4S0, the humidity from N3S1 and the barometric pressure from N3S2.

Question 1: Do I need to create N9S0...N9S5 to be able to receive each of those remote node/sensors data?
Question 2: Does this syntax makes sense with what I want to do?
void incomingMessage(const MyMessage &message) {.
  if (message.type==V_TEMP && message.sensor==1) {
     Serial.print("T1: ");
     Serial.println(message.getFloat());
     float temp1=message.getFloat();
     lcd.setCursor(3,0);
     lcd.print(temp1);
   }
The first row it's obvious a filter and since I have one of the temperatures displaying on the LCD, I believe
message.type==V_TEMP
is correct, however what does the
message.sensor==1
refers to? Is "1" from the N"1"Sy? Or is it one of the sensors presented by the LCD Arduino to the gateway?
gw.present(0, V_TEMP);
  gw.present(1, V_TEMP);
  gw.present(2, V_TEMP); 
  gw.present(3, V_TEMP); 

Is it even necessary for the LCD Arduino to present those? Wouldn't the message reach the LCD node anyway and following its decoding it would know which local variable to update and display on the LCD?
I am sorry for not being able to connect all the dots but I did my best in putting together any piece of information I could find and in the end I spent a couple of hours on trial-and-error with no success. And please don't laugh at my code, up until two months ago my top programming skill was knowing the difference between int and float :lol:

Please Log in or Create an account to join the conversation.

Time to create page: 0.207 seconds

Forum latest

  • No posts to display.