Skip to content

Commit

Permalink
Trim null characters on spaces when searching for zigbee model. Koenk…
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Jan 14, 2019
1 parent aa32156 commit 489a23c
Show file tree
Hide file tree
Showing 6 changed files with 282 additions and 99 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ install:
- npm install

script:
- npm test
- npm run verify
- npm run eslint

Expand Down
2 changes: 1 addition & 1 deletion converters/toZigbee.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const utils = require('./utils');
const zclId = require('@zigbee/zcl-id');
const zclId = require('zcl-id');

const cfg = {
default: {
Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ for (const device of devices) {

module.exports = {
devices,
findByZigbeeModel: (model) => byZigbeeModel.get(model),
findByZigbeeModel: (model) => {
let device = byZigbeeModel.get(model);

if (!device) {
device = byZigbeeModel.get(model.replace(/\0.*$/g,'').trim());
}

return device;
},
toZigbeeConverters: toZigbee,
fromZigbeeConverters: fromZigbee,
};
Loading

3 comments on commit 489a23c

@qm3ster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there an actual problem with @zigbee/zcl-id?
Or is this about equality identity because some other layers of the stack you are using depend on zcl-id?

In either case, can I suggest you switch back @zigbee/zcl-id and change the package.json>name of https://github.com/Koenkk/zcl-id to "@zigbee/zcl-id"?

Then you can still install your version by git commit, but it will mount to the correct place so this back-and-forth can be avoided.

(This is because we don't have access to zcl-id npm name, but you are welcome to publish whatever you want under @zigbee)

@Koenkk
Copy link
Owner Author

@Koenkk Koenkk commented on 489a23c Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to use the same repo for zigbee2mqtt and zigbee-shepherd-converters.

Once the segmentation fault issue is fixed I will switch zigbee2mqtt and zigbee-shepherd-converters to @zigbee

@qm3ster
Copy link
Contributor

@qm3ster qm3ster commented on 489a23c Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.
I suggest you rename the packages in your forks (zcl-id,zcl-packet,cc-znp etc) to @zigbee/, by changing the "name": inside their package.json in their repos.
This way you can easily switch from your git sources to @zigbee/ npm sources with a single change to package.json (and back in case of problems/wanting to develop a feature on your fork), without changing imports and such.
This also makes testing the whole stack locally easier by using npm link, without having to use aliases (available in yarn and pnpm, but not npm).

Edit: maybe don't rename yet, there is a chance we are getting the original NPM names.

Please sign in to comment.