<?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>Maartendamen&#039;s blog &#187; linux</title>
	<atom:link href="http://www.maartendamen.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maartendamen.com</link>
	<description>Blogging on various IT subjects</description>
	<lastBuildDate>Tue, 22 Nov 2011 21:27:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Installing HouseAgent on Linux</title>
		<link>http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/</link>
		<comments>http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 18:00:33 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[HouseAgent]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=912</guid>
		<description><![CDATA[Following up on yesterday&#8217;s post, here are the instructions to install HouseAgent on Linux. I took one of the most popular Linux distribution&#8217;s (Ubuntu) for this blog post, but it should be easy to apply this guide for other distributions as well. Step 1: installing HouseAgent prerequisites The first step is to install the HouseAgent [...]]]></description>
			<content:encoded><![CDATA[<p>Following up on yesterday&#8217;s post, here are the instructions to install HouseAgent on Linux.<br />
I took one of the most popular Linux distribution&#8217;s (Ubuntu) for this blog post, but it should be easy to apply this guide for other distributions as well.</p>
<p><strong>Step 1: installing HouseAgent prerequisites</strong></p>
<p>The first step is to install the HouseAgent prerequisites, there are two (Erlang and RabbitMQ) but you can install them using a single command line.<br />
Start the terminal in Ubuntu:</p>
<p><a href="http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/start_terminal/" rel="attachment wp-att-913"><img src="http://www.maartendamen.com/wp-content/uploads/2011/07/start_terminal.png" alt="" title="start_terminal" width="434" height="230" class="size-full wp-image-913" /></a></p>
<p>Now enter the following command:</p>
<p><a href="http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/rabbitmq/" rel="attachment wp-att-914"><img src="http://www.maartendamen.com/wp-content/uploads/2011/07/rabbitmq-620x407.png" alt="" title="rabbitmq" width="620" height="407" class="alignnone size-medium wp-image-914" /></a><br />
<span id="more-912"></span><br />
Hit &#8220;Y&#8221; to continue the installation. </p>
<p><strong>Step 2: Installing HouseAgent</strong></p>
<p>Download &#8220;HouseAgent.tar.gz&#8221; from the HouseAgent forum pages, and put it in a location of your liking. I chose HouseAgent in my home directory.<br />
Now extract HouseAgent:</p>
<p><a href="http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/untar2/" rel="attachment wp-att-933"><img src="http://www.maartendamen.com/wp-content/uploads/2011/07/untar2-620x494.png" alt="" title="untar2" width="620" height="494" class="alignnone size-medium wp-image-933" /></a></p>
<p>After extracting you need to copy the configuration file to /etc, you can do this with the following command line (you need to sudo this): </p>
<p><a href="http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/config_file/" rel="attachment wp-att-934"><img src="http://www.maartendamen.com/wp-content/uploads/2011/07/config_file-620x134.png" alt="" title="config_file" width="620" height="134" class="alignnone size-medium wp-image-934" /></a></p>
<p><strong>Step 3: Starting HouseAgent</strong></p>
<p>You are now ready to start HouseAgent. You can do this by running: &#8220;./Houseagent&#8221; :</p>
<p><a href="http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/start_ha/" rel="attachment wp-att-923"><img src="http://www.maartendamen.com/wp-content/uploads/2011/07/start_ha-620x490.png" alt="" title="start_ha" width="620" height="490" class="alignnone size-medium wp-image-923" /></a></p>
<p>After HouseAgent has been started, point your browser to http://localhost:8080:</p>
<p><a href="http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/ha_browser/" rel="attachment wp-att-926"><img src="http://www.maartendamen.com/wp-content/uploads/2011/07/ha_browser.png" alt="" title="ha_browser" width="564" height="452" class="alignnone size-full wp-image-926" /></a></p>
<p>Congratulations, you have successfully installed HouseAgent! In tomorrow&#8217;s blog post we will look into installing the first plug-in in order to make HouseAgent actually useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/07/installing-houseagent-on-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introducing HouseAgent</title>
		<link>http://www.maartendamen.com/2011/06/introducing-houseagent/</link>
		<comments>http://www.maartendamen.com/2011/06/introducing-houseagent/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 20:08:03 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[HouseAgent]]></category>
		<category><![CDATA[amqp]]></category>
		<category><![CDATA[Home automation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mako]]></category>
		<category><![CDATA[multi-platform]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rabbitmq]]></category>
		<category><![CDATA[rrd]]></category>
		<category><![CDATA[twisted]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[z-wave]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=784</guid>
		<description><![CDATA[HouseAgent is a multi platform, open source home automation application. That was the short introduction of something I have been working on for quite some months already. HouseAgent has been running as my own home automation software for some time. I hear you asking, why not use one of the standard software products available? There [...]]]></description>
			<content:encoded><![CDATA[<p><em>HouseAgent is a multi platform, open source home automation application.</em></p>
<p><a href="http://www.maartendamen.com/2011/06/introducing-houseagent/houseagent1-2/" rel="attachment wp-att-794"><img src="http://www.maartendamen.com/wp-content/uploads/2011/06/houseagent11-620x325.png" alt="" title="HouseAgent main" width="620" height="325" class="alignnone size-medium wp-image-794" /></a></p>
<p>That was the short introduction of something I have been working on for quite some months already. HouseAgent has been running as my own home automation software for some time.<br />
I hear you asking, why not use one of the standard software products available? There are a couple of reasons for that:<br />
<span id="more-784"></span></p>
<ul>
<li>Most software is expensive, for a full set-up €500,- is no exception;</li>
<li>I wanted to learn from my home automation hobby, by writing my own software I got and still get a lot of insight on new frameworks/protocols/techniques etc;</li>
<li>Really, I wanted free home automation software to be available to others out there as well!</li>
<li>Most software out there is not designed to run on a low power/low profile systems. HouseAgent can be run on low power system without hassle.</li>
<li>Also most software only runs on one platform i.e. Windows or Linux. I believe in a truly open platform where all kinds of developers can contribute.</li>
</ul>
<p>Let&#8217;s look at some core components used in HouseAgent:</p>
<p><strong>AMQP/RabbitMQ</strong><br />
One of the core components used in HouseAgent is AMQP. The Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol for message-oriented middleware. The defining features of AMQP are message orientation, queuing, routing (including point-to-point and publish-and-subscribe), reliability and security.<br />
AMQP is used within HouseAgent for plugin communication. Here is a picture, which hopefully explains all the bits and pieces a bit better:</p>
<p><a href="http://www.maartendamen.com/2011/06/introducing-houseagent/houseagent_arch/" rel="attachment wp-att-807"><img src="http://www.maartendamen.com/wp-content/uploads/2011/06/houseagent_arch.png" alt="" title="houseagent_arch" width="408" height="299" class="aligncenter size-full wp-image-807" /></a></p>
<p>As you can see all plug-ins are separate isolated components, in fact the plug-ins don&#8217;t even know about the coordinator or each other. The coordinator is the main HouseAgent application which runs important features such as the event handler and the web-based GUI. A plug-in communicates with the broker, and the message protocol used for this is AMQP.<br />
Certain types of messages are &#8220;published&#8221; on the broker, for example a device_value_update message might be send to the broker by a plug-in. The coordinator is &#8220;subscribed&#8221; to such messages and handles them appropriately (i.e. run a certain action based upon an event or save history to a history file)<br />
The coordinator on it&#8217;s turn can publish messages to the broker as well, commanding the plug-ins to do certain action. One example would be the power_on message. This message commands a certain plug-in to turn on a device with a certain address. </p>
<p>So what&#8217;s RabbitMQ? RabbitMQ is a broker which implements AMQP, there are several other AMQP implementations which might work as well with HouseAgent (not tested!). You can read more about AMQP on it&#8217;s <a href="http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol">wikipedia page</a>. You can read more about RabbitMQ on it&#8217;s <a href="http://www.rabbitmq.com/">homepage</a>.</p>
<p><strong>Twisted (Matrix)</strong><br />
Twisted is used for serial communication and all networking communication in HouseAgent. Twisted is a networking engine written in Python, supporting numerous protocols. It contains a web server, numerous chat clients, chat servers, mail servers, and more. The main difference between Twisted and other networking engine&#8217;s is that Twisted is asynchronous. You can read about the differences between synchronous and asynchronous communication <a href="http://en.wikipedia.org/wiki/Comparison_of_synchronous_and_asynchronous_signalling">here</a>. Twisted certainly was an eye opener for (thanks Rene) but also required a completely different way of thinking about networking and communication in general.</p>
<p>Among these core components some other frameworks/packages are used:</p>
<ul>
<li>Mako Template (for web page templating)</li>
<li>PyRRD (for historic graphing)</li>
<li>py-serial (serial communication)</li>
<li>pywin32 (Windows only)</li>
</ul>
<p>Although the development of HouseAgent is just getting started, it already includes some nice features. Some core functionality HouseAgent offers right now:</p>
<ul>
<li>Storing and logging of device values</li>
<li>Graphing (based upon RRDtool)</li>
<li>Event handling (triggers include: time based, device value changes)</li>
<li>Flexible plug-in development and easy extension</li>
</ul>
<p>This concludes the short introduction of HouseAgent. In future blog posts I will dive deeper in different aspects of HouseAgent.<br />
Right now a group of beta testers has been selected, I will send out a first beta version a.s.a.p. after that a public version will come available.<br />
As of today the source code is available for the core of HouseAgent! You can review the source code, and watch the development progress on <a href="https://github.com/maartendamen/HouseAgent">Github</a>. But please don&#8217;t expect a complete system out that source code, stand-by for binary releases.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/06/introducing-houseagent/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>XML-RPC package</title>
		<link>http://www.maartendamen.com/2010/02/xml-rpc-package/</link>
		<comments>http://www.maartendamen.com/2010/02/xml-rpc-package/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 18:35:44 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[synology]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=186</guid>
		<description><![CDATA[Alot of people were e-mailing/asking me about this package. It has been added for download, here:  http://www.maartendamen.com/?page_id=14&#38;did=3]]></description>
			<content:encoded><![CDATA[<p>Alot of people were e-mailing/asking me about this package.<br />
It has been added for download, here: <a href="http://www.maartendamen.com/?page_id=14&amp;did=3"> http://www.maartendamen.com/?page_id=14&amp;did=3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/02/xml-rpc-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugwise protocol unleashed part 3: internal clock information</title>
		<link>http://www.maartendamen.com/2010/02/plugwise-protocol-unleashed-part-3-internal-clock-information/</link>
		<comments>http://www.maartendamen.com/2010/02/plugwise-protocol-unleashed-part-3-internal-clock-information/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 19:35:57 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Plugwise unleashed]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Plugwise]]></category>
		<category><![CDATA[POL]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=149</guid>
		<description><![CDATA[Introduction In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version! DISCLAIMER: use of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version!</p>
<p><strong><span style="text-decoration: underline;">DISCLAIMER: use of the information in these articles is at your own risk.<br />
This information is not supported by Plugwise B.V. in any way.</span></strong></p>
<p>In this part of the series we will have a look at the device information request and response.</p>
<p><strong>Circle internal clock</strong></p>
<p><strong><span id="more-149"></span></strong>This blog post is about the internal clock of the Plugwise circle. This internal clock is used to for example log information about kWh usage per hour.<br />
It&#8217;s important to keep the internal clock in sync with your PC, for correct data readings. Imagine this going wrong: logged kWh information about an device appears in a different hour. Not something you want.</p>
<p>So, how to test this? Well I just fiddled around a bit with my PC&#8217;s date and time.<br />
Using a serial port sniffer I was able to see the following (unknown) data:</p>
<p><img class="alignnone size-full wp-image-150" title="clock_info1" src="http://www.maartendamen.com/wp-content/uploads/2010/02/clock_info1.png" alt="clock_info1" width="619" height="176" /><br />
<em>Image 1: serial port sniffing log after the clock change.</em></p>
<p>Following after that is the following data:<em> </em></p>
<p><em><img class="alignnone size-full wp-image-151" title="clock_info2" src="http://www.maartendamen.com/wp-content/uploads/2010/02/clock_info2.png" alt="clock_info2" width="660" height="172" /><br />
Image 2: more data following the clock change.</em></p>
<p>So looking at this I realized that code 003E must be some kind of extra check, to see if the clock is out of sync.<br />
The 0016 must be the clock set command as it contains extra data in the command.</p>
<p><em><strong>The clock information request (003E)</strong></em></p>
<p>The request is fairly easy:</p>
<p>003E000D6F000055XXXXBF07</p>
<p>003E -&gt; This is the request command code.<br />
000D6F000055XXXX -&gt; This is the mac address of the circle.<br />
BF07 -&gt; This is the CRC16 checksum</p>
<p>The response looks like this:</p>
<p>003F0D52000D6F0000552XXX1325350401457A0EFF</p>
<p>Split up for readability:</p>
<p>003F 0D52 000D6F0000552XXX 13 25 35 04 01 457A 0EFF</p>
<p>003F -&gt; request return command code.<br />
0D52 -&gt; reverse checksum<br />
000D6F0000552XXX -&gt; mac address<br />
13 -&gt; internal clock hour (HEX)<br />
25 -&gt; internal clock minutes (HEX)<br />
35 -&gt; internal clock seconds (HEX)<br />
04 -&gt; internal clock day of the week (HEX)<br />
01 -&gt; ?<br />
457A -&gt; ? looks like some kind of checksum to me.<br />
0EFF -&gt; CRC16 checksum</p>
<p><em><strong>The clock set command</strong></em></p>
<p>The clock set request looks like this:</p>
<p>0016000D6F0000551C140A021501FFFFFFFF112536043B11</p>
<p>Split up for readability:</p>
<p>0016 000D6F0000551XXX 0A 02 1501 FFFFFFFF 11 25 36 04 3B11</p>
<p>0016 -&gt; Command code<br />
000D6F0000551XXX -&gt; Mac address<br />
OA -&gt; Year (HEX) note this is the year in the plugwise style: 2010 = 10 (always substract 2000)<br />
02 -&gt; Month (HEX)<br />
1501 -&gt; Number of minutes (HEX)<br />
FFFFFFFF -&gt; Log buffer address (you can use this to reset your log buffers, more on this in later posts), FFFFFFFF won&#8217;t reset a thing!<br />
11 -&gt; Hour (HEX)<br />
25 -&gt; Minute (HEX)<br />
36 -&gt; Second (Hex)<br />
04 -&gt; Day of the week (HEX)<br />
3B11 -&gt; CRC16 checksum</p>
<p>So now we know how to read and set the internal clock of the plugwise circle.<br />
See you guys next week!<br />
Let me know if you have any questions, and also if there is anything specific you would like to see in the next plugwise unleashed post!</p>
<p>This is a multipart series, the other parts can be found here:<br />
<a title="Part 1" href="http://www.maartendamen.com/?p=89">Plugwise protocol unleashed part 1:  introduction</a><br />
<a href="http://www.maartendamen.com/?p=106">Plugwise protocol unleashed part 2: device information</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/02/plugwise-protocol-unleashed-part-3-internal-clock-information/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Plugwise protocol unleashed part 2: device information</title>
		<link>http://www.maartendamen.com/2010/02/plugwise-protocol-unleashed-part-2-device-information/</link>
		<comments>http://www.maartendamen.com/2010/02/plugwise-protocol-unleashed-part-2-device-information/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 21:36:38 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Plugwise unleashed]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Plugwise]]></category>
		<category><![CDATA[POL]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=106</guid>
		<description><![CDATA[Introduction In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version! DISCLAIMER: use of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version!</p>
<p><strong><span style="text-decoration: underline;">DISCLAIMER: use of the information in these articles is at your own risk.<br />
This information is not supported by Plugwise B.V. in any way.</span></strong></p>
<p>In this part of the series we will have a look at the device information request and response.</p>
<p><strong>Device information request</strong></p>
<p>The device information request looks like this:</p>
<p><span id="more-106"></span></p>
<p><code>0023000D6F000023XXXX231B</code></p>
<p><strong><code>0023</code></strong> &#8211; indicates the request code, in this case it&#8217;s the device information request code.<br />
<strong><code>00D6F000023XXXX</code></strong> &#8211; is the mac address of the device we are requesting information about.<br />
<strong><code>231B</code> </strong>- is the CRC checksum.</p>
<p><strong>Device information response</strong></p>
<p>The device information response looks like this:<br />
<code>00240025000D6F000023XXXX0A01866F0004DFE801850000047300074AA663800136EE</code><br />
<code>0024 0025000D6F000023XXXX 0A 01 866F 0004DFE8 01 85 0000 0473 0007 4AA66380 01 36EE</code></p>
<p><strong><code>0024</code> </strong>- indicates the response code, in this case it&#8217;s the device information response code.<br />
<strong><code>0025</code> </strong>- unknown, reverse checksum? Not interesting anyway.<br />
<strong><code>000D6F000023XXXX</code> </strong>- mac address of the device we requested information about.<br />
<strong><code>0A</code> </strong>- Year of the internal Plugwise clock, convert 0A to integer and you get 10.. add 2000 to it and you have 2010.<br />
<strong><code>01</code> </strong>- Month of the internal Plugwise clock, convert 01 to integer and you get 1.<br />
<strong><code>866F</code> </strong>- Number of minutes of the internal Plugwise clock, convert 886F to integer and you get 34415. You can use this to calculate the days, hours and minutes, to get a datetime value.<br />
<strong><code>0004DFE8</code> </strong>- Latest log buffer address, each log buffer contains 4 hours of information about the power usage. Convert this to integer, Then use: (logaddress &#8211; 278528) / 32 to get the log address. In this example the log address is: (319464 &#8211; 278528) / 32 = 1279<br />
<strong><code>01</code> </strong>- Relay status (power on/power off) 01=ON, 00=OFF.<br />
<strong><code>85</code> </strong>- Amount of herz the plugin operates on.<br />
I use the following python code to determine the amount of hz:</p>
<pre class="brush: python; title: ; notranslate">
    def determinehz(self, herz):
        &quot;&quot;&quot;
        Determines number of hz of a plugwise device.
        &quot;&quot;&quot;
        if herz == '85':
            return 50
        elif herz == 'C5':
            return 60
        else:
            return 0
</pre>
<p><strong><code>000004730007</code> </strong>- This indicates the hardware version of the circle. No conversion is needed. In this case the hardware version is: 0000-0473-0007.<br />
<strong><code>4AA66380</code> </strong>- This is the firmware version of the circle. The datetime is a POSIX (epoch) timestamp. The following python function converts it to a datetime object:</p>
<pre class="brush: python; title: ; notranslate">
datetime.fromtimestamp(timestamp[, tz])
</pre>
<p>If you have any questions regarding the device information please let me know.. till next week! And happy plugwising! :-)</p>
<p>This is a multipart series, the other parts can be found here:<br />
<a title="Part 1" href="http://www.maartendamen.com/?p=89">Plugwise protocol unleashed part 1: introduction</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/02/plugwise-protocol-unleashed-part-2-device-information/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Plugwise protocol unleashed part 1: introduction</title>
		<link>http://www.maartendamen.com/2010/01/plugwise-protocol-unleashed-part-1-introduction/</link>
		<comments>http://www.maartendamen.com/2010/01/plugwise-protocol-unleashed-part-1-introduction/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 20:53:16 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Plugwise unleashed]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Plugwise]]></category>
		<category><![CDATA[POL]]></category>
		<category><![CDATA[Reverse engineering]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=89</guid>
		<description><![CDATA[Introduction In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version! DISCLAIMER: use of [...]]]></description>
			<content:encoded><![CDATA[<p><code><br />
</code></p>
<p><strong>Introduction</strong></p>
<p>In the Plugwise protocol unleashed series, I will describe the plugwise protocol. As far as I have been able to re-engineer it. I did this re-engineering work because there is no Linux/OSX software available to control your plugwise devices. All information in these series are based on the 2.0 firmware version!</p>
<p><strong><span style="text-decoration: underline;">DISCLAIMER: use of the information in these articles is at your own risk.<br />
This information is not supported by Plugwise B.V. in any way.</span></strong></p>
<p><strong>So what is plugwise anyway?</strong></p>
<p><strong><span id="more-89"></span><br />
</strong></p>
<p>Plugwise is a smart way of measuring power usage using a device called the Circle.<br />
It&#8217;s basically a plug between your device and the power socket.<br />
The device can be used to keep track of the following:</p>
<p>- Current power usage;<br />
- historic power usage, using buffers in the device itself;<br />
- you can also use it to power on/power off a device;<br />
- you can also use it as standby killer (using a schema).</p>
<p>For more information visit: <a title="Plugwise homepage" href="http://www.plugwise.com">http://www.plugwise.com</a></p>
<p><strong>General information</strong></p>
<p>Before we can dive deep into the plugwise protocol, we are first going through some basics of the protocol in part one of this series.<br />
Plugwise uses the zigbee protocol to communicatie over the air.<br />
Once all of your devices have been setup using Plugwise source (the default Plugwise software) you can control your devices using the plugwise stick (this is a little USB stick)</p>
<p><img class="size-full wp-image-90 alignnone" style="margin-top: 1px; margin-bottom: 1px;" title="Plugwise stick" src="http://www.maartendamen.com/wp-content/uploads/2010/01/plugwise_stick.jpg" alt="Plugwise stick" width="320" height="186" /></p>
<p><em>Image 1: the plugwise stick</em></p>
<p>To send commands to the Plugwise stick, plugwise uses a serial communication protocol.<br />
Actually the Plugwise stick has a FTDI FT232 UART aboard. The following information shows up when plugged into a Linux machine:</p>
<p><code>Bus 006 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC</code></p>
<p>The serial communication takes place with the following settings:</p>
<ul>
<li>Baud rate: 115200</li>
<li>Data bits: 8</li>
<li>Stop bits: 1</li>
<li>Parity: none</li>
</ul>
<p><strong>Plugwise data packet</strong></p>
<p>The Plugwise data packet looks like this:</p>
<p><img class="alignnone size-full wp-image-97" title="plugwise_packet" src="http://www.maartendamen.com/wp-content/uploads/2010/01/plugwise_packet.png" alt="plugwise_packet" width="606" height="70" /></p>
<p><em>Image 2: the Plugwise protocol frame.</em></p>
<p>The start frame must be sent before sending any other data, the hexadecimal presentation of the start frame looks like this:</p>
<p><code>\x05\x05\x03\x03</code></p>
<p>The data formats varies, an example might look like this:</p>
<p><code>0017000D6F0000236XXX01</code></p>
<p>This actually is an example of the power change command (switch a device on or off, in this case a device on command)<br />
0017 is the command, <code>00D6F0000236XXX the mac address and 01 the power code (power on)</code></p>
<p>Followed by the data, is the CRC checksum.<br />
The used CRC checksum by Plugwise is a CRC16 checksum (often reffered to as ymodem or zmodem), it has the following properties:</p>
<ul>
<li>Polynomial: 0&#215;11021</li>
<li>Seed value: 0&#215;00000</li>
<li>Xor mask: 0&#215;00000</li>
<li>Width: 16</li>
</ul>
<p>The checksum is generated over the data piece of the packet.<br />
Last part of the packet is the end frame, this is basically a control feed followed by a linefeed. Which looks the following way, in hexadecimal:</p>
<p><code>\x0d\x0a</code></p>
<p>This concludes the first part of the Plugwise protocol unleashed series. If you have any specific protocol questions, please leave them in the comments so I can talk about it in the next part of this serie.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/01/plugwise-protocol-unleashed-part-1-introduction/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Plugwise on Linux downloads back online</title>
		<link>http://www.maartendamen.com/2009/11/plugwise-on-linux-downloads-back-online/</link>
		<comments>http://www.maartendamen.com/2009/11/plugwise-on-linux-downloads-back-online/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 21:49:55 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[POL (Plugwise on Linux)]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Plugwise]]></category>
		<category><![CDATA[POL]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=17</guid>
		<description><![CDATA[Because of the huge amount of requests I get for this piece of software I&#8217;ve put POL (Plugwise on Linux) back online. You can find it in the &#8220;Downloads&#8221; section.]]></description>
			<content:encoded><![CDATA[<p>Because of the huge amount of requests I get for this piece of software I&#8217;ve put POL (Plugwise on Linux) back online.<br />
You can find it in the <a href="http://www.maartendamen.com/?page_id=14">&#8220;Downloads&#8221;</a> section.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2009/11/plugwise-on-linux-downloads-back-online/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

