Capitalization Issue on Device Name

Take this sample code:

plugin.Name = "RokuTV";
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.PollingInterval = 1000;

function onChangeRequest(device, attribute, value) {
}

function onConnect() {
}

function onDisconnect() {
}

function onPoll() {
}

function onSynchronizeDevices() {
    var device = new Device();

    device.Id = plugin.Name;
    device.DisplayName = "Roku TV";

    plugin.Devices[plugin.Name] = device;
}

If I import that as a plugin and the device synchronizes, it adds a device with the name “RokuTv” (not “RokuTV”). Why might that be happening?

(Note that the plugin name comes in as “RokuTV”.)

It takes your DisplayName & converts it to a Name with Pascal casing. You should be able to override this by setting the Name property on the object directly.

Ok that makes sense, thanks. Yes, I did override it after I realized which I plugin wasn’t working. So the solution would be to only use Pascal-cased plugin names.

You don’t have to use Pascal naming for your devices. Something else is breaking it. The app is case-sensitive. So if you change casing all of your references would also have to be updated.

Hm - I must have done something else wrong that I have since fixed, because I can’t duplicate the issue I saw before. I tried some different scenarios and saw what you mean that the Device ID -> Name comes from DisplayName.

I’ll chalk this one up to a self-induced glitch.