Request data from another sensor?



  • Hi all, first post from me.

    As I have understood, it is possible for sensor A to fetch values from sensor B. Can someone provide an example of how that is done?
    My goal is to create a sensor that has an LCD connected that will display the temperature from other sensors (preferably both MySensor and z-wave).



  • You can request values directly from another sensors for your LCD sensor node, but it's better to send LCD text data directly from controller to LCD node. Requesting data directly from another nodes is not very good choice, because of this nodes must not use deep sleep (so must not be battery powered).

    My LCD node contains two 2004 LCD displays and receives text data for every display line from controller. But I'm using my own perl script as controller.


  • Contest Winner

    @robosensor said:

    You can request values directly from another sensors for your LCD sensor node, but it's better to send LCD text data directly from controller to LCD node. Requesting data directly from another nodes is not very good choice, because of this nodes must not use deep sleep (so must not be battery powered).

    If you wake-up and push the data from the sensor to the LCD node, it would be no more power-consuming than transmitting to gateway, all messages go through the gateway anyway.



  • Since my nodes are all mains powered, they are not sleeping. My question in particular is how a request from node A would show up in node B. Obviously as an incoming message, but in which way would it be coded ? I haven't seen any examples or a description here.
    Any hints would be highly appreciated.
    Thanks a lot in advance
    Josh


  • Hero Member

    You can check the message content for any attribute like:

    void incomingMessage(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_LIGHT) {} 
    }
    

    The attributes are defined in MyMessage.h, "sender" would be the node requesting.

    uint8_t last;            	 // 8 bit - Id of last node this message passed
    uint8_t sender;          	 // 8 bit - Id of sender node (origin)
    uint8_t destination;     	 // 8 bit - Id of destination node
    uint8_t version_length;      // 3 bit - Protocol version
    			                     // 5 bit - Length of payload
    uint8_t command_ack_payload; // 3 bit - Command type
    	                             // 1 bit - Request an ack - Indicator that receiver should send an ack back.
    								 // 1 bit - Is ack messsage - Indicator that this is the actual ack message.
    	                             // 3 bit - Payload data type
    uint8_t type;            	 // 8 bit - Type varies depending on command
    uint8_t sensor;          	 // 8 bit - Id of sensor that this message concerns.
    


  • Thank you very much for this very useful answer ! This is exactly what I was looking for but did not find.
    I will try it in my system.
    Thanks a lot again.
    Cheers, Josh



  • This came up before.
    http://forum.mysensors.org/topic/1085/node-to-node-communication

    Basically when the sensor sends the data to the controller you can have it send the same data to the LCD. That would most likely provide a longer battery life than requesting the data from the sensors. Doing it this way only the LCD (and the controller) have to be on all the time.



  • That totally makes sense.
    I have come to the conclusion that I will probably let my Vera push the info to the LCD node.


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts