Multiple Devices post install

Just started working with THR and it is working well for me so far.

My setup consists of a combinations of zwave, hue, spotify, ecobee, and home made sensors. I aggregate and perform all of my automations in Node-Red. I have created http connections in Node-Red for all of my devices so that I can control everything through a common rest api.

I am now making device plugins in THR for all of my different device types. I have my first basic switch working but now have a question:

My plugin creates a single device which would mean I would have to install the plugin multiple times to create devices for my 50+ switches. I have seen how to create multiple devices at install/sync but is there a way to dynamically add a device after the plugin is installed? (i.e. cut and paste existing)

Thanks in advance,

Yes. There are 2 ways to do this:

  1. In the app, go to the Settings page & select your device source. This will open an editor page that has a Sync button. Click that & it will pull in all of your new available devices.

  2. In the Designer, right-click the device source & select “Synchronize Devices”. This will also pull in all of your available device objects.

These methods only generate the device objects. You still have to add them to a Group.

For your Plugin, you will need to update the onSynchronizeDevices function to generate objects for all 50 switches. Please review the Fibaro Global Variables plugin & look at what it’s doing in onSynchronizeDevices. It generates a device object for every single global variable.

Thanks for a quick response. I have about 12 different types of devices in my api - would you recommend creating one plugin that generates all of the devices, but creating different capabilities as they are synced? Or would it be better to create 12 different plugins? Is there a benefit to one approach over the other?

It’s better to use a single plugin that generates 12 device objects. Do exactly like I did with that Fibaro Global variables plugin. It reads all of the global variables from Fibaro & then creates a device object for each one.