Measure the color temperature

I have a new project in my mind. My bathroom has a dark old light, and I want to upgrade this to a smart light, that’s the easy part. Since there is a big window right in front of the bathroom while in the bathroom there is no window, the light change for the eye from sunlight to another light temperature is pretty weird. Because of this, I would appreciate if the light temperature of the light in the bathroom would adjust to the color temperature of the sun. Is there a light temperature sensor for outdoor, or do you have any other idea how to do that?

Sounds like a very interesting project!

So: can it be done? Absolutely. The physical measuring devices exist, and there are quite a few that are pretty inexpensive.

Has it been done? I’m not aware of anyone who has done this with SmartThings, because most people have just gone for “circadian light,” which is changing the color temperature based on time of day and maybe date. You’ll be able to find at least a couple of those. But—those projects don’t try to match the actual light outside. Just the most likely. Which means if it’s raining or overcast or a smog day the circadian light calculation will be wrong.

So most “circadian light” projects are simulations based on time of day, not weather conditions. Using one of those means your bathroom might look bright and sunny at noon while other rooms using natural light are cool and gray because it’s raining outside. Some people are fine with that, some are not.

(BTW, Apple HomeKit has “adaptive lighting” (their name for circadian lighting) built into HomeKit. So if you happen to have an iPad you could easily set this up with a Philips hue bridge and associated bulbs that you also used in SmartThings. No coding required. But it won’t match the real outside condition and you can’t use the circadian light information in SmartThings. But it’s a quick and easy way to get those lights to adjust, and if you already have a hue bridge and an iPad or HomePod mini, there’s no added cost.)


Then you’ll need a physical RGB sensor AND you’ll need to integrate the sensor to SmartThings AND you’ll need to write code to read its values AND you’ll need to write code to set your color temperature changing lightbulbs to match it.

The first two are pretty easy but, as I said, I don’t know if anyone else who has done steps three and four yet. And that’s not a basic out of the box SmartThings function.

I’m going to tag both @ogiewon and @bcopeland because both might have some more ideas.

I don’t know if you yourself have a coding background or are familiar with arduinos, but you can see why at this point some people just stop and say, “You know what? A time of day simulation is just fine with me. “ :wink:

But if you do want the real thing…


I’m sure you’ve already thought of this part, but just for completeness, the lightbulbs themselves have to be able to change color temperature when instructed to do so. The ones available to you will depend on what country you’re in, but Philips Hue has a fairly wide range available in multiple regions, including some already built into lamps and even some of those rated for bathroom use. These are expensive, but the engineering is great, and they can definitely work for the project.

There are a few other brand choices that might work as well, but again it depends on the country you are in.

One note on this step: many bathroom light fixtures are fully sealed in order to make them waterproof but most smart bulbs are not designed to work in a fully sealed fixture and will overheat. That’s why you have to be a little careful about the specifications. If it’s an all in one specifically designed for a bathroom environment, like the Philips hue models mentioned in their article, then there’s no issue, of course.

Also, look for the “lumens“ rating to determine how bright it will be, not just watts, since these will be LED bulbs. For example, one of the Phillips bathroom lights is a 40 W draw, but 2400 lm, which is an equivalent brightness to 200 W of incandescent bulbs. :sun_with_face::sun_with_face::sun_with_face:


Most of the cheap ones, under $20, will be parts that you add to an arduino. So they won’t have a radio themselves to communicate with SmartThings. Here’s one candidate, but they’re fairly easy to find.

Personally, though, I usually start at Adafruit for projects like this, and this caught my eye.

Interestingly, some people are using that one with Home Assistant for some similar projects. That would be a pretty long integration path to bring it into SmartThings, though, but if you happen to also be interested in Home Assistant (in some ways an open source competitor to SmartThings, but there are certainly people who use both), here’s that link:


Where was I? Oh, yeah…whatever sensor on a chip you use, you have to connect it to an arduino or something similar to get the ability to communicate to SmartThings. Here’s a link to a project about adding a sensor to an arduino. We’re still not at actual SmartThings integration yet, though. Just setting up the hardware so we COULD integrate with SmartThings if we wrote code on the ST side to handle the incoming data.

So here’s a project utilizing the Arduino color temperature sensor libraries.


What a great question! :wink: seriously, it’s a great question, and one that other people will have to help with the answer for. (I’m now quadriparetic and dependent on voice recognition and no longer code myself.) in addition to the two folks I’ve already tagged, I’m sure there will be other developers in the community who may be interested. Hopefully some will chime in. :sunglasses:


I mentioned this to a friend with a really sophisticated lighting system who said many people don’t want “natural” light in a bathroom all the time: they may want it much brighter for some personal care tasks, including reading the labels on prescription bottles. So you may want to also be able to switch to a “bright“ scene for those times. That part should be pretty easy as an override function, but it’s just something to be aware of in your planning. :thinking:


Thank you for your response.
Here, little information about my current setup.
I am living in Austria (Europe) and have the Aeotec hub for SmartThings. Currently, I have no Hue Bridge, because there was no needing for it, I also don’t have planned to buy one in the future. I also have no HomeAssistent, and don’t have planned to get it in the near future, but I’m open to set up HomeAssistent anywhere in the future.

I have a coding background my self and a senior coder in addition. We both are not familiar with arduinos and didn’t ever code sth in connection with arduinos or in connection with smarthome devices.

Thank you for your help! I’ll see forward for further replies.

1 Like

Yes, a few years back someone was asking about doing the exact same thing. @vseven added support for an Adafruit RGB Illuminance sensor to ST_Anything. So, the technology does exist, although this was before the “New” ST App was required. Not sure how well it would work these days. :wink:

1 Like

That’s the same sensor I mentioned above! It looks like a really nice device for the price.

And in the ESPHOME article that I linked to, They mentioned some specific parameter settings for that device, including the gain issue.

1 Like

So how do I proceed now?
I’ve found the sensor on Amazon, deliverable to Austria.

Again, that’s just the sensor piece, it doesn’t have a radio for communications. So you will still need to attach it to an Arduino or something else so that you can get it communicating with SmartThings or the SmartThings cloud.

@ogiewon should be able to give you good advice on that, he’s a grandmaster in that subject, although of course someone else may know as well. :sunglasses:

1 Like

That’s really up to you, your Arduino programming skill level, and whether or not you believe the Legacy Groovy IDE will be around long enough to make this worth your time and effort.

In the thread I linked above, you can go to the first post and start reading about how ST_Anything works. This may help in your decision whether or not to attempt this project. Again, I do not even know if this still works in the current ST environment (as I moved over to Hubitat back in early 2018 :wink:). Perhaps @vseven knows whether or not the RGB Illuminance sensor is still compatible with the current ST platform, or not? My ST hub has been powered down for a while now…

1 Like

I maybe wrong on this, and I know he may be too busy to take a look at it right now, but I think that some of the stuff that @TAustin has been doing with edge Drivers may eventually serve as a model for a new edge Driver version of ST_anything. He’s been doing really remarkable work, and I think the ability to bring in Arduino based sensors to the new edge environment might add to the options for power users.

I’m going to re-post the ST_anything link here just for convenience in case he or any of the other community developers working with the new platform wants to take a look

In my work with Shelly devices, I’ve found that their motion sensor has a LUX value. Would this be useful? You could then create routines to change your bulb temperature based on it. I’m sure there are other motion/light detectors with similar capability. No programming would be needed on your part.

The other nice thing with the Shelly device is that it is battery operated, so if you have enough protection from the weather, you could place it just outside your window… or keep it inside and just point it out your window. The battery is VERY long lasting and the wifi chip/antenna combo they use is good quality and doesn’t need a super-strong signal.

How would you implement that? Isn’t Lux Just how dark or light it is?

Yes, lux is level of brightness and not color temperature, so maybe not exactly what you want. But it’s an option.

If you find a device that specifically supports color temperature readings, and it has some kind of supported LAN interface API (RESTful, HTTP, etc.), then I can help with an Edge driver for it.

1 Like

The sensor the OP just purchased after discussions with @ogiewon and me is a color temperature sensor that will be connected to an Arduino. Then the Arduino would need to report the values to smartthings.

Several years ago @ogiewon created ST_anything, A project which allowed community members to bring arduino information into SmartThings for pretty much any sensors/switch they had attached to the Arduino. Making the Arduino the “head of the octopus“ in that sense. It was really well done and very popular. Originally intended for use with the ST zigbee shield, it was later updated to work with a WiFi radio instead.

So you ended up with an Arduino with a radio attached and a DTH that could take the incoming data from that Arduino and use it in smart things. With a separate child device for each device attached to the Arduino.

Obviously @ogiewon could give details better than I can, but that was the general idea.

So at this point the OP has purchased a sensor that can measure color temperature.

@ogiewon or others (or even the article I posted earlier) can get the OP started on connecting that sensor to an Arduino and using the Arduino color temperature libraries to capture the values. So that’s the measurement device from ST’s point of view.

Next step is to get that data from the Arduino (which can do RF communications with the right modules added) into smartthings. That’s what ST_anything did as a Groovy-based project. And that’s what would need to be written as something that works with edge.

Then the final step is some automation to use the data as the trigger in SmartThings so that you could then set lights to match that data. To be honest, I don’t know how that would be done these days. I don’t think there’s anything in the official routines to mirror color temperature, maybe there is. If not, I’m guessing it would have to be done with the rules API given that we don’t want to use webcore because it’s also groovy-based and will also be going away.

So I hope that’s clearer.

The OP has a physical sensor that can measure color temperature. But it doesn’t have a radio of any kind.

The usual way to bring that kind of device into smartthings is to connect it to an Arduino, which gives you RF communication. So far so good.

Up until the end of 2020, community members would then have used the Groovy ST_anything to bring that information into smartthings, including a child DTH for each sensor connected to the Arduino. But that will stop working once the smart things free groovy cloud goes away, so that’s why I thought you might have some ideas about replacing that step with something that works with edge.

I haven’t bought anything yet.

Btw I searched for Arduino and what I’ve read, There are different types of Arduino wich should I buy?

Uhm what happens with webcore? I have many automations done with webcore.

Samsung announced last year that they would no longer host a free Groovy cloud for smartthings, so anything which ran in the cloud, which includes webcore, has to be redone in order to run on the new platform.

Originally the transition was supposed to occur at the end of 2021, but obviously they missed that date, and they haven’t announced a new specific date yet.

Last summer they said that the new rules API would have equal functionality to webcore, but it doesn’t yet. However, it is still in development.

Here’s the official announcement thread:

You can also check the webcore forum to see what other people are planning to do.

The best supported and most economical Arduino IDE compatible microcontrollers and the NodeMCU ESP8266 and NodeMCU ESP32 based boards. These have onboard WiFi and thus just need a USB power supply to get them up and running. Wire up the RGB Illuminance sensor to the microcontroller, load a sketch with the PS_Illuminance_RGB device declared in it, and that side is complete. You then have to follow the instructions to get all of the ST_Anything DTHs added to the Legacy Groovy IDE.

Again, I haven’t tested any of this for the last 1.5 years on Smartthings. I cannot say definitively whether or not it still works.

1 Like