A few years back I decided to start raising chickens. By that time I had beetles, worms, snakes, and frogs; you name it! But raising these cute yellow nuggets is a different beast altogether.

At first, it sounds fun. All you do is buy a dozen online and follow the instructions. But what I didn’t know is that your entire experience is driven by the survival rate of your chicks.

So be sure you are ready to commit to their well being. It’s not easy being a chicken master! Many of them pass into the light right in front of you.

In fact, mastering the light is the most important instrument in raising your chicks. The lamp provides constant heat, regulating their body temperature. It must stay consistent at 95–100 degrees, especially in the first two weeks.

I’ve raised a dozen with a regular thermometer and a heat lamp. And noticed that sometimes chicks would get cold and cuddle into a large ball, only to squish a few in the process.

But then when the heat got high, some of the chicks would sweat and often fall ill.

This time, I knew controlling the heat would help the chicks through the initial two weeks. I had to find a way to control the light and measure the temperature.

The easiest path to hardware hacking is by using Wireless Sensor Tags. Which come with JavaScript in the cloud capabilities right out of the box.

All you need is the Wireless Sensor Tag (with Temperature) and device to control the light.

https://store.wirelesstag.net/products/wireless-tag

Its true, they are very small and come with 700 ft range and 1-year battery life. I have been using them for years.

Wireless Sensor Tags integrates with Belkin Wemo Switch, which controls an appliance power.

You can buy the Belkin Wemo Switch here or on e-bay

https://www.belkin.com/us/p/P-F7C027/

After you have both, all you do is plug the Tag Manager into your router and set up the Belkin Wemo Switch, it just works.

This is one of the easiest setups on the market.

Afterward, go to http://my.wirelesstag.net/ and create an account for your tag manager. There you’ll be able to associate it and your Wemo Switch. Just click the + Associate button on the top left corner.

After setting it all up, you should have both light and sensor in Wireless Tag List:

1) Now, click on the Kumo Apps to set up your app

2) In the top right corner select Install

3) Click on this icon

4) In the search start typing “When temperature is too high, turn on Wemo, when temperature is back to normal, turn off Wemo (with delay)” and select it. We are going to use this application as a starter.

5) In the “Configure the App” screen select your sensor, switch & pick delay of 5. Click Apply

6) You should have an app setup in the Kumo Apps list

7) Expand it and click on View Code

8) Take a minute to study the code and you’ll find that the program is rather simple. It consists of two main functions. The wemoAction & sensor.temperatureCross

A detailed description of all the KumoApp API calls: http://wirelesstag.net/kumoapp/17/tags-kumosensors-kumostats

sensor.temperatureCross — gets executed when the tag has too hot/too cold monitoring enabled. This boundary is configured as part of the sensor configuration.

This routine then calls wemoAction to turn on or off the Wemo Switch.

This should have been good enough, but I found that KumoApp would not work as intended when Wemo Switch disconnected from the internet. This happens with WIFI enabled devices.

The temperatureCross event would execute but my Wemo Switch can’t receive the event. I decided to re-write the program with a more pro-active approach.

Instead of having to wait for a temperatureCross callback from the sensor, I need to have the program ping the sensor to see if the heat lamp needs to be on.

9) Go ahead and copy paste the following code into the application, and click Create / Update App. I will explain how it works below:

10) Click the Start Button!