Automatic Coffee Machine (Yes it can…)

Posted: August 3, 2008 in Flash
Tags: , , , , , , , , ,

One thing I always wanted to do was be able to setup a automatic coffee machine and turn it on at will.  Yes I know there are many out there already that do this, but we want to automate this right??

So after checking with my die hard Insteon users’ regarding wattage and amps.  I decided to give a try putting a  Icon’s Appliance Link, and see how it works. Below is my candidate #27.  You can get this off of Ebay like for $25 each.

The Applicance link Is rated 400 watts and 10amps, after playing with the Kill a watt device (Which by the way are worth every penny, they can tell you how much watts, amps and other goodies any device you plug into them.) It comes in at 825 watts but only 8amps.  So it should work. 🙂 And work it did.

Here is a picture of #27,Icon Appliance Link next to a Insteon dimmer which has all the features of the decora style , and a regular toggle switch

So after creating a simple Flash screen it will relay the information back to the server.

Here is my screen, basically allows you to turn on the device at a certain time and leave it on after that.

The button are tradition button which increment the time, below the current time is updated each second.  I show this here

Flash:Showing the ‘time’ in flash continuously.

The action script is very simple,  create the fields one for the hour and put the var field called ‘chours’, the minutes is called ‘minutes’ the AM or PM setting is called ‘ampm’

Here is what you will put as the actionscript for each button.

The hours UP button (If the value is 13 scroll back to 1)

on (release) {
    chours=int(chours)+1;
    if (chours==13) chours="1";       
}

The hours DOWN button (If the value is 0 then set as 12)

on (release) {
    chours=int(chours)-1;
    if (chours==0) chours="12";       
}

Minutes Down Button (If minutes hits 0 then set as 59, also put a 0 in front of any value under ten)

on (release) {
	minutes=int(minutes)-1;
	if (minutes<10) {
		minutes="0"+minutes;
		}
	if (minutes=="0-1")
	{
	minutes=59;
		chours=int(chours)-1
	}
}

Minutes Down Button (If minutes hits 60 then set as 00, also put a 0 in front of any value under ten)

on (release) {
    minutes=int(minutes)+1;
    if (minutes<10) {
      minutes="0"+minutes;
        }
   if (minutes==60)
    {
    minutes="00";
        chours=int(chours)+1;
    }   
}

The button which changes the AM / PM Setting

on (release) {
	if (ampm=="AM") {
		ampm="PM";
		} else {
		ampm="AM";
}
}

The Confirm button actually uses the internal SDM webbrowser which is picked up by my server, in the same string I send the variables.
I prepare the variable called ‘string’ and send it and presto!  We will use actionscript’s ‘loadvariable’ command actually to send the data.. funny…


on (release) {
string=”http://192.168.0.101:9020/abc.txt?DCCM”+chours+&#8221;:”+minutes+”:”+ampm;
loadVariablesNum(string, 0);
}

Note: If you need to read previos setting into these fields you can check out this entry which explains how up update fields from files.
Flash:Loading Variables from files into Flash

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s