Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deconz not detected #11

Closed
chas-iot opened this issue Nov 30, 2020 · 19 comments
Closed

deconz not detected #11

chas-iot opened this issue Nov 30, 2020 · 19 comments

Comments

@chas-iot
Copy link

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:

  • I did not see any output from DEBUG && console.log('SerialProber: Rcvd:', chunk);
  • A different layer of the serial port management detects USB Serial Device 1cf1:0030 Vendor: dresden elektronik ingenieurtechnik GmbH Serial: DE2217317 found @ /dev/ttyACM0, which matches the probe set up for deconz.

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
Copy link
Author

chas-iot commented Dec 1, 2020

Still cannot get it working ☹️

  • I installed the deCONZ application, which does work, so I haven't bricked the dongle 🙂
  • from reading the code, the serial ports are 'pre-detected' at the USB level before probing with serial
  • there's no response received to the probe. I tries a few alternate baud rates (that takes me back so many years ), but no change

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

@frederic34
Copy link
Contributor

I had the same problem, and I know howto fix

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

I had the same problem, and I know howto fix

Please tell me more?

@frederic34
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

for frame-builder.js in deconz-api

frame_builder[C.FRAME_TYPE.VERSION] = function(_frame, _builder) {
  _builder.appendUInt32LE(0);
};

@frederic34
Copy link
Contributor

frederic34 commented Dec 1, 2020

dongle does'nt respond anymore if the command is incomplete

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

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
Copy link
Contributor

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

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

@frederic34 - Thank-you 🙂

@mrstegeman @dhylands - any thoughts or advice?

@frederic34
Copy link
Contributor

there is an issue on deconz github with explanation

@frederic34
Copy link
Contributor

@chas-iot happy to know you are online again

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

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
Copy link
Contributor

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

I updated dresden-elektronik/deconz-rest-plugin#3787 with a request for updated documentation.

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

@chas-iot
Copy link
Author

chas-iot commented Dec 1, 2020

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

@dhylands
Copy link
Contributor

dhylands commented Dec 1, 2020 via email

@chas-iot
Copy link
Author

chas-iot commented Dec 2, 2020

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

chas-iot added a commit to chas-iot/deconz-api that referenced this issue Dec 5, 2020
Part 1 (of 2) of handling the latest deconz firmware

Original code from @frederic34 in WebThingsIO/serial-prober-node#11 (comment)

From reading the spec at page 9 of
https://deconz.dresden-elektronik.de/raspbian/deCONZ-Serial-Protocol-en_1.14.pdf
this should already have been present since at least 2019.
Apparently the newer firmware is more strict and checks message lengths,
rejecting messages for incorrect formats.
chas-iot added a commit to chas-iot/deconz-api that referenced this issue Dec 5, 2020
Part 1 (of 2) of handling the latest deconz firmware

Original code from @frederic34 in WebThingsIO/serial-prober-node#11 (comment)

From reading the spec at page 9 of
https://deconz.dresden-elektronik.de/raspbian/deCONZ-Serial-Protocol-en_1.14.pdf
this should already have been present since at least 2019.
Apparently the newer firmware is more strict and checks message lengths,
rejecting messages for incorrect formats.
chas-iot added a commit to chas-iot/zigbee-adapter that referenced this issue Dec 5, 2020
mrstegeman pushed a commit to WebThingsIO/deconz-api that referenced this issue Jan 26, 2021
* Add the U32 Version payload to the 0x0D VERSION messages

Part 1 (of 2) of handling the latest deconz firmware

Original code from @frederic34 in WebThingsIO/serial-prober-node#11 (comment)

From reading the spec at page 9 of
https://deconz.dresden-elektronik.de/raspbian/deCONZ-Serial-Protocol-en_1.14.pdf
this should already have been present since at least 2019.
Apparently the newer firmware is more strict and checks message lengths,
rejecting messages for incorrect formats.

* correctness

Co-authored-by: Fabian Frey <mrsteakhouse1@googlemail.com>

Co-authored-by: Fabian Frey <mrsteakhouse1@googlemail.com>
mrstegeman pushed a commit to WebThingsIO/zigbee-adapter that referenced this issue Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants