V_ID/V_SERIAL to send sensors natural/built in ID's to controller.



  • Hi!

    For sensors that have natural/built in ID's for example DS1820 temp sensors it would be nice to have an V_ID or V_SERIAL to send to the controller to identify the sensor. This can be done via for example one of the V_VAR* or any other for that matter but an common V_ for sending this kind of information over the air.

    /Magnus


  • Admin

    @fot

    Not a bad idea. I think V_ID would be a good candidate.



  • @hek

    Yes, and if you have an controller that can give you the latest value for V_ID it can be used to remember the sensor ID on start up without having it in the EEPROM of the node.

    This will be very useful if you have multiple DS1820-sensors on the same bus and one goes bad. If you remove the sensor from the controller a new ID will be assigned next start up.

    Pseudo code (yes I know that request does not respond with the data):

    listOfSensors = findAllSensors()
    for(1..MAX_SENSOR_ID as i) {
        id = gw.request(i,V_ID);
        if(id in listOfSensors) {
            sensor[id] = i;
            gw.present(sensor[id],S_TEMP);
        }
    }
    for(listOfSensors as id) {
        if(not exist sensor[id]) {
            sensor[id] = find_free_id();
            gw.present(sensor[id],V_TEMP);
        }
    }
    

  • Admin

    @fot

    Yes, will add it in development tonight.



  • Just like to add that I now have a working node that fetched the sensor id from the controller and it does not matter how the sensors are connected to the node.

    Need som cleaning up before going public 🙂

    /Magnus


  • Admin

    I'd be happy if you create a PR when you feel ready.



  • I read that V_ID is implemented now.

    @fot do you have any sketch that can be public?



  • @flopp

    I do have..

    I just need to find it in the pile..

    I'm not using it at the moment for production use but it worked well for my when I tested it.

    /M



  • I am actually using the DS2401s to generate IDs within my Mysensor network.
    I have created two arrays, one with the DS2401 ID, the other with the location (text) of the sensor.
    (it should be possible to do this in a single array BTW)

    In this way I can label my Node with the location name at boot, but more important it labels the children with the location.
    (in addition in my Arduino script I am labeling the Arduino hardware platform as part of the node name)

    Imagine having a list of 15 DHT22's in Domoticz, it is quite challening to find the right DHT22 for a certain location.
    (I am using Domoticz)

    But I acutally should include the Node-ID in my script, in that way I don't need to query it at boot time 🙂


Log in to reply
 

Suggested Topics

  • 90
  • 7
  • 3
  • 3
  • 13
  • 1

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts