SmartThings Community

Dog food countdown timer - My first attempt at a DTH

(Mike Harvey) #1

So I have wanted to create something with SmartThings for a while but don’t know how. I have started reading the docs files and have just started tinkering to see what I can do.

What I really wanted was a tile in the ST app that shows me how long is left before I need to feed the dog again. (usual problem, I don’t know if the gf has fed him already this morning etc.)

So I started with a virtual switch and have worked from there.

I now have a working DTH that counts down from a set number of hours and turns the switch on when the counter hits 0 this meant I can actually turn on a lamp at the same time with Smart Lighting App. (More on this later as I am planning to create an indicator light that sits in the dog food drawer!)

So it works and I am almost happy but there are a couple of improvements that I want to make and don’t know how. ANY SUGGESTIONS ARE MORE THAN WELCOME!


So I really struggled trying to get a couple of things to work. I guess I have learnt now the difference between a DTH and a smartapp. I have now moved the automation bits (specifically the runIn() command) into the smartapp and kept the tile info etc in the DTH. I have also merged the DTH with one for a ZLL Dimmer bulb so it works exactly as I wanted and drives a bulb to act as an indicator.
The next step is to strip apart the bulb and create a battery powered led indicator using the board!!! (not sure how well this will go)

New DTH:


(Mike Harvey) #3

I’d really love some feedback if anyone wants to comment.
I have zero background of programming and have amazed myself that I have managed to get this to work.
I put this DTH onto an Ikea Tradfri GU10 dimmer bulb and it works a treat.
I am pretty sure that I can strip the board out of that bulb next, power it from batteries and drive a small green LED so I have a device that indicates when the set amount of hours is up.
The Tradfri bulb was £7 so if I can get a small project box and battery holders for a few quid then I’m sure I can do this for little over a tenner!