Requesting data from other sensors

I have beed trying to use the "requestStatus(radioId, childId, variableType)"and or the
“getStatus(radioId, childId, variableType)” to retrieve data from another sensor on my network.
Haven’t had any success yet. ???

The Relay sketch example has been what I have been using to test with.
The Relay sketch works fine, but when I add in the “radioId” to access a different sensor
on my network it does not work. I’m trying to read “V_LIGHT” status from another sensor.

Does anyone have a working example ?

Maybe post the sketch you are using.

Hard to tell what’s happening without seeing that.

[left]OK , here it is…

#include <Sensor.h>
#include <SPI.h>
#include <EEPROM.h>
#include <RF24.h>

#define RADIO_ID 4 // this radio,s ID
#define CHILD_ID0 0 // this radio,s child 0

#define Fetch_Radio 2 // radio ID to get data from
#define Fetch_Child 3 // child 3 to get status from (light on/off)
const int ledPin = 4; // the number of the LED pin

Sensor gw(9,10);

void setup()
{
pinMode(ledPin, OUTPUT); // set pin as an output
digitalWrite(ledPin, 0); // turn off on startup
gw.begin(RADIO_ID);
gw.sendSketchInfo(“Testing”, “1.0”);
gw.sendSensorPresentation(CHILD_ID0, S_LIGHT);

gw.getStatus(Fetch_Radio, Fetch_Child, V_LIGHT); // Fetch light state at startup
setStatus(gw.getMessage()); // Wait here until status message arrive from gw

}

void loop()
{
if (gw.messageAvailable()) {
// New messsage from gw
message_s message = gw.getMessage();
setStatus(message);
}

}

// ********** Process the Data **************************

void setStatus(message_s message) {
if (message.header.messageType=M_SET_VARIABLE &&
message.header.type==V_LIGHT) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
Serial.print("Got a V_LIGHT status is ");
int val = atoi(message.data); // convert to an interger
Serial.println(val);
digitalWrite(ledPin, val); // write it out to the digital out

} else { // not the correct type
Serial.println(“Not for this node”);
}

}
[/left]

So there are a few issues in here, but I don’t have access to edit/compile. Unless someone else can help you, I can look at it tonight.

You are simply trying to see if you can get a status change on another sensor.

"You are simply trying to see if you can get a status change on another sensor. "

Yes , that is correct. No hurry.
Thanks for any help.

[quote=“jackpot, post:5, topic:180816”]"You are simply trying to see if you can get a status change on another sensor. "

Yes , that is correct. No hurry.
Thanks for any help.[/quote]

I forgot about this with other things… Did you get this working?

If not, can you attach your sketch in a file?

@Bulldoglowell

Nope, haven’t had any success yet :-[
Apparently I don’t know enough about it yet. Here’s the file…

Made some progress sort of…

I decided to try sending directly to another sensor ( sensor A directly to sensor B). This is what I used.

#define Remote_Radio 4 // radio ID to send data too
#define Remote_Child 4 // child to use
#define Remote_Var 2 // V_LIGHT
char *RemoteOFF = “0”;
char *RemoteON = “1”;

gw.sendVariable(Remote_Radio,Remote_Child, Remote_Var, RemoteON);
and
gw.sendVariable(Remote_Radio,Remote_Child, Remote_Var, RemoteOFF);

This code was added to Sensor A node that was using the “Sensor.h” library and the receiving node Sensor B using Relay.h library. It seemed to work fine and I could turn a Led connected to Sensor B on/off using Sensor A.
I checked the Vera logs and didn’t see anything so I assume that it’s working as planned. ;D

So now I’m thinking that in order to get a status change on another sensor by sending [gw.getStatus(Fetch_Radio, Fetch_Child, V_LIGHT);] the sensor would have to respond with a [gw.sendVariable(x,x,x,x).

Am I on the right track ?