Script Instructions

Very new to Home Remote so might be using some of the wrong terminology - hopefully I make enough sense.

Are there any more complete guides on writing scripts? I need to write a plugin based on a custom rest api. I’ve got the basics working using the example provided but looking for more detailed information. I’ve looked through the forum and have found a few tidbits here and there but nothing that lays it all out.

For example:

  • object model for updating other elements
  • ability to configure a device that is based on a plugin

Thanks for any help.

The only information available are the docs on the website & the examples here in the forum.

You can only update devices. You cannot update elements on your XAML page directly from a plugin. It’ll need to be from a device binding. I’m guessing that is what you are referring to here.

You can use onSynchronizeDevices to assign Capabilities & Attributes to your devices. Here is an example that assigns the Switch capability to a device.

function onSynchronizeDevices() {
    var virtualSwitch = new Device();
    virtualSwitch.Id = "1";
    virtualSwitch.DisplayName = "Virtual Switch";
    virtualSwitch.Capabilities = ["Switch"];
    virtualSwitch.Attributes = [];
    plugin.Devices[virtualSwitch.Id] = virtualSwitch;
}
1 Like

Thanks for the quick response - that is helpful. I’ll play around with that.