I'm trying to make a node which is solar powered to control a few relays to automate our sprinklers. In order to get power consumption to a reasonable, sustainable level i will need to sleep the nodes.
In order to allow the nodes to sleep without missing their messages to change state i am considereing employing a middle man node which the controller changes the state of the sprinkler on then the actual sprinkler nodes wake up, request the sprinkler state from the middle man node and change their state to suit. If the middle man node doesn't hear from the sprinkler node for a set period of time (say 10 mins) it changes the state of the sprinkler back to the original and pushes this change to the gateway (and thus controller) in the same way a button would.
Here is a crappy diagram of what im trying to achieve-
dropbox link it that doesn't work https://www.dropbox.com/s/amhwu6maicnxi5p/middle man node diagram.png?dl=0
I'm encountering one main issues implementing this approach-
1- using the Requesting data function- how do i specify the varible i want? say the middle na node has an array of 20 sprinklers, what sprinkler node they are attached to, and their state. can i send the request for var1 meaning sprinkler one for the current node (node n) and then in the middle man node extract the destination node (the sprinkler node) id along with which custom variable requested (1 to 5) to tell which of the multiple attached sprinklers to turn on? Is there an example sketch using the request data function to get data from another node i can see (i couldn't find one)?
it is mainly the "handle the reply message yourself in the destination node" and extracting the node and sensor id from the state request message recieved by the middle man node parts i cannot solve. Can i just construct the msg using the constructors here http://www.mysensors.org/download/sensor_api_15#MyMessage ? judging from the message stucture the sending nodes id isn't included in the header, how is the middle man node to determine who to send the data back to?
sorry for all the questions, they seem little and i could probably resolve them myself if anyone has some examples of a node getting and receiving a variable from another node. Thanks for any and all input everyone!
BTW- Currently i have the nodes built and was planing on waiting for a controller to implement the smart sleep feature in mysensors 1.5, however i have given up on waiting. Adding the feature to domotics was beyond my abilities (i tried) unfortunately).