Maker API reference by label vs device ID

Hi All:

Is there a way to use a Maker API referring to the device label rather then it's ID?

Recently I moved a dimmer from one place (living room) to another (stairs), then added another dimmer (living room).

I had to rename the old one (living room -> stairs), then renamed the new one to the old name (living room).

I had some Maker API's and, of course, these referred to the device by it's device ID, or number (like 34.) I had created shortcuts on my desktop (Windows), and after the move, they didn't work.

After doing a "get all devices" I found the device ID had changed.

I changed the device ID in my shortcuts, and it works now.

I can envision more changes in my life, and I'd rather not have to change the shortcuts on my 3 computers every time I move a device.

Thanks, Mark.

This is unlikely to happen because device labels do not have to be unique, unlike device IDs.

3 Likes

No, not through Maker API. Although, to be fair to Maker/HE, it sounds like your original LR device's ID didn't so much change, as the newly added one simply got its own, different deviceID.

For future reference check out the "Swap Device" utility which should be able to accommodate such swaps as you continue building out your system:

3 Likes

Although not in this instance. Because @CoolJavelin creates MakerAPI URL shortcuts on his Windows desktop, which can presumably be double-clicked to get specific device commands executed.

"Swap Apps Device" will not change the device ID in the pre-existing shortcuts on @CoolJavelin's desktop.

A better solution for them may be to use the built-in Dashboards app, or one of the several community Dashboard integrations.

2 Likes

I thought that the Swap Apps feature actually did “swap” the two device IDs of the actual devices. I don’t believe it touches any of the references to devices in all of the Apps.

2 Likes

But a URL saved on your desktop will include the old device's ID and wouldn't get updated by HE.

2 Likes

Ahh - then I misunderstood how it works.

Here is a nice explanation

3 Likes

Me too

3 Likes

This is correct, so for the Maker API use case above, it should work (if I'm interpreting the desired outcome correctly).

What some may be confusing this with is clone or import, where it offers the ability to swap or substitute devices. That does "reach in" to the app and swap out actual device references, so in apps that depend on the internal ID, like Maker API, using this feature would indeed result in differences with regard to how you'd need to use the external endpoints that are dependent on these (though I guess at that point your app ID would also be different, so you'd need to check all the URLs anyway).

4 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.