How to hardcode a device?


I have the idea that this is a very basic question but I haven’t been able to find a solution.

Due to the impossibility to connect directly ST so it can triggers a LIFX lighting scene (I know about IFTTT but I don’t want to use it), I want to replicate the scene from code and to do this I would like that the bulbs get hardcoded so they do not need to be part of the configuration.

The question is: How can I hardcode the light bulbs that I want to use? I was thinking that maybe something like the “Device Network Id” could be useful, but I do not know how to use it.


I’m confused… :confused:

Did you do a Forum search for LIFX? I don’t have such bulbs, but it looks like there are various workable solutions / device types.

Once you have a working device type; then you can create instances of the Bulbs, and use either Smart Lighting or any number of existing or a simple new SmartApp that requests a list of Bulbs and runs your scene.

Or am I missing some requirement here?

I can’t help you with your code question, but I suggest you talk to the folks in the following thread, as they seem to be the ones who are doing the most with LIFX and smartthings right now and they can probably save you some time in the process.


Before we go too far down this path, I also wanted to mention that SmartThings is still a cloud-based architecture. At the present time, no custom code is allowed to run locally, it all runs in the cloud. So if you do write your own code, it won’t solve the issue that you brought up in another thread of wanting things to run locally if the Internet is unavailable.

@pstuart might have more to say on LIFX bulbs specifically.

1 Like

If you setup the scene in LIFX you can borrow some of my code to make a device handler that will set scenes by using the LIFX api versus the way you are thinking… Make sense? Or if you just want to control a group or set of groups you can use LIFX Group of Groups.

1 Like

Hi whoismoses,

Well, this post has completely changed from my original intention that was to get a way to hardcode any device, not only LIFX light bulbs, on an SmartApp. Nevertheless, you give me some very good pointers.

Currently, using JDRoberts suggestions from another post, I created virtual switches to create IFTTT triggers that change my light scenes. Switches that are being triggered by an Aeon minimote for which I wrote a SmartApp so it can be usable with multi-clicking (this way I can use the same button to trigger 5 scenes instead of the built in 2).

The code from your github and the LIFX api that you reference me will allow me to connect directly to the LIFX scenes and avoid an anoying “Error parsing ifttt payload OK” message that I have not been able to solve.

I’ll probably work on that tomorrow. I’ll write about my results as soon as I can make it work.



So, it took me a couple of days to find the time to code this but I was able to obtain the list of scenes from LIFX api, set them as options for my different buttons and trigger the scenes directly from the LIFX api without IFTTT.

Now I am missing the part about retaining the lifx scene names for reconfiguration and allowing the reconfiguration without loosing all the previous configuration. I’ll post my final code when I am able to do so.

Thanks for all the help.

EDIT: I’ll create a thread specific for this project as the title is completely misleading. Anyway, I am still puzzled if we can hardcode a device.

1 Like

If you are stuck, put your code in github, maybe I or others can help.

BTW - I started writing my own LIFX bulb handler. I’d say it is beta right now. It seems to work rather well. It doesn’t use a parent app, so you need an api key to use it. Sounds like you have that…

Feel free to test it out or use it to figure out how to solve some of your issues.

Can you be more clear about what you mean by “hardcode a device”? If you mean reference a specific device in a custom smartapp, then, yes, you can do that. But the smartapp is still going to run in the cloud.

If you mean access a specific smartthings-controlled device from an outside service, then, yes, that can also be done, by communicating to the SmartThings cloud account.

If you mean directly access a specific smartthings –controlled device over LAN to the hub, then probably no.

1 Like