Usage of Child IDs



  • I am confused about how to use child ids for sensors which deliver more than one values. Example: DHT22 (gives humidity and temperature) or power meter (gives watts and kWhs).
    In the examples I have seen: a different child id for each value (child id 1 for temp, child id 2 for hum) as well as the same child id for both values (child id 1 for watts and for kWhs as well). Are both methods ok ? Or is there a recommended way to assign child ids ? Or is one method not advisable ?
    Please enlighten me 😉
    Thank you very much in advance
    Josh


  • Admin

    You can find a table with the most common variables used for each sensor type here (see under presentation):

    http://www.mysensors.org/download/serial_api_15

    There isn't any law against using other variables/sensor-type but the controllers will most probably not support it.



  • @hek said:

    You can find a table with the most common variables used for each sensor type here (see under presentation):

    http://www.mysensors.org/download/serial_api_15

    There isn't any law against using other variables/sensor-type but the controllers will most probably not support it.

    My confusion is not related to sensor types but to the assignment of child IDs. In the sketch example for DHT22, different child IDs are assigned to the temp value and the hum value of the same sensor (DHT22). In the example for the pulse energy meter, only a single child ID is assigned to the watt value and the kWh value.
    Somewhere in the general description it says that a child ID identifies (on a node with several sensors) a sensor. In my understanding that means that sensors providing more than one measurement values get assigned the same child ID for each value (example watts and kWh) they provide. The energy meter sketch reflect this view. What confuses me is the DHT22 sketch. There, two child ID are used, although it is the same sensor (DHT22).
    Both methods seem to work ? Are both methods (one child id vs. two) equivalent or is one of the methods "better" ?

    Thank you for a clarification
    Josh


  • Hero Member

    Stumbled on that a week ago too. I don't see the difference either. Please enligthen me. 🙂


  • Admin

    Ahh.. can understand the confusion. Even though the physical DHT contains both temp and humidity readings most controller distinguish between them (GUI vise).

    So it felt more natural to keep them separated when presenting and reporting readings on them to make it easier on for the controller plugin developers.



  • How about the BMP085, one sensor, two child ids (temp, barometer) and three variable msg (temp, pressure, forecast)😨



  • After some thinking (yes, I am able to 😉), this is the conclusion I came to.
    Put yourself in the shoes of a controller 😏. You have a node which tells you it has just one sensor (DHT22) attached. Wether it sends you a V_TEMP and a V_HUM with the same child ID or with two different child IDs makes no difference to you. Since there is only one temperature sensor, the controller has no problem to see that V_HUM and V_TEMP belong to the same sensor and correlate them (to calculate a dew point for example).
    Now imagine that there are three DHTs (of course at three diferent locations) connected to the same node. Now the node sends six different child IDs (three pairs V_HUM / V_TEMP) to the controller. How can the poor controller find out, which two child IDs belong to the same sensor ? No way to find that out !
    So, my conclusion is, that it seems to be strongly advisable to use the same child ID for all values which are produced by a sensor. Makes life for a poor controller much easier 😜.

    Or is there a mistake in my thinking, which I have not seen yet ?
    Cheers
    Josh


  • Plugin Developer

    @joshmosh

    When a node presents it's sensors it sends out child id's. So the controller knows which child id's exist. When values are send to the controller this is in combination with the sensor child id. So the controller knows which value belongs to which child id's exist.

    If you then look at it pure from controller perspective it just sees multiple sensors. You can even put all your values within the same child id as long as the V_* types are unique used with that child id (do not use two V_TEMP values with the same child id).


Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 2
  • 2
  • 2
  • 198

3
Online

11.2k
Users

11.1k
Topics

112.5k
Posts