Skip to content

Commit

Permalink
also allow device as top level object type for instance (#2768)
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 authored May 25, 2024
1 parent df1c863 commit 56d9e4a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/adapter/src/lib/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11799,8 +11799,14 @@ export class AdapterClass extends EventEmitter {
for (const instObj of instanceObj.instanceObjects) {
const obj: IoPackageInstanceObject & { state?: unknown } = instObj;

const allowedTopLevelTypes: ioBroker.ObjectType[] = ['meta', 'device'];

// the object comes from non-checked io-package, so treat the id as unknown
if (!obj || typeof (obj._id as unknown) !== 'string' || (!obj._id && obj.type !== 'meta')) {
if (
!obj ||
typeof (obj._id as unknown) !== 'string' ||
(obj._id === '' && !allowedTopLevelTypes.includes(obj.type))
) {
this._logger.error(
`${this.namespaceLog} ${this.namespace} invalid instance object: ${JSON.stringify(obj)}`
);
Expand Down

0 comments on commit 56d9e4a

Please sign in to comment.