-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I've noticed that when the virtual things adapter is installed and enabled, the adapter sends a bunch of thingAdded IPC messages to the gateway on startup.
I think this is a result of this.adapter.handleDeviceAdded(this)) being called in the constructor of the VirtualThingsDevice class https://github.com/WebThingsIO/virtual-things-adapter/blob/master/virtual-things-adapter.js#L1318
The result of this is that when the add-on starts up, it sends a thingAdded message to the gateway for each of the many virtual things exposed by the add-on. For things which have already been added to the gateway this results in its Thing Description being over-written in the gateway's database with the Thing Description provided in the IPC message.
This means that every time the gateway starts up there are multiple database writes happening that don't need to happen.
I think thingAdded messages are only meant to be sent by adapters when the gateway starts the pairing process, so these messages shouldn't be sent at all on startup.