<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jamie&#039;s Blog &#187; Home Automation</title>
	<atom:link href="http://jamiei.com/blog/topic/development/home-automation/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamiei.com/blog</link>
	<description>Delphi Programming, Web Development, General Technology and, of course, Midget Gems</description>
	<lastBuildDate>Mon, 19 Dec 2011 09:19:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<cloud domain='jamiei.com' port='80' path='/blog/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Delphi can do MQTT too!</title>
		<link>http://jamiei.com/blog/2009/02/delphi-mqtt-client/</link>
		<comments>http://jamiei.com/blog/2009/02/delphi-mqtt-client/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 10:59:49 +0000</pubDate>
		<dc:creator>jamiei</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[delphi library]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[rsmb]]></category>

		<guid isPermaLink="false">http://jamiei.com/blog/?p=159</guid>
		<description><![CDATA[I have recently released my MQTT Client for Delphi, which can now be found and downloaded here . TMQTTClient is a non-visual Delphi Client Library for the IBM Websphere MQ Transport Telemetry protocol. It allows you to connect to a Message Broker that uses MQTT such as the Really Small Message Broker (RSMB) which is freely available for [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently released my MQTT Client for Delphi, which can now be found and downloaded <a href="http://jamiei.com/blog/code/mqtt-client-library-for-delphi/">here</a> . TMQTTClient is a non-visual Delphi Client Library for the <a href="http://mqtt.org/">IBM Websphere MQ Transport Telemetry protocol</a>. It allows you to connect to a Message Broker that uses MQTT such as the <a href="http://alphaworks.ibm.com/tech/rsmb">Really Small Message Broker</a> (RSMB) which is freely available for evaluation on IBM Alphaworks. Alternatively for it&#8217;s larger brother you can try the <a href="http://www-142.ibm.com/software/sw-lotus/products/product1.nsf/wdocs/expeditor">IBM Lotus Expeditor product</a>.</p>
<p>I felt that I should explain a little bit about what <a href="http://alphaworks.ibm.com/tech/rsmb">RSMB</a> is and why you might want to use either RSMB or another broker that supports MQTT for a project. RSMB is a small and ultra-lightweight Message Broker, it takes only 50KB of Code and can run in 150KB of Memory or less (obviously you might find this varies slightly for you). A resource consumption level which makes it ideal for situations where it is required to run on low power servers (such as the <a href="http://www.viglen.co.uk/viglen/Products_Services/Product_Range/Product_file.aspx?eCode=XUBUMPCL&amp;Type_Info=Description&amp;Type=Desktops">Viglen MPC-L</a> which runs on just 10W) or in resource constricted environments.</p>
<p>The <a href="http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac10840_.htm">MQTT Protocol</a> itself is equally compact but no less powerful and is perfect for running on Low Bandwidth or unreliable connection environments where you may have many sensors connected via different means. MQTT is a Publish / Subscribe model where a client can <em>subscribe</em> to a particular &#8220;topic&#8221; (verbose example <em>/home/kitchen/temperature</em>) and will then receive messages from <em>Publishers</em> on that topic (for example <em>18 degrees celsius</em>). Potentially very powerful as I&#8217;m sure you&#8217;ll agree, you can understand why the Pervasive messaging group at IBM are particularly excited about this technology.</p>
<p>RSMB also has the very useful feature of being able to <em>bridge</em> with other Message Brokers which allows messages to be passed on between brokers.</p>
<p> </p>
<p><strong>What do you actually use this for?</strong></p>
<p>I use RSMB and MQTT as the messaging transport for my Home Monitoring and Automation Network as a result of the great talks I heard from the great IBM pervasive messaging team that I met when I <a href="http://jamiei.com/blog/2008/12/homecamp-08/">attended Homecamp</a> last November. In order to demonstrate it&#8217;s usage, it is probably easiest to explain a scenario which is implemented on my home network. </p>
<p><em>Example: </em>I currently have my <a href="http://www.currentcost.co.uk/">CurrentCost</a> unit hooked up to my home server which publishes it&#8217;s electricity usage and temperature information to an MQTT Topic to my RSMB Server. This data is then published to subsribers such as an &#8220;<em>ambient orb</em>&#8221; which, I&#8217;m currently building based on the <a href="http://arduino.cc">Arduino platform</a>, that glows a different colour depending on how the current usage compares to the normal average for this particular time of day (Glowing Red, for example, if I&#8217;m consuming a lot more than normal).</p>
<p>This is a very similar setup to the one that powers Andy Standford-Clark&#8217;s <a href="http://mqtt.org/andy_house/">Twittering house</a> and to the Ambient orb setup that Nick O&#8217;Leary describes (with photos) in <a href="http://knolleary.net/2009/01/05/monitoring-energy-use-with-an-orb/">his own blog post here</a>. The Key point is that having the lightweight messaging protocol MQTT as the backbone makes adding and removing devices easy. (no matter what shape or size they may be) </p>
<p><a href="http://knolleary.net/">Nick O&#8217;Leary</a> has written a very handy <a href="http://knolleary.net/arduino-client-for-mqtt/">MQTT Client for the Arduino platform</a> which allows my ambient orb to get the latest consumption data from the CurrentCost unit without them having to talk directly to each other.  There are also MQTT Client reference  implementations for <a href="http://www.ibm.com/support/docview.wss?rs=171&amp;uid=swg24006006&amp;loc=en_US&amp;cs=utf-8&amp;lang=en">Java</a>, <a href="http://www.ibm.com/support/docview.wss?rs=171&amp;uid=swg24006525&amp;loc=en_US&amp;cs=utf-8&amp;lang=en">C</a> and 3rd party implementations for <a href="http://mqtt.rubyforge.org/">Ruby</a> and an unofficial <a href="http://code.google.com/p/currentcost/">Perl</a> library. </p>
<p><strong>Why not use a more widely compatible transport such as one based on XML?</strong></p>
<p><strong><span style="font-weight: normal;">It&#8217;s true that in the example provided above the transport used could be a Web Service or a simple RSS feed but what makes MQTT particularly useful is that it uses a Publish/Subsribe model which lends itself more to real time data than either of the above. MQTT is also considerably more lightweight which allows you to fit a client into a device like the <a href="http://arduino.cc">Arduino</a> without the On-the-wire and library XML Parsing overhead. </span></strong></p>
<p><span style="font-weight: normal;"><strong>Ok, how can I get started?</strong></span></p>
<p>Downloading and Setting up RSMB is very easy, you&#8217;ll need an IBM.com ID to download but then setup simply involves extracting the zip file and running the appropriate executable (Windows and Linux binaries are included). To use TMQTTClient you simply need to download the component and extract the two units in TMQTTClient. You will also need to make sure you have the excellent <a href="http://www.synapse.ararat.cz/">Synapse</a> Communications components available on your search path somewhere.</p>
<p>After that you could publish messages to your broker telling you that you had a new email from your Delphi code in this sort of manner:</p>
<pre class="brush: delphi; title: ; notranslate">
uses MQTT;

var
	MQTTClient: TMQTTClient;
begin
	MQTTClient := TMQTTClient.Create('localhost', 1883);
	MQTTClient.Connect;
	MQTTClient.Publish('/messaging/email/john', '1 New Message');
	MQTTClient.Disconnect;
	MQTTClient.Free;
end;
</pre>
<p>Subscribing to a topic is just as easy and you can create an event handler to handle incoming Publish messages on any particular topic:</p>
<pre class="brush: delphi; title: ; notranslate">
uses MQTT;
var
	MQTTClient: TMQTTClient;

procedure TmyForm.btnConnectClick(Sender: TObject);
begin
	MQTTClient := TMQTTClient.Create(eIP.Text, StrToInt(ePort.Text));
	MQTTClient.OnPublish := OnPublish;
	MQTTClient.Connect;
        MQTTClient.Subscribe('/messaging/email/john');
	MQTTClient.Publish('/messaging/email/john', '1 New Message');
end;

procedure TmyForm.OnPublish(Sender: TObject; topic, payload: string);
begin
	memoStatus.Lines.Add('Publish Received. Topic: '+ topic + ' Payload: ' + payload);
end;
</pre>
<p>Having written this, I can now focus on building out the rest of my home monitoring network (details to come another time) which will be super easy (I hope!) now that it is based on a MQTT/RSMB system.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamiei.com/blog/2009/02/delphi-mqtt-client/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Homecamp 08</title>
		<link>http://jamiei.com/blog/2008/12/homecamp-08/</link>
		<comments>http://jamiei.com/blog/2008/12/homecamp-08/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 13:19:47 +0000</pubDate>
		<dc:creator>jamiei</dc:creator>
				<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Much ado about Nothing]]></category>
		<category><![CDATA[Windows Development]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[Home Monitoring]]></category>
		<category><![CDATA[homecamp]]></category>

		<guid isPermaLink="false">http://jamiei.com/wordpress/?p=47</guid>
		<description><![CDATA[  I spent all day last Saturday at Homecamp at the Electrical Engineering building at Imperial College London. Homecamp is effectively a hack-day about Home monitoring, home automation reducing energy and energy resource requirements in your home. Previous to hearing of the day, I had become interested in these subjects because I had seen Andy [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<div id="attachment_46" class="wp-caption alignright" style="width: 310px"><a href="http://jamiei.com/wordpress/wp-content/uploads/2008/12/homecamp.png"><img class="size-medium wp-image-46" title="Homecamp Logo" src="http://jamiei.com/wordpress/wp-content/uploads/2008/12/homecamp.png" alt="A logo for homecamp, created by @ribotminimus" width="300" height="300" /></a><p class="wp-caption-text">A logo for homecamp, created by @ribotminimus</p></div>
<p>I spent all day last Saturday at <a href="http://homecamp.pbwiki.com/">Homecamp</a> at the Electrical Engineering building at Imperial College London. Homecamp is effectively a hack-day about Home monitoring, home automation reducing energy and energy resource requirements in your home.</p>
<p>Previous to hearing of the day, I had become interested in these subjects because I had seen <a href="http://andypiper.wordpress.com/">Andy Piper</a>&#8216;s <a href="http://www.currentcost.co.uk">Current Cost</a> posts and the associated IBM&#8217;ers who had been doing some <a href="http://code.google.com/p/currentcost/">fantastic work</a> on providing code libraries for accessing the Current Cost data. The CurrentCost unit is a great little electricity usage monitoring unit that is available to <a href="http://stores.ebay.co.uk/Current-Cost-Ltd">buy</a> on eBay for about £40. Whilst a large amount of our discussion from that day did revolve around the CurrentCost unit, it was not the limit of our discussion in anyway (discussion around this was easy because it&#8217;s a cool little unit that is low-cost and easy to extract data from!).</p>
<p> </p>
<p>The Day began with <a href="http://dalelane.co.uk/blog/">Dale Lane</a> and <a href="http://twitter.com/yellowpark">Chris Dalby</a> who had organised the day distributing name labels and wireless keys and asked us to give suggestions for sessions. We also had a quick word from <a href="http://www.redmonk.com/jgovernor/">James Govenor (</a><a href="http://twitter.com/monkchips">@monkchips</a>) who was generously sponsoring the event via his <a href="http://greenmonk.net/">GreenMonk</a> consultancy. </p>
<p>The First talk of the day was from Andy Stanford-Clark who is a Master Inventor at IBM. As one might expect, Andy&#8217;s own house is a geeks dream (<a href="http://twitter.com/andy_house">it even twitters!</a>). Almost everything that can be is monitored and automated, even to the mouse traps that are set in his loft which text him or his family when a mousetrap is set off or the cheese used as bait has gone off. He measured his water usage by requesting a new meter which had a magnetised needle, thus allowing him to setup a device which gets a signal every time the needle rotates. Andy was also a big advocate of the <a href="http://mqtt.org/">MQTT</a> protocol which he uses for client projects with IBM and as the central messaging service for his house works. MQTT is a Publish-Subscribe protocol which makes it ideal for things like the house networks that we were talking about. He also mentioned the use of <a href="http://en.wikipedia.org/wiki/X10_(industry_standard)">X10</a> and <a href="http://www.zigbee.org">ZigBee</a> in controlling almost device or system in the house. You can see Andy&#8217;s full talk in the <a href="http://www.viddler.com/explore/andypiper/videos/21/">video</a> that Andy Piper made.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/andypiper/3069644362/"><img title="James Governor and the agenda" src="http://farm4.static.flickr.com/3293/3069644362_55c6f4bd0f.jpg?v=0" alt="Photo credit: Andy Piper" width="500" height="281" /></a><p class="wp-caption-text">Photo credit: Andy Piper</p></div>
<p><a href="http://www.joeshort.net/">Joe Short</a> and <a href="http://pbjots.blogspot.com/">Phoebe Bright</a> then did a talk on <a href="http://www.dynamicdemand.co.uk/">Dynamic Demand</a>. This is essentially about smoothing out the hour by hour and minute by minute variations in power demands on the national grid. This is important becuase peak time power requirements mean that power companies have to bring very expensive and very environmentally damaging types of power generator online. We discussed about how this requires social change and we discussed dynamic energy pricing as a method of bringing about this change. In Italy for example the government required dynamic pricing smart meters to be installed in every house. This means that people are rewarded for putting their tumble dryer (if you needed a tumble dryer in a hot country like italy!) on at 3am in the morning when electricity is considerably cheaper. The general message here seemed to be that we have limited scope for activity here until we can push suppliers for dynamic pricing. This will take some time but once this is done, you can for example program washing machines to automatically start when the national price of electricity is at it&#8217;s cheapest throughout the day (very cool).  </p>
<p>Dale Lane took us through some of the ways in which the IBM Hursley users of the CurrentCost units have been trying to address the social aspects of getting people to use less electricity. They have been working on a realtime site for sharing and contrasting data from their units and would like to start creating some XBox live style point scoring awards. This would mean awards for biggest 1 day improvement or lowest house rest point. </p>
<p>We also had a talk from <a href="http://knolleary.net/">Nicholas O&#8217;Leary</a> who gave an interesting talk about the potential for <a href="http://www.arduino.cc/">Arduino</a> use in the home. The Arduino is an open-source electronics platform that allows the flexibility to program and build low cost sensor inputs (light, heat, magnetic etc) to interact with a number of outputs. Nick showed us an ambient orb that he had built to show the amount of power his house is using at that particular moment. It glows green, yellow or red depending on whether the house electricity usage falls within certain limits. You can buy arduino units and shields from a number of sources but I am planning on getting a starter kit which should be back in stock soon at <a href="http://tinker.it/">tinker.it</a>. </p>
<p>There was discussion in both Andy&#8217;s talk and Nick&#8217;s talk about how you could end up consuming more power by measuring and monitoring your home by the time you&#8217;ve got a server plugged into all manner of electrical monitoring devices. We discussed the <a href="http://www.viglen.co.uk/viglen/Products_Services/Product_Range/Product_file.aspx?eCode=XUBUMPCL&amp;Type_Info=Description&amp;Type=Desktops">Viglen MPC-L</a> device which runs on a rediculously small amount of electricity usage (there was some discussion of costing you approx £10 per year on electicity usage). The Arduino can be powered with a normal 9V battery.</p>
<p> </p>
<p>We also had a presentation from the <a href="http://www.pachube.com/">Patchube</a> (Patch-U-Bay) folks who were explaining about how you can get data in to the site and the various ways you use and share that information. I could see a lot of potential for this site but first I need to generate some data to share!</p>
<p> </p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://www.flickr.com/photos/andypiper/3068813725/"><img title="The Audience" src="http://farm4.static.flickr.com/3286/3068813725_b9fa896e28.jpg?v=0" alt="Photo Credit: Andy Piper" width="500" height="321" /></a><p class="wp-caption-text">Photo Credit: Andy Piper</p></div>
<p>Overall I had a very inspiring day and met some extremely interesting people from all manner of backgrounds, interests and areas. It was nice to meet so many people who I had interacted with on Twitter and some who I had never met before but whom I shall certainly be looking forward to meeting again soon. I will be ordering all sorts of kit to play with as a result of the talks given at Homecamp and so the day will almost certainly cost me a lot of money in gadgets and time in the future but at least I will have a lot of fun doing it! The first thing I will be doing is writing a native Delphi library for the CurrentCost unit and contributing that to the <a href="http://code.google.com/p/currentcost">Google Code</a> Repository. There is another Homecamp planned for March which I hope that I will be around for again and this time able to contribute some ideas and projects towards it.</p>
<p> </p>
<p>Thank-you to <a href="http://twitter.com/yellowpark">Chris Dalby</a>, <a href="http://dalelane.co.uk/blog/">Dale Lane</a> and <a href="http://www.redmonk.com/jgovernor/">James Governor</a> for their work in setting up the day and to everyone who presented or otherwise contributed to the day. I can&#8217;t wait to share what I do as a result of the inspiration that the first day gave me!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamiei.com/blog/2008/12/homecamp-08/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

