WebThingsIO / serial-prober-node

node.js code for probing serial ports.
Mozilla Public License 2.0
0 stars 4 forks source link

deconz not detected #11

Closed chas-iot closed 3 years ago

chas-iot commented 3 years ago

This is a self-inflicted issue - at least in part ☹️ My deconz ZigBee dongle is not detected after upgrading the firmware. I tried putting back the earlier firmware, but still the same issue. An edited log follows, the lines regarding other dongles are removed.

Do you have any advice on how to further debug/fix?

What I have noticed:

2020-11-30 11:46:34.497 INFO : Loading add-on: zigbee-adapter 2020-11-30 11:46:35.302 INFO : zigbee-adapter: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3 2020-11-30 11:46:35.667 INFO : zigbee-adapter: Loading add-on zigbee-adapter from /home/pi/.mozilla-iot/addons/zigbee-adapter 2020-11-30 11:46:35.721 INFO : zigbee-adapter: DEBUG config = 'serialProber' 2020-11-30 11:46:35.723 INFO : zigbee-adapter: Enabling DEBUG_serialProber 2020-11-30 11:46:35.941 INFO : zigbee-adapter: SerialProber: Probing /dev/ttyACM0 at 38400 for deConz 2020-11-30 11:46:35.942 INFO : zigbee-adapter: SerialProber: Opening /dev/ttyACM0 at 38400 baud 2020-11-30 11:46:35.948 INFO : zigbee-adapter: SerialProber: Probing /dev/ttyACM0 ... 2020-11-30 11:46:35.951 INFO : zigbee-adapter: SerialProber: Sent: <Buffer c0 0d 01 00 05 00 ed ff c0> 2020-11-30 11:46:36.452 INFO : zigbee-adapter: SerialProber: closing /dev/ttyACM0 2020-11-30 11:46:36.453 INFO : zigbee-adapter: SerialProber: timeout: deConz dongle not detected on /dev/ttyACM0 2020-11-30 11:46:36.456 ERROR : zigbee-adapter: SerialProber: timeout: deConz dongle not detected on /dev/ttyACM0 2020-11-30 11:46:36.460 INFO : zigbee-adapter: SerialProber: /dev/ttyS0 filter for deConz didn't match. 2020-11-30 11:46:36.462 INFO : zigbee-adapter: Serial ports that were found: 2020-11-30 11:46:36.634 INFO : zigbee-adapter: USB Serial Device 1cf1:0030 Vendor: dresden elektronik ingenieurtechnik GmbH Serial: DE2217317 found @ /dev/ttyACM0 2020-11-30 11:46:36.635 INFO : zigbee-adapter: Serial Device found @ /dev/ttyAMA0 2020-11-30 11:46:36.636 INFO : zigbee-adapter: Serial Device found @ /dev/ttyS0 2020-11-30 11:46:36.637 ERROR : zigbee-adapter: Failed to start add-on zigbee-adapter: No Zigbee dongle found

chas-iot commented 3 years ago

Still cannot get it working ☹️

chas-iot commented 3 years ago

logged https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3787

frederic34 commented 3 years ago

I had the same problem, and I know howto fix

chas-iot commented 3 years ago

I had the same problem, and I know howto fix

Please tell me more?

frederic34 commented 3 years ago
const deconzSerialProber = new SerialProber({
  name: 'deConz',

  allowRPIAMASerial: true,

  baudRate: 38400,
  // deConz VERSION Command - deConz pdf protocol page 9 of 21
  probeCmd: [
    0xc0,       // END - SLIP Framing
    0x0d,       // VERSION Command
    0x01,       // Sequence number
    0x00,       // Reserved - set to zero
    0x09, 0x00, // Frame length
    0x00, 0x00, 0x00, 0x00,
    0xe9, 0xff, // CRC
    0xc0,       // END - SLIP framing
  ],
  probeRsp: [
    0xc0,       // END - SLIP framing
    0x0d,       // VERSION Command
    0x01,       // Sequence NUmber
    0x00,       // Reserved
    0x09, 0x00, // Frame length
    // This would normally be followed a 4 byte version code, CRC, and END
    // but since we don't know what those will be we only match on the first
    // part of the response.
  ],
  filter: [
    {
      vendorId: /0403/i,
      productId: /6015/i,
    },
    {
      vendorId: /1cf1/i,
      productId: /0030/i,
    },
  ],
});
frederic34 commented 3 years ago
function calcCrc(buffer, len) {
  let crc = 0;
  for (let i = 0; i < len; i++) {
    crc += buffer[i];
  }
  return (~crc + 1) & 0xffff;
}
console.log(calcCrc([
  0x0d,       // VERSION Command
  0x01,       // Sequence number
  0x00,       // Reserved - set to zero
  0x09, 0x00, // Frame length
  0x00, 0x00, 0x00, 0x00,
]
, 9));        // packet size
frederic34 commented 3 years ago

for frame-builder.js in deconz-api

frame_builder[C.FRAME_TYPE.VERSION] = function(_frame, _builder) {
  _builder.appendUInt32LE(0);
};
frederic34 commented 3 years ago

dongle does'nt respond anymore if the command is incomplete

chas-iot commented 3 years ago

that works 🙂

Do you know if these changes work with both old and new firmware? It's definitely worth getting the changes integrated into the packages

frederic34 commented 3 years ago

i did'nt test with old firmware, I will test with conbee II since my raspbee is upsgraded

chas-iot commented 3 years ago

@frederic34 - Thank-you 🙂

@mrstegeman @dhylands - any thoughts or advice?

frederic34 commented 3 years ago

there is an issue on deconz github with explanation

frederic34 commented 3 years ago

@chas-iot happy to know you are online again

chas-iot commented 3 years ago

there is an issue on deconz github with explanation

I've spent a while searching but so far did not find a link to this issue. Do you have the link?

frederic34 commented 3 years ago

https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3260#issuecomment-692771585

chas-iot commented 3 years ago

I updated https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3787 with a request for updated documentation.

I'll add a pointer to that comment, thanks @frederic34

chas-iot commented 3 years ago

reading this comment https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3260#issuecomment-692486099 , it appears that using the new length with the old firmware should work. I'll ask for clarification once their tech support respond

dhylands commented 3 years ago

Another option worth exploring is to keep the old probe and add a new probe with the new length.

On Tue, Dec 1, 2020 at 1:46 AM chas-iot notifications@github.com wrote:

reading this comment dresden-elektronik/deconz-rest-plugin#3260 (comment) https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3260#issuecomment-692486099 , it appears that using the new length with the old firmware should work. I'll ask for clarification once their tech support respond

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/WebThingsIO/serial-prober-node/issues/11#issuecomment-736360453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA7EDAENEI6KHQLPXVGU7LSSS3QRANCNFSM4UHAQCWA .

-- Dave Hylands Peachland, BC, Canada http://www.davehylands.com

chas-iot commented 3 years ago

Another option worth exploring is to keep the old probe and add a new probe with the new length.

Thank-you @dhylands 🙂 I'm thinking about that while waiting for the updated documentation. The wrinkle is that there's this change - which can easily be handled, however we need to know the impact first

for frame-builder.js in deconz-api


frame_builder[C.FRAME_TYPE.VERSION] = function(_frame, _builder) {
  _builder.appendUInt32LE(0);
};```
Once we get the docs, I'm sure @frederic34 and I can quickly get it working. Hopefully before dongles with the new firmware start shipping