Skip to content

Commit 0829046

Browse files
committed
feat: add deviceType to shadow message
See NordicPlayground/thingy-rocks-dashboard-aws-js#81
1 parent ad1e707 commit 0829046

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lwm2m/fetchLwM2MShadows.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ export const fetchLwM2MShadows = (
2727
return (
2828
await Promise.all<LwM2MShadow>(
2929
(things ?? []).map(async ({ thingName, shadow }) => {
30-
const alias = (await deviceInfo(thingName as string)).alias
30+
const { alias, type } = await deviceInfo(thingName as string)
3131
const reported = JSON.parse(shadow ?? '{}').name.lwm2m.reported
3232
if (reported === undefined)
3333
return {
3434
deviceId: thingName as string,
3535
alias,
36+
deviceType: type,
3637
objects: [],
3738
}
3839

3940
try {
4041
return {
4142
deviceId: thingName as string,
4243
alias,
44+
deviceType: type,
4345
objects: shadowToObjects(reported).filter((instance) => {
4446
const updateTs = instanceTs(instance)
4547
return (
@@ -62,6 +64,7 @@ export const fetchLwM2MShadows = (
6264
return {
6365
deviceId: thingName as string,
6466
alias,
67+
deviceType: type,
6568
objects: [],
6669
}
6770
}

0 commit comments

Comments
 (0)