Apollon77 / node-mbus

Nodejs mbus module
MIT License
21 stars 15 forks source link

Get devices primary IDs #10

Closed robertsLando closed 6 years ago

robertsLando commented 6 years ago

Is there a way to know devices primary id? SlaveInformation just contains device secondary ID. I also think that the scan is made throught primary IDs because if 2 devices has the same primary id it doesn't find both but only one

Apollon77 commented 6 years ago

To be honest: I have no idea, had the same question in my mind too and finally don't think that this is available ... Else we need to check the protocol :-)

Also SlaveInformation is not containing the full "secondary ID"!! This is more the device ID, yes these ae the first positions of the secondary-ID but then more comes after a Letter

robertsLando commented 6 years ago

Yes it is the device Id that I usually use also as secondary ID with other softwares scan. In my code I use this function to get what you call deviceID:

  function parseSecondaryID(id){
      id = id.substr(0,8);
      id = parseInt(id); //remove leading 0
      return id.toString();
    }

Honestly: I don't know the mean of other chars in the secondary id provided from the scan but this is how I parse them and seems to work for now

Apollon77 commented 6 years ago

Correct, But when using the Secondary-ID to query the device data then you ned to use the "full" secondary ID ... As I understood the second part is needed to mae the ID "worldwide unique"

Apollon77 commented 6 years ago

Not possible