Occasionally, an idea pops into my mind and I instantly dismiss it as crazy. A few weeks ago, however, I had the idea of harnessing the power of modern 'smart home' devices to create more immersive Minecraft experiences. I remembered reading about LIFX WiFi connected light bulbs, and this instantly made me wonder if I could sync the light level of my home with the game. It was a challenge, but I knew that it was possible and therefore couldn't turn it down.
I did a little research, and purchased a bulb for Christmas. Light screwed in, MacBook at hand, I threw together a rough and ready prototype in about an hour. I used a Java API which I found here, and used Spigot to get the light level of my player. In hindsight, actually modding the game may have been better, but my experience meant that I was better starting with an API I already had knowledge in.
As you can see, things worked out pretty well. The next day, I switched over from the Java API I was using to one written in python called lightsd. It was more up to date, and also allowed me to access some extra API methods which helped in cleaning up my code. That's the version you'll find on GitHub. I also made sure that the light never went below a certain level, as I found through experimentation that this could lead to the light turning itself off and it then took several seconds for it to turn back on.
If I was to do more work on this project, I'd like to investigate more into the hardware running on the actual bulb. As you can see in the demonstration, there is a delay between me sending a TCP packet to the bulb and anything happening, which I'd like to be able to fix if possible. A bulb with colour could also be interesting, as with some sampling I could perhaps take the shades of nearby blocks into account.
Overall, I really enjoyed working on this. I'd like to do more projects based around the 'internet of things', but time may say otherwise. If you've got any questions about the project, I'm always avaliable on Twitter.