Apollon77 / node-mbus

Nodejs mbus module
MIT License
21 stars 15 forks source link

Not able to get values... #12

Closed wmmihaa closed 6 years ago

wmmihaa commented 6 years ago

Hi, and thanks for this repo! I'm trying to use the node-mbus repo to receive data from a CMeX50. It was very easy to get started and I received data:

err: null
data: {
  "SlaveInformation": {
    "Id": 68024764,
    "Manufacturer": "ELV",
    "Version": 31,
    "ProductName": "",
    "Medium": "Unknown medium (0x1b)",
    "AccessNumber": 33,
    "Status": 0,
    "Signature": 0
  },
  "DataRecord": [
    {
      "id": 0,
      "Function": "Instantaneous value",
      "StorageNumber": 0,
      "Unit": "Energy (1e7 J)",
      "Value": "",
      "Timestamp": "2018-04-15T11:48:27Z"
    }
  ]
}

Queston 1: The sensor is a therometer and should have values. Is there anyway I can get the unparsed data to verify?

Queston 2: Is there a way of getting data from all sensors sort of getData('ALL'...)?

Queston 3: The scanSecondary function logs other sensors to the console. Is there a way to get that list so that I can continue?

Found a device on secondary address 610003609615011B [using address mask 61FFFFFFFFFFFFFF]
Found a device on secondary address 6200165396150331 [using address mask 62FFFFFFFFFFFFFF]
Found a device on secondary address 6802476496151F1B [using address mask 68FFFFFFFFFFFFFF]
err: null
data: [] // be nice it this was populated...
wmmihaa commented 6 years ago

After further investigatng it seems I get a collision:

check for more data (collision)
collision, more than one device matching, restrict the search mask further
Found a device on secondary address 6200165396150331 [using address mask 62FFFFFFFFFFFFFF]
Found a device on secondary address 6802476496151F1B [using address mask 68FFFFFFFFFFFFFF]
err: null
data: []
Apollon77 commented 6 years ago

I will answer Later detail. Now short.

Collision is ok and handled.

To get more details install the package with —debug (so npm i node-mbus —debug) (two minus characters) Then stderr get a lot of data. Post that and I check it

wmmihaa commented 6 years ago

Thanks for a quick reply (on a sunday ;) )

Here is the output:

mbus_serial_connect: t.c_cflag = 9bb
mbus_serial_connect: t.c_oflag = 0
mbus_serial_connect: t.c_iflag = 0
mbus_serial_connect: t.c_lflag = 0
mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 40 FD 3D 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 40 FD 3D 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
00 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
44 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
00 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 60 FF FF FF FF 1B 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 60 FF FF FF FF 1B 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 61 FF FF FF FF 1C 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 61 FF FF FF FF 1C 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 62 FF FF FF FF 1D 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
E5 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 5B FD 58 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
68 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 1]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 1]
10 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 2]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 2]
10 
mbus_serial_recv_frame: Attempt to read 19 bytes [len = 3]
mbus_serial_recv_frame: Got 1 byte [remaining 19, len 3]
68 
mbus_serial_recv_frame: Attempt to read 18 bytes [len = 4]
mbus_serial_recv_frame: Got 1 byte [remaining 18, len 4]
08 
mbus_serial_recv_frame: Attempt to read 17 bytes [len = 5]
mbus_serial_recv_frame: Got 1 byte [remaining 17, len 5]
00 
mbus_serial_recv_frame: Attempt to read 16 bytes [len = 6]
mbus_serial_recv_frame: Got 1 byte [remaining 16, len 6]
72 
mbus_serial_recv_frame: Attempt to read 15 bytes [len = 7]
mbus_serial_recv_frame: Got 1 byte [remaining 15, len 7]
53 
mbus_serial_recv_frame: Attempt to read 14 bytes [len = 8]
mbus_serial_recv_frame: Got 1 byte [remaining 14, len 8]
16 
mbus_serial_recv_frame: Attempt to read 13 bytes [len = 9]
mbus_serial_recv_frame: Got 1 byte [remaining 13, len 9]
00 
mbus_serial_recv_frame: Attempt to read 12 bytes [len = 10]
mbus_serial_recv_frame: Got 1 byte [remaining 12, len 10]
62 
mbus_serial_recv_frame: Attempt to read 11 bytes [len = 11]
mbus_serial_recv_frame: Got 1 byte [remaining 11, len 11]
96 
mbus_serial_recv_frame: Attempt to read 10 bytes [len = 12]
mbus_serial_recv_frame: Got 1 byte [remaining 10, len 12]
15 
mbus_serial_recv_frame: Attempt to read 9 bytes [len = 13]
mbus_serial_recv_frame: Got 1 byte [remaining 9, len 13]
03 
mbus_serial_recv_frame: Attempt to read 8 bytes [len = 14]
mbus_serial_recv_frame: Got 1 byte [remaining 8, len 14]
31 
mbus_serial_recv_frame: Attempt to read 7 bytes [len = 15]
mbus_serial_recv_frame: Got 1 byte [remaining 7, len 15]
17 
mbus_serial_recv_frame: Attempt to read 6 bytes [len = 16]
mbus_serial_recv_frame: Got 1 byte [remaining 6, len 16]
00 
mbus_serial_recv_frame: Attempt to read 5 bytes [len = 17]
mbus_serial_recv_frame: Got 1 byte [remaining 5, len 17]
00 
mbus_serial_recv_frame: Attempt to read 4 bytes [len = 18]
mbus_serial_recv_frame: Got 1 byte [remaining 4, len 18]
00 
mbus_serial_recv_frame: Attempt to read 3 bytes [len = 19]
mbus_serial_recv_frame: Got 1 byte [remaining 3, len 19]
0F 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 20]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 20]
4A 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 21]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 21]
16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

Found a device on secondary address 6200165396150331 [using address mask 62FFFFFFFFFFFFFF]
mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 63 FF FF FF FF 1E 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 63 FF FF FF FF 1E 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 64 FF FF FF FF 1F 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 64 FF FF FF FF 1F 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 65 FF FF FF FF 20 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 65 FF FF FF FF 20 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 66 FF FF FF FF 21 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 66 FF FF FF FF 21 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 67 FF FF FF FF 22 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 67 FF FF FF FF 22 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 68 FF FF FF FF 23 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
E5 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 5B FD 58 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
68 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 1]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 1]
11 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 2]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 2]
11 
mbus_serial_recv_frame: Attempt to read 20 bytes [len = 3]
mbus_serial_recv_frame: Got 1 byte [remaining 20, len 3]
68 
mbus_serial_recv_frame: Attempt to read 19 bytes [len = 4]
mbus_serial_recv_frame: Got 1 byte [remaining 19, len 4]
08 
mbus_serial_recv_frame: Attempt to read 18 bytes [len = 5]
mbus_serial_recv_frame: Got 1 byte [remaining 18, len 5]
02 
mbus_serial_recv_frame: Attempt to read 17 bytes [len = 6]
mbus_serial_recv_frame: Got 1 byte [remaining 17, len 6]
72 
mbus_serial_recv_frame: Attempt to read 16 bytes [len = 7]
mbus_serial_recv_frame: Got 1 byte [remaining 16, len 7]
64 
mbus_serial_recv_frame: Attempt to read 15 bytes [len = 8]
mbus_serial_recv_frame: Got 1 byte [remaining 15, len 8]
47 
mbus_serial_recv_frame: Attempt to read 14 bytes [len = 9]
mbus_serial_recv_frame: Got 1 byte [remaining 14, len 9]
02 
mbus_serial_recv_frame: Attempt to read 13 bytes [len = 10]
mbus_serial_recv_frame: Got 1 byte [remaining 13, len 10]
68 
mbus_serial_recv_frame: Attempt to read 12 bytes [len = 11]
mbus_serial_recv_frame: Got 1 byte [remaining 12, len 11]
96 
mbus_serial_recv_frame: Attempt to read 11 bytes [len = 12]
mbus_serial_recv_frame: Got 1 byte [remaining 11, len 12]
15 
mbus_serial_recv_frame: Attempt to read 10 bytes [len = 13]
mbus_serial_recv_frame: Got 1 byte [remaining 10, len 13]
1F 
mbus_serial_recv_frame: Attempt to read 9 bytes [len = 14]
mbus_serial_recv_frame: Got 1 byte [remaining 9, len 14]
1B 
mbus_serial_recv_frame: Attempt to read 8 bytes [len = 15]
mbus_serial_recv_frame: Got 1 byte [remaining 8, len 15]
2A 
mbus_serial_recv_frame: Attempt to read 7 bytes [len = 16]
mbus_serial_recv_frame: Got 1 byte [remaining 7, len 16]
00 
mbus_serial_recv_frame: Attempt to read 6 bytes [len = 17]
mbus_serial_recv_frame: Got 1 byte [remaining 6, len 17]
00 
mbus_serial_recv_frame: Attempt to read 5 bytes [len = 18]
mbus_serial_recv_frame: Got 1 byte [remaining 5, len 18]
00 
mbus_serial_recv_frame: Attempt to read 4 bytes [len = 19]
mbus_serial_recv_frame: Got 1 byte [remaining 4, len 19]
00 
mbus_serial_recv_frame: Attempt to read 3 bytes [len = 20]
mbus_serial_recv_frame: Got 1 byte [remaining 3, len 20]
0F 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 21]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 21]
AF 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 22]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 22]
16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

Found a device on secondary address 6802476496151F1B [using address mask 68FFFFFFFFFFFFFF]
mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 69 FF FF FF FF 24 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 69 FF FF FF FF 24 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

err: null
data: []
wmmihaa commented 6 years ago

To me it looks like the data array is not populated if there are collisions: mbus-master.cc (line 472):

if (probe_ret == MBUS_PROBE_SINGLE)
{
    if (!handle->found_event)
    {
        sprintf(buffer,"\"%s\",",matching_mask);
        data = (char*)realloc(data, strlen(data) + strlen(buffer) + 2*sizeof(char));
        if(!data) {
            sprintf(error,"Failed to allocate data");
            SetErrorMessage(error);
            uv_rwlock_wrunlock(lock);
            return;
        }
        strcat(data,buffer);
    }
}
else if (probe_ret == MBUS_PROBE_COLLISION)
{
    printf("collision, more than one device matching, restrict the search mask further\n");
    mbus_scan_2nd_address_range(handle, pos+1, mask);

}
Apollon77 commented 6 years ago

So, now on my laptop :-)

Answers to your questions first: to 1.) with the debug install you get the raw mbus data. Can you also send those? Then we would need to figure out why it is not parsed. But basically this then (and if) would be an issue for "libmbus" because my stuff bases on this for all the raw and data protocol topics.

to 2.) No, the whole protocol depends on the fact that only one device on the bus can communicate - elso it ends up in collisions and trash. Thats why all devices can be addressed by their primary or secondary IDs and will so be "selected" to communicate to. SO best practice here is to do a secondary scan to get all IDs and then iterate over them

to 3.) Basically you found an error in the library. I never had the chance to see collisions andso also no test with it. And now I see also why you get those debug outputs :-)) need to rewrite that :( But already got an idea for it. And data to build a test around it. Thank you!!

wmmihaa commented 6 years ago

No Thank you!

  1. I sent all the output I got... Is there something else?
  2. Got it!
  3. Let me know if you'd like me to test it! I'll be ready as soon as you got something.

Cheers

Apollon77 commented 6 years ago

to 1.) Execute the getData again with the "--debug" installation and aoxu also should get debug output from raw communication on stderr

wmmihaa commented 6 years ago

Here is the output after starting with --debug

(classic)admin@dell3001:~/mikael/wmbus$ node mbus.js --debug
mbus_serial_connect: t.c_cflag = 9bb
mbus_serial_connect: t.c_oflag = 0
mbus_serial_connect: t.c_iflag = 0
mbus_serial_connect: t.c_lflag = 0
mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 40 FD 3D 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 40 FD 3D 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
00
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
44
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
00
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 60 FF FF FF FF 1B 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 60 FF FF FF FF 1B 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 61 FF FF FF FF 1C 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 61 FF FF FF FF 1C 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 62 FF FF FF FF 1D 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
E5
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 5B FD 58 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
68
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 1]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 1]
10
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 2]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 2]
10
mbus_serial_recv_frame: Attempt to read 19 bytes [len = 3]
mbus_serial_recv_frame: Got 1 byte [remaining 19, len 3]
68
mbus_serial_recv_frame: Attempt to read 18 bytes [len = 4]
mbus_serial_recv_frame: Got 1 byte [remaining 18, len 4]
08
mbus_serial_recv_frame: Attempt to read 17 bytes [len = 5]
mbus_serial_recv_frame: Got 1 byte [remaining 17, len 5]
00
mbus_serial_recv_frame: Attempt to read 16 bytes [len = 6]
mbus_serial_recv_frame: Got 1 byte [remaining 16, len 6]
72
mbus_serial_recv_frame: Attempt to read 15 bytes [len = 7]
mbus_serial_recv_frame: Got 1 byte [remaining 15, len 7]
53
mbus_serial_recv_frame: Attempt to read 14 bytes [len = 8]
mbus_serial_recv_frame: Got 1 byte [remaining 14, len 8]
16
mbus_serial_recv_frame: Attempt to read 13 bytes [len = 9]
mbus_serial_recv_frame: Got 1 byte [remaining 13, len 9]
00
mbus_serial_recv_frame: Attempt to read 12 bytes [len = 10]
mbus_serial_recv_frame: Got 1 byte [remaining 12, len 10]
62
mbus_serial_recv_frame: Attempt to read 11 bytes [len = 11]
mbus_serial_recv_frame: Got 1 byte [remaining 11, len 11]
96
mbus_serial_recv_frame: Attempt to read 10 bytes [len = 12]
mbus_serial_recv_frame: Got 1 byte [remaining 10, len 12]
15
mbus_serial_recv_frame: Attempt to read 9 bytes [len = 13]
mbus_serial_recv_frame: Got 1 byte [remaining 9, len 13]
03
mbus_serial_recv_frame: Attempt to read 8 bytes [len = 14]
mbus_serial_recv_frame: Got 1 byte [remaining 8, len 14]
31
mbus_serial_recv_frame: Attempt to read 7 bytes [len = 15]
mbus_serial_recv_frame: Got 1 byte [remaining 7, len 15]
18
mbus_serial_recv_frame: Attempt to read 6 bytes [len = 16]
mbus_serial_recv_frame: Got 1 byte [remaining 6, len 16]
00
mbus_serial_recv_frame: Attempt to read 5 bytes [len = 17]
mbus_serial_recv_frame: Got 1 byte [remaining 5, len 17]
00
mbus_serial_recv_frame: Attempt to read 4 bytes [len = 18]
mbus_serial_recv_frame: Got 1 byte [remaining 4, len 18]
00
mbus_serial_recv_frame: Attempt to read 3 bytes [len = 19]
mbus_serial_recv_frame: Got 1 byte [remaining 3, len 19]
0F
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 20]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 20]
4B
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 21]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 21]
16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

Found a device on secondary address 6200165396150331 [using address mask 62FFFFFFFFFFFFFF]
mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 63 FF FF FF FF 1E 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 63 FF FF FF FF 1E 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 64 FF FF FF FF 1F 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 64 FF FF FF FF 1F 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 65 FF FF FF FF 20 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 65 FF FF FF FF 20 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 66 FF FF FF FF 21 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 66 FF FF FF FF 21 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 67 FF FF FF FF 22 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 67 FF FF FF FF 22 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 68 FF FF FF FF 23 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
E5
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 5B FD 58 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
68
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 1]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 1]
11
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 2]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 2]
11
mbus_serial_recv_frame: Attempt to read 20 bytes [len = 3]
mbus_serial_recv_frame: Got 1 byte [remaining 20, len 3]
68
mbus_serial_recv_frame: Attempt to read 19 bytes [len = 4]
mbus_serial_recv_frame: Got 1 byte [remaining 19, len 4]
08
mbus_serial_recv_frame: Attempt to read 18 bytes [len = 5]
mbus_serial_recv_frame: Got 1 byte [remaining 18, len 5]
02
mbus_serial_recv_frame: Attempt to read 17 bytes [len = 6]
mbus_serial_recv_frame: Got 1 byte [remaining 17, len 6]
72
mbus_serial_recv_frame: Attempt to read 16 bytes [len = 7]
mbus_serial_recv_frame: Got 1 byte [remaining 16, len 7]
64
mbus_serial_recv_frame: Attempt to read 15 bytes [len = 8]
mbus_serial_recv_frame: Got 1 byte [remaining 15, len 8]
47
mbus_serial_recv_frame: Attempt to read 14 bytes [len = 9]
mbus_serial_recv_frame: Got 1 byte [remaining 14, len 9]
02
mbus_serial_recv_frame: Attempt to read 13 bytes [len = 10]
mbus_serial_recv_frame: Got 1 byte [remaining 13, len 10]
68
mbus_serial_recv_frame: Attempt to read 12 bytes [len = 11]
mbus_serial_recv_frame: Got 1 byte [remaining 12, len 11]
96
mbus_serial_recv_frame: Attempt to read 11 bytes [len = 12]
mbus_serial_recv_frame: Got 1 byte [remaining 11, len 12]
15
mbus_serial_recv_frame: Attempt to read 10 bytes [len = 13]
mbus_serial_recv_frame: Got 1 byte [remaining 10, len 13]
1F
mbus_serial_recv_frame: Attempt to read 9 bytes [len = 14]
mbus_serial_recv_frame: Got 1 byte [remaining 9, len 14]
1B
mbus_serial_recv_frame: Attempt to read 8 bytes [len = 15]
mbus_serial_recv_frame: Got 1 byte [remaining 8, len 15]
2B
mbus_serial_recv_frame: Attempt to read 7 bytes [len = 16]
mbus_serial_recv_frame: Got 1 byte [remaining 7, len 16]
00
mbus_serial_recv_frame: Attempt to read 6 bytes [len = 17]
mbus_serial_recv_frame: Got 1 byte [remaining 6, len 17]
00
mbus_serial_recv_frame: Attempt to read 5 bytes [len = 18]
mbus_serial_recv_frame: Got 1 byte [remaining 5, len 18]
00
mbus_serial_recv_frame: Attempt to read 4 bytes [len = 19]
mbus_serial_recv_frame: Got 1 byte [remaining 4, len 19]
00
mbus_serial_recv_frame: Attempt to read 3 bytes [len = 20]
mbus_serial_recv_frame: Got 1 byte [remaining 3, len 20]
0F
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 21]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 21]
B0
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 22]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 22]
16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

Found a device on secondary address 6802476496151F1B [using address mask 68FFFFFFFFFFFFFF]
mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 69 FF FF FF FF 24 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 69 FF FF FF FF 24 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

err: null
data: []
robertsLando commented 6 years ago

This was happening to me too when scanning network with two m-bus devices with same primary ID, even if the scan should be done throught secondary ID :confused:

wmmihaa commented 6 years ago

I'm fairly new to mbus, so perhaps it's something I'm doing wrong... I only have one receiver and one sensor, so I don't know what the collision issue is. The reason I se to sensors is that I get the master receiver as a sensor.

robertsLando commented 6 years ago

Maybe your device isn't addressed and has the address primary Id set to 0. It should work anyway but try to set its address to 1. Usually you can change the primary id directly from the device if it provides an interface or by using this library function setAddress

wmmihaa commented 6 years ago

Ah! I'm sure I saw that in the settings. I'll set it when I get home.

wmmihaa commented 6 years ago

So I've changed the primary address from "0" to "1", but I still get the same result :(

mbus_serial_connect: t.c_cflag = 9bb
mbus_serial_connect: t.c_oflag = 0
mbus_serial_connect: t.c_iflag = 0
mbus_serial_connect: t.c_lflag = 0
mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 40 FD 3D 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 40 FD 3D 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 0F FF FF FF FF CA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 1F FF FF FF FF DA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 2F FF FF FF FF EA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 3F FF FF FF FF FA 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 4F FF FF FF FF 0A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 5F FF FF FF FF 1A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 6F FF FF FF FF 2A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
00 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
44 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
00 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 60 FF FF FF FF 1B 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 60 FF FF FF FF 1B 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 61 FF FF FF FF 1C 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 61 FF FF FF FF 1C 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 62 FF FF FF FF 1D 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
E5 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 5B FD 58 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
68 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 1]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 1]
10 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 2]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 2]
10 
mbus_serial_recv_frame: Attempt to read 19 bytes [len = 3]
mbus_serial_recv_frame: Got 1 byte [remaining 19, len 3]
68 
mbus_serial_recv_frame: Attempt to read 18 bytes [len = 4]
mbus_serial_recv_frame: Got 1 byte [remaining 18, len 4]
08 
mbus_serial_recv_frame: Attempt to read 17 bytes [len = 5]
mbus_serial_recv_frame: Got 1 byte [remaining 17, len 5]
01 
mbus_serial_recv_frame: Attempt to read 16 bytes [len = 6]
mbus_serial_recv_frame: Got 1 byte [remaining 16, len 6]
72 
mbus_serial_recv_frame: Attempt to read 15 bytes [len = 7]
mbus_serial_recv_frame: Got 1 byte [remaining 15, len 7]
53 
mbus_serial_recv_frame: Attempt to read 14 bytes [len = 8]
mbus_serial_recv_frame: Got 1 byte [remaining 14, len 8]
16 
mbus_serial_recv_frame: Attempt to read 13 bytes [len = 9]
mbus_serial_recv_frame: Got 1 byte [remaining 13, len 9]
00 
mbus_serial_recv_frame: Attempt to read 12 bytes [len = 10]
mbus_serial_recv_frame: Got 1 byte [remaining 12, len 10]
62 
mbus_serial_recv_frame: Attempt to read 11 bytes [len = 11]
mbus_serial_recv_frame: Got 1 byte [remaining 11, len 11]
96 
mbus_serial_recv_frame: Attempt to read 10 bytes [len = 12]
mbus_serial_recv_frame: Got 1 byte [remaining 10, len 12]
15 
mbus_serial_recv_frame: Attempt to read 9 bytes [len = 13]
mbus_serial_recv_frame: Got 1 byte [remaining 9, len 13]
03 
mbus_serial_recv_frame: Attempt to read 8 bytes [len = 14]
mbus_serial_recv_frame: Got 1 byte [remaining 8, len 14]
31 
mbus_serial_recv_frame: Attempt to read 7 bytes [len = 15]
mbus_serial_recv_frame: Got 1 byte [remaining 7, len 15]
01 
mbus_serial_recv_frame: Attempt to read 6 bytes [len = 16]
mbus_serial_recv_frame: Got 1 byte [remaining 6, len 16]
00 
mbus_serial_recv_frame: Attempt to read 5 bytes [len = 17]
mbus_serial_recv_frame: Got 1 byte [remaining 5, len 17]
00 
mbus_serial_recv_frame: Attempt to read 4 bytes [len = 18]
mbus_serial_recv_frame: Got 1 byte [remaining 4, len 18]
00 
mbus_serial_recv_frame: Attempt to read 3 bytes [len = 19]
mbus_serial_recv_frame: Got 1 byte [remaining 3, len 19]
0F 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 20]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 20]
35 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 21]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 21]
16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

Found a device on secondary address 6200165396150331 [using address mask 62FFFFFFFFFFFFFF]
mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 63 FF FF FF FF 1E 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 63 FF FF FF FF 1E 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 64 FF FF FF FF 1F 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 64 FF FF FF FF 1F 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 65 FF FF FF FF 20 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 65 FF FF FF FF 20 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 66 FF FF FF FF 21 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 66 FF FF FF FF 21 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 67 FF FF FF FF 22 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 67 FF FF FF FF 22 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 68 FF FF FF FF 23 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
E5 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [5 bytes]: 10 5B FD 58 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 0]
68 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 1]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 1]
11 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 2]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 2]
11 
mbus_serial_recv_frame: Attempt to read 20 bytes [len = 3]
mbus_serial_recv_frame: Got 1 byte [remaining 20, len 3]
68 
mbus_serial_recv_frame: Attempt to read 19 bytes [len = 4]
mbus_serial_recv_frame: Got 1 byte [remaining 19, len 4]
08 
mbus_serial_recv_frame: Attempt to read 18 bytes [len = 5]
mbus_serial_recv_frame: Got 1 byte [remaining 18, len 5]
02 
mbus_serial_recv_frame: Attempt to read 17 bytes [len = 6]
mbus_serial_recv_frame: Got 1 byte [remaining 17, len 6]
72 
mbus_serial_recv_frame: Attempt to read 16 bytes [len = 7]
mbus_serial_recv_frame: Got 1 byte [remaining 16, len 7]
64 
mbus_serial_recv_frame: Attempt to read 15 bytes [len = 8]
mbus_serial_recv_frame: Got 1 byte [remaining 15, len 8]
47 
mbus_serial_recv_frame: Attempt to read 14 bytes [len = 9]
mbus_serial_recv_frame: Got 1 byte [remaining 14, len 9]
02 
mbus_serial_recv_frame: Attempt to read 13 bytes [len = 10]
mbus_serial_recv_frame: Got 1 byte [remaining 13, len 10]
68 
mbus_serial_recv_frame: Attempt to read 12 bytes [len = 11]
mbus_serial_recv_frame: Got 1 byte [remaining 12, len 11]
96 
mbus_serial_recv_frame: Attempt to read 11 bytes [len = 12]
mbus_serial_recv_frame: Got 1 byte [remaining 11, len 12]
15 
mbus_serial_recv_frame: Attempt to read 10 bytes [len = 13]
mbus_serial_recv_frame: Got 1 byte [remaining 10, len 13]
1F 
mbus_serial_recv_frame: Attempt to read 9 bytes [len = 14]
mbus_serial_recv_frame: Got 1 byte [remaining 9, len 14]
1B 
mbus_serial_recv_frame: Attempt to read 8 bytes [len = 15]
mbus_serial_recv_frame: Got 1 byte [remaining 8, len 15]
01 
mbus_serial_recv_frame: Attempt to read 7 bytes [len = 16]
mbus_serial_recv_frame: Got 1 byte [remaining 7, len 16]
00 
mbus_serial_recv_frame: Attempt to read 6 bytes [len = 17]
mbus_serial_recv_frame: Got 1 byte [remaining 6, len 17]
00 
mbus_serial_recv_frame: Attempt to read 5 bytes [len = 18]
mbus_serial_recv_frame: Got 1 byte [remaining 5, len 18]
00 
mbus_serial_recv_frame: Attempt to read 4 bytes [len = 19]
mbus_serial_recv_frame: Got 1 byte [remaining 4, len 19]
00 
mbus_serial_recv_frame: Attempt to read 3 bytes [len = 20]
mbus_serial_recv_frame: Got 1 byte [remaining 3, len 20]
0F 
mbus_serial_recv_frame: Attempt to read 2 bytes [len = 21]
mbus_serial_recv_frame: Got 1 byte [remaining 2, len 21]
86 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 22]
mbus_serial_recv_frame: Got 1 byte [remaining 1, len 22]
16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

Found a device on secondary address 6802476496151F1B [using address mask 68FFFFFFFFFFFFFF]
mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 69 FF FF FF FF 24 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 69 FF FF FF FF 24 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 7F FF FF FF FF 3A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 8F FF FF FF FF 4A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

mbus_serial_send_frame: Dumping M-Bus frame [17 bytes]: 68 0B 0B 68 73 FD 52 FF FF FF 9F FF FF FF FF 5A 16 
mbus_serial_recv_frame: Attempt to read 1 bytes [len = 0]
mbus_serial_recv_frame: Got 0 byte [remaining 1, len 0]

err: null
data: []
Apollon77 commented 6 years ago

A secondary Scan will go over the secondary ids and not the primary ones ... everything ok. In his case there are two devices answering - or one device with multiple secondary ids!! So as soon as he scans the "6" area the answer on the bug is "00 44 00" which is not E5 (whioch would be one device), so he starts scanning 60..69 and here one answer comes at "62" and one on "68". With this: collision solved ... in theory this whol e collision detection could go all 16 digit a secondary Id has :-) But this is kind of uncommon and would be really big surprise.

I think I fixed the handling and currently build it into the tests and think later today I will have it ready for testing. Then also su-scans should return their findings

wmmihaa commented 6 years ago

Awesome!

wmmihaa commented 6 years ago

Let me know and I can test it right away and give you feedback

Apollon77 commented 6 years ago

So tests green. For now (because I did not release the version on npm so far) you can try to install directly from Github

npm install Apollon77/node-mbus#fix-secondary

But to be honest ... I have no idea if this works on install. Try it. If not I release later on npm as update

Apollon77 commented 6 years ago

Tests still not fixed on windows ... need to see later

wmmihaa commented 6 years ago

npm-debug.log I wasn't able to install, but i can wait till you've published the npm package. I've attached the log output if it is of any help.

BTW If you want to publish the package without making it @latest, you can tag it with beta:

npm publish --tag beta
Apollon77 commented 6 years ago

So 0.5.1 available on npm officially as latest ... Happy testing :-)

wmmihaa commented 6 years ago

Well done! Found a device on secondary address 6200165396150331 [using address mask 62FFFFFFFFFFFFFF] Found a device on secondary address 6802476496151F1B [using address mask 68FFFFFFFFFFFFFF] err: null data: [ "6200165396150331", "6802476496151F1B" ]

Apollon77 commented 6 years ago

I now only need to remove that logging from mbus itself :-)

Apollon77 commented 6 years ago

0.5.2 has removed the logging output