Skip to content

Commit

Permalink
Update describe message packet.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlkalberer committed Apr 4, 2024
1 parent 72beb05 commit a64b74e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brewskey/spark-server",
"version": "1.0.7",
"version": "1.0.8",
"license": "AGPL-3.0",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/spark-protocol/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brewskey/spark-protocol",
"version": "1.0.6",
"version": "1.0.8",
"main": "./dist/index.js",
"repository": {
"type": "git",
Expand Down
12 changes: 9 additions & 3 deletions packages/spark-protocol/src/clients/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,8 @@ class Device extends EventEmitter {
},
'Payload empty for Describe message',
);
cleanUpListeners();
reject(new Error('Payload empty for Describe message'));
// cleanUpListeners();
// reject(new Error('Payload empty for Describe message'));
return;
}

Expand Down Expand Up @@ -1112,7 +1112,13 @@ class Device extends EventEmitter {
// Because some firmware versions do not send the app + system state
// in a single message, we cannot use `listenFor` and instead have to
// write some hacky code that duplicates a lot of the functionality
this.sendMessage('Describe');
this.sendMessage('Describe', null, [
{
// Passing this because it seems like it's required now..?
name: CoapMessage.Option.URI_QUERY,
value: Buffer.from([0x2]),
},
]);
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/WebhookManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CoreOptions, UrlOptions } from 'request';
const WEBHOOK_BASE: Webhook = {
event: 'test-event',
requestType: 'POST',
url: 'https://webhook-test.com/67fcfefd07229639ddc49a1ba71816f2',
url: 'https://webhook.site/7d7dff97-b980-4d36-a4ed-ac7e94cc0c0f',
created_at: new Date(),
id: 'test-id',
ownerID: 'test-owner-id',
Expand Down Expand Up @@ -294,7 +294,7 @@ describe('WebhookManager', () => {
const event = getEvent(data);
const webhook = {
...WEBHOOK_BASE,
url: 'https://webhook-test.com/67fcfefd07229639ddc49a1ba71816f2/{{t}}/{{g}}',
url: 'https://webhook.site/7d7dff97-b980-4d36-a4ed-ac7e94cc0c0f/{{t}}/{{g}}',
};
const defaultRequestData = getDefaultRequestData(event);

Expand Down
4 changes: 3 additions & 1 deletion src/managers/WebhookManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ class WebhookManager {
return;
}
if (response.statusCode >= 400) {
onResponseError(error || new Error(response.statusMessage));
onResponseError(
error || new Error(JSON.stringify(response.toJSON())),
);
return;
}

Expand Down

0 comments on commit a64b74e

Please sign in to comment.