<?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>bits4life &#187; misterhouse</title>
	<atom:link href="http://blog.export.be/category/misterhouse/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.export.be</link>
	<description>Bits and bytes for your daily life.</description>
	<lastBuildDate>Thu, 12 Nov 2009 10:55:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use misterhouse to send SMS messages to your mobile on events.</title>
		<link>http://blog.export.be/2009/11/use-misterhouse-to-send-sms-messages-to-your-mobile-on-events/</link>
		<comments>http://blog.export.be/2009/11/use-misterhouse-to-send-sms-messages-to-your-mobile-on-events/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 12:58:32 +0000</pubDate>
		<dc:creator>nixo</dc:creator>
				<category><![CDATA[misterhouse]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://blog.export.be/?p=252</guid>
		<description><![CDATA[I am using misterhouse to drive my home automation system in my house. One of the things I like is to receive alerts on certain events. For example when it starts raining and one of the windows is left open I like to know.  A good way to receive alerts is via SMS messages on [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="voipbuster" src="http://www.voipbuster.com/images/logo.gif" alt="" width="86" height="52" />I am using misterhouse to drive my home automation system in my house. One of the things I like is to receive alerts on certain events. For example when it starts raining and one of the windows is left open I like to know.  A good way to receive alerts is via SMS messages on my mobile phone.  I started coding so that misterhouse can sent SMS alerts.  In the misterhouse code there was already some code to use a service at www.smsboy.com Because I am using voipbuster for my VOIP needs I changed the code for that.<span id="more-252"></span> Below is the code that creates an Item to use for sending SMS messages .</p>
<p class="textbox">use strict;<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
# SMS module for Misterhouse<br />
# Uses your voipbuster account http://voipbuster.com to send an SMS message to your mobile.<br />
# Originally written by Stuart Grimshaw &lt;stuart@smgsystems.co.uk&gt;<br />
# Changed by Nico Lembrechts for use with voipbuster.com &lt;nicoatyow@gmail.com&gt; http://yow.be<br />
#<br />
# (17/04/2009)<br />
#<br />
# It&#8217;s trivially simple to use, just add the .pm file to either your code<br />
# directory, or the Misterhouse lib directory. Until the module is integrated<br />
# into the next release (and until you upgrade to it) you need to add the<br />
# line:<br />
#<br />
#       use voipbuster_SMS_Item;<br />
#<br />
# somewhere in your code.<br />
#<br />
# To create the object use:<br />
#<br />
#       new voipbuster_SMS_Item(&lt;username&gt;, &lt;password&gt;, &lt;from_telephone_number&gt;, &lt;to_telephone_number&gt;);<br />
#<br />
#       $SMS_voipbuster = new voipbuster_SMS_Item(&#8220;username&#8221;, &#8220;password&#8221;, &#8220;+32161234567&#8243;, &#8220;+324961234567&#8243;);<br />
#<br />
# and to send a message use the line:<br />
#<br />
#       $SMS_voipbuster-&gt;send(&#8220;Window left open and it is raining now.&#8221;);<br />
#<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
package voipbuster_SMS_Item;<br />
use LWP::UserAgent;<br />
my $smsurl = &#8220;https://myaccount.voipbuster.com/clx/sendsms.php?&#8221;;<br />
sub new {<br />
my($class)=shift(@_);<br />
my($self) = {};<br />
$$self{username} = shift(@_);<br />
$$self{password} = shift(@_);<br />
$$self{from} = shift(@_);<br />
$$self{to} = shift(@_);<br />
bless $self, $class;<br />
return $self;<br />
}<br />
sub send {<br />
my($self, $message) = @_;<br />
my $ua = new LWP::UserAgent;<br />
my $req = $smsurl.(&#8220;username=$$self{username}&amp;password=$$self{password}&amp;from=$$self{from}&amp;to=$$self{to}&amp;text=$message &#8212; &#8220;);<br />
my $res = $ua-&gt;get($req);<br />
die &#8220;Error at $req\n &#8220;, $res-&gt;status_line, &#8220;\n Aborting&#8221;<br />
unless $res-&gt;is_success;<br />
}<br />
sub set {<br />
my($self, $voip_user, $voip_pass, $voip_from, $voip_to) = @_;<br />
$$self{username}=$voip_user;<br />
$$self{password}=$voip_pass;<br />
$$self{from}=$voip_from;<br />
$$self{to}=$voip_from;<br />
}</p>
<p>This code is doing the actual work.</p>
<p>In the following code I create an Item</p>
<p class="textbox">use voipbuster_SMS_Item;<br />
# To create the object use:<br />
#<br />
$SMS_Nico = new voipbuster_SMS_Item(&#8220;nicoatyow&#8221;, &#8220;********&#8221;, &#8220;+32496*********&#8221;, &#8220;+324**********&#8221;);<br />
# and to send a message use the line:<br />
#<br />
#$SMS_Nico-&gt;send(&#8220;Mum called your home at 13:15&#8243;) if $New_Minute;</p>
<p>Once the item is created you can use it in all your misterhouse code files. For example with my rain detector :</p>
<p class="textbox">
<p>if ($state = state_changed $rainsensor){<br />
print_log &#8220;Rainsensor is now $state&#8221;;<br />
$SMS_Nico-&gt;send(&#8220;ALARM !! It&#8217;s raining and a window left open. &#8220;) if ($state eq ON) and state $window_open eq ON;<br />
}</p>
<p><img class="alignleft" title="voipbuster" src="http://www.voipbuster.com/images/logo.gif" alt="" width="157" height="96" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.export.be/2009/11/use-misterhouse-to-send-sms-messages-to-your-mobile-on-events/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to setup a misterhouse proxy on openwrt</title>
		<link>http://blog.export.be/2009/03/how-to-setup-misterhouse-as-a-proxy-on-openwrt/</link>
		<comments>http://blog.export.be/2009/03/how-to-setup-misterhouse-as-a-proxy-on-openwrt/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 13:05:26 +0000</pubDate>
		<dc:creator>nixo</dc:creator>
				<category><![CDATA[misterhouse]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://blog.export.be/?p=195</guid>
		<description><![CDATA[If you have followed my guide to install misterhouse on an openwrt router you may use it as proxy. A misterhouse proxy is used to offload slow hardware interfaces or slow processes from the main misterhouse process. Another reason could be that you cannot connect some hardware physically to your main misterhouse box but like [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="misterhouse logo" src="http://misterhouse.sourceforge.net/mh_logo.gif" alt="" width="99" height="97" />If you have followed my <a href="http://blog.export.be/?p=115" target="_self">guide to install misterhouse on an openwrt router</a> you may use it as proxy. A misterhouse proxy is used to offload slow hardware interfaces or slow processes from the main misterhouse process. Another reason could be that you cannot connect some hardware physically to your main misterhouse box but like to have that hardware available to your main misterhouse box. Gregg from the misterhouse mailing list pointed me to <a title="Xap explained" href="http://misterhouse.wikispaces.com/xAP+and+xPL+-+Getting+started" target="_self">the Xap protocol support</a> build into the misterhouse code. So I started testing out the code.<span id="more-195"></span> The principle is that you define the same Item types on both the proxy and the main misterhouse machine. The Xap protocol then takes care of keeping these variables in sync. The first thing I did was creating my own directories outside the misterhouse install directory, this will make further upgrades much easier. Here are my steps :</p>
<p>Create a directory on the same level as the misterhouse install directory</p>
<p class="textbox">root@OpenWrt:/mnt/usb# ls<br />
etc         lib         lost+found  mh       usr<br />
mkdir my-mh<br />
cd my-mh</p>
<p>Copy the code dir and data dir</p>
<p class="textbox">mkdir code<br />
cp -r ../mh/code/proxy code<br />
mkdir data<br />
cp -r ../mh/data/proxy data</p>
<p>Because I am setting up a misterhouse proxy I only copied the proxy sub directories of the data and code directories. I also copied the mh.private.ini config file and some startup scripts and altered them to use the newly created directories.</p>
<p class="textbox">cp ../mh/bin/mh_proxy.ini mh.private.ini</p>
<p>The mh.private.ini file overrides the main mh.ini configuration file in the misterhouse installation directory and is used to make your personal configuration changes. This is how my file looks like:</p>
<p class="textbox">code_dir=$Pgm_Root/../my_mh/code/proxy<br />
data_dir=$Pgm_Root/../my_mh/data/proxy<br />
code_select   = code_select.txt<br />
code_unselect = code_unselect.txt<br />
sound_program=<br />
server_telnet_port=<br />
server_mhsend_port=<br />
xpl_disable=1<br />
xap_enable_items=1<br />
voice_text=<br />
#only_load=proxy_server.pl<br />
no_log=serial_unmatch<br />
xcmd_file=<br />
sleep_time=100<br />
sleep_count=1<br />
tk=0<br />
title=Proxy MisterHouse<br />
gd=0<br />
x10_errata=1<br />
server_proxy_port=<br />
xap_echo_all=1<br />
http_port = 8080</p>
<p>I also copied the mh_proxy startup script and the mhl script and altered them to reflect my proxy setup</p>
<p class="textbox">cp ../mh/bin/mhl ../mh/bin/mh_proxy .</p>
<p>This is my mh_proxy script that I use to start misterhouse as a proxy</p>
<p class="textbox">#!/bin/sh<br />
export mh_parms=/mnt/usb/my_mh/mh.private.ini<br />
./mhl &#8220;$@&#8221;</p>
<p>And this is the mhl script that actually starts and monitors the misterhouse process</p>
<p class="textbox">#!/bin/sh<br />
while [ 1 = 1 ]; do<br />
echo<br />
echo Deleting startup file<br />
touch mh.startup<br />
export LANG=C<br />
echo Running mh<br />
perl /mnt/usb/mh/bin/mh &#8220;$@&#8221;<br />
rc=$?<br />
echo mh rc=$rc<br />
if [ $rc = 1 ]; then<br />
echo mh exited normally<br />
exit<br />
fi<br />
if [   -f mh.startup ]; then<br />
echo mh failed on startup &#8230; will not restart<br />
exit<br />
fi<br />
echo mh had an unexpected exit &#8230; sleep a bit, then restarting<br />
date &gt;&gt; mh_restart.log<br />
sleep 5<br />
done</p>
<p>Now you can use the mh_proxy script to start misterhouse on your router.<br />
Next you can start enabling or disabling code. Because I enabled the web interface on port 8080 in mh.private.ini you can browse to your router and use the web interface to enable or disable code. Note that you need a reload to activate the changes. You can also go to the data directory and edit the code_select.txt and code_unselect.txt files to list the code files you want to enable or disable. It is important to understand that the code_select.txt file list the code files you want to enable from the &#8220;misterhouse install directory&#8221;/code/common directory and that code_unselect.txt lists the files you want to disable from your personal code directory. I enabled the following code files from the common code dir</p>
<p class="textbox">mh_control.pl<br />
xAP_command.pl<br />
xAP_send.pl</p>
<p>My own code dir has the following files</p>
<p class="textbox">root@OpenWrt:/mnt/usb# ls my_mh/code/proxy/<br />
digitemp.pl      k8055-file.pl    mh.menu          proxy_server.pl  triggers.mhp</p>
<p>and my code_unselect.txt looks like this</p>
<p class="textbox">proxy_server.pl</p>
<p>So this means that all code files (the ones with .pl extension) are running except proxy_server.pl .</p>
<h2>The Xap setup</h2>
<p>Like you can see in the code_select.txt file I enabled the xAP_command.pl and xAP_send.pl code files you need to also enable them on your main misterhouse box and add the line &#8220;xap_enable_items=1&#8243; to your mh.private.ini file on the main misterhouse box. I have only tested this with Generic_Items but if you create a new Item with the same name on both your proxy and the main misterhouse box the state of these Items will be synced. This works very well for me.</p>
<p>Have a look at my <a href="http://blog.export.be/?p=153" target="_self">1-wire</a> and <a href="http://blog.export.be/?p=182" target="_self">K8055</a> code files for some working examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.export.be/2009/03/how-to-setup-misterhouse-as-a-proxy-on-openwrt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Velleman K8055 IO board misterhouse glue</title>
		<link>http://blog.export.be/2009/03/velleman-k8055-io-board-misterhouse-glue/</link>
		<comments>http://blog.export.be/2009/03/velleman-k8055-io-board-misterhouse-glue/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 15:21:45 +0000</pubDate>
		<dc:creator>nixo</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[misterhouse]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://blog.export.be/?p=182</guid>
		<description><![CDATA[The next device I added to my misterhouse proxy running on my router is the Velleman K8055 IO board. This is a USB powered experimental IO board with 8 outputs, 5 inputs, 2 DAC outputs and 2 analog inputs. I used the k8055 openwrt kernel module from the sourceforge project homepage.
I have compiled the module [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="Velleman K8055 USB IO board" src="http://www.designnotes.com/Merchant2/graphics/00000001/K8055.JPG" alt="" width="163" height="123" />The next device I added to my misterhouse proxy running on my router is the <a title="Velleman k8055 product page" href="http://www.velleman.be/ot/en/product/view/?id=351346" target="_blank">Velleman K8055 IO board.</a> This is a USB powered experimental IO board with 8 outputs, 5 inputs, 2 DAC outputs and 2 analog inputs. I used the k8055 openwrt kernel module from <a title="K8055 openwrt kernel module" href="http://sourceforge.net/projects/k8055d/" target="_blank">the sourceforge project homepage.</a><span id="more-182"></span></p>
<p>I have compiled the module myself because there was no package available for the openwrt kamikaze 8.09 release, if you need it you can <a title="K8055 openwrt kernel module" href="http://blog.export.be/downloads/kmod-k8055d_0.1.2_2.4.35.4-brcm-2.4-1_mipsel.ipk">download it here</a> so you don&#8217;t need to install the buildroot etc.or you can install the package directly.</p>
<p class="textbox">opkg install http://blog.export.be/downloads/kmod-k8055d_0.1.2_2.4.35.4-brcm-2.4-1_mipsel.ipk<br />
opkg install kmod-usb-uhci-iv</p>
<p>Like you can see I also installed the kmod-usb-uhci-iv package which was needed for the module to work. If all went well you now a /proc/k8055/0 directory with a file for every input and output. By reading or writing to these files you can read or write values to the board.<br />
Next I wrote some misterhouse code to create misterhouse items for all the IO and the read and write commands to interface the files. Here is my code :<br />
<em>$k8055_out1 = new Generic_Item;<br />
</em> <em>$k8055_out2 = new Generic_Item;<br />
$k8055_out3 = new Generic_Item;<br />
$k8055_out4 = new Generic_Item;<br />
$k8055_out5 = new Generic_Item;<br />
$k8055_out6 = new Generic_Item;<br />
$k8055_out7 = new Generic_Item;<br />
$k8055_out8 = new Generic_Item;<br />
$k8055_in1 = new Generic_Item;<br />
$k8055_in2 = new Generic_Item;<br />
$k8055_in3 = new Generic_Item;<br />
$k8055_in4 = new Generic_Item;<br />
$k8055_in5 = new Generic_Item;<br />
$k8055_out1 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out2 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out3 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out4 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out5 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out6 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out7 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
$k8055_out8 -&gt; set_states (&#8216;aan&#8217;,'uit&#8217;);<br />
if ($state = state_changed $k8055_out1){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out1&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out1&#8242;,0);<br />
}<br />
}</em></p>
<p><em>if ($state = state_changed $k8055_out2){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out2&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out2&#8242;,0);<br />
}<br />
}</em></p>
<p><em>if ($state = state_changed $k8055_out3){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out3&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out3&#8242;,0);<br />
}<br />
}</em></p>
<p><em><em>if ($state = state_changed $k8055_out4){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out4&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out4&#8242;,0);<br />
}<br />
}</em></em></p>
<p><em><em><em>if ($state = state_changed $k8055_out5){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out5&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out5&#8242;,0);<br />
}<br />
}</em></em></em></p>
<p><em><em><em>if ($state = state_changed $k8055_out6){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out6&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out6&#8242;,0);<br />
}<br />
}</em></em></em></p>
<p><em><em><em>if ($state = state_changed $k8055_out7){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out7&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out7&#8242;,0);<br />
}<br />
}<br />
if ($state = state_changed $k8055_out8){<br />
if ($state eq &#8216;aan&#8217;) {<br />
file_write(&#8216;/proc/k8055/0/out8&#8242;,1);<br />
}<br />
else {<br />
file_write(&#8216;/proc/k8055/0/out8&#8242;,0);<br />
}<br />
}<br />
my $input;<br />
if ($New_Second){<br />
$input = file_read(&#8216;/proc/k8055/0/in1&#8242;);<br />
set $k8055_in1 $input;<br />
$input = file_read(&#8216;/proc/k8055/0/in2&#8242;);<br />
set $k8055_in2 $input;<br />
$input = file_read(&#8216;/proc/k8055/0/in3&#8242;);<br />
set $k8055_in3 $input;<br />
$input = file_read(&#8216;/proc/k8055/0/in4&#8242;);<br />
set $k8055_in4 $input;<br />
$input = file_read(&#8216;/proc/k8055/0/in5&#8242;);<br />
set $k8055_in5 $input;<br />
#print_log &#8220;Input 1 is now $input1&#8243;;<br />
}</em></em></em></p>
<p>Handles for the DA and AD ports are not yet implemented because I don&#8217;t use them for the moment.</p>
<p>Update : I just finished doing the same setup on a NSLU2 . I compiled the k8055 module via the buildroot for the ixp4xx harware. The only difference was that I had to use the kmod-usb-ohci_2.6.28.10-1_ixp4xx.ipk module instead of the uhci one. If anyone needs tha packages for the Linux OpenWrt 2.6.28.10 #2  armv5teb GNU/Linux NSLU2 harware let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.export.be/2009/03/velleman-k8055-io-board-misterhouse-glue/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>1-wire usb interface and misterhouse glue</title>
		<link>http://blog.export.be/2009/03/1-wire-usb-interface-and-misterhouse-glue/</link>
		<comments>http://blog.export.be/2009/03/1-wire-usb-interface-and-misterhouse-glue/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:54:50 +0000</pubDate>
		<dc:creator>nixo</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[misterhouse]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://blog.export.be/?p=153</guid>
		<description><![CDATA[After installing misterhouse on my openwrt router I started adding devices. I plugged a 1-wire usb interface into my router and started playing around. There are at least two software programs that work for me in openwrt kamikaze 8.09
owserver
I installed the package owserver with the opkg command line tool
opkg -d usb install owserver
When the package [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="1-wire usb adapater" src="http://www.hobby-boards.com/catalog/images/ds9490r-a.jpg" alt="" width="100" height="80" />After installing misterhouse on my openwrt router I started adding devices. I plugged a 1-wire usb interface into my router and started playing around. There are at least two software programs that work for me in openwrt kamikaze 8.09<span id="more-153"></span></p>
<h2>owserver</h2>
<p>I installed the package owserver with the opkg command line tool</p>
<p class="textbox">opkg -d usb install owserver</p>
<p>When the package was installed i started the owserver.</p>
<p class="textbox">owserver &#8211; u -p 5555</p>
<p>On my desktop running ubuntu I installed owfs</p>
<p class="textbox">sudo apt-get install owfs</p>
<p>which is the client for the owserver program and will create a filesystem whit all the sensors data.</p>
<p class="textbox">sudo mkdir /mnt/ow<br />
sudo owfs -s 192.168.1.1:5555 /mnt/ow</p>
<p>Works like a charm for me</p>
<p class="textbox">drwxr-xr-x  1 root root    8 2009-03-16 21:28 .<br />
drwxr-xr-x 22 root root 4096 2009-02-23 21:16 ..<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 10.096994010800<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 10.585394010800<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 10.6A6E94010800<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 10.A09B94010800<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 10.A77594010800<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 10.F77094010800<br />
drwxrwxrwx  1 root root    8 2009-03-19 15:59 81.E74C2A000000<br />
drwxr-xr-x  1 root root    8 2009-03-16 21:28 bus.0<br />
drwxr-xr-x  1 root root    8 2009-03-16 21:28 settings<br />
drwxr-xr-x  1 root root    8 2009-03-16 21:28 statistics<br />
drwxr-xr-x  1 root root   30 2009-03-16 21:28 structure<br />
drwxr-xr-x  1 root root    8 2009-03-16 21:28 system<br />
drwxr-xr-x  1 root root    8 2009-03-16 21:28 uncached</p>
<p>Nice if you need to share your 1-wire data over the network but what i want is to have my temperature sensors values available in misterhouse that runs on the router as well.<br />
So let&#8217;s go on to the next solution.</p>
<h2>digitemp</h2>
<p>Digitemp is another command line tool to interface a 1-wire network. To install type</p>
<p class="textbox">opkg -d usb install digitemp</p>
<p>Let&#8217;s do a first test :</p>
<p class="textbox">root@OpenWrt:~# digitemp_DS2490 -w<br />
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane<br />
GNU Public License v2.0 &#8211; http://www.digitemp.com<br />
Found DS2490 device #1 at 003/004<br />
Turning off all DS2409 Couplers<br />
&#8230;&#8230;.<br />
Devices on the Main LAN<br />
10A09B9401080052 : DS1820/DS18S20/DS1920 Temperature Sensor<br />
105853940108009D : DS1820/DS18S20/DS1920 Temperature Sensor<br />
106A6E9401080076 : DS1820/DS18S20/DS1920 Temperature Sensor<br />
10096994010800BD : DS1820/DS18S20/DS1920 Temperature Sensor<br />
10A77594010800AF : DS1820/DS18S20/DS1920 Temperature Sensor<br />
10F7709401080053 : DS1820/DS18S20/DS1920 Temperature Sensor<br />
81E74C2A000000A5 : Unknown Family Code</p>
<p>That&#8217;s good ! Next create a conf file.</p>
<p class="textbox">digitemp -i</p>
<p> Now you can read a value like this
<p class="textbox">digitemp_DS2490 -t 2 -q -c /root/.digitemprc<br />
Feb 08 22:09:23 Sensor 2 C: 21.00 F: 69.80</p>
<p>All that we need now is some perl code to read the sensors values and store them in a misterhouse variable. I came up with the following code.</p>
<p class="textbox">use vars &#8216;$tempsensor1&#8242;;<br />
if ($New_Minute){<br />
$_=`digitemp_DS2490 -t 5 -q -c /root/.digitemprc`;<br />
/\sC:\s(.*)\sF/;<br />
$tempsensor1 = $1;<br />
print_log &#8220;Temperatuur is nu $tempsensor1&#8243;;<br />
}
</p>
<p>This is just some test code but it proofs that it works so I am happy for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.export.be/2009/03/1-wire-usb-interface-and-misterhouse-glue/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to install misterhouse on openwrt kamikaze 8.09</title>
		<link>http://blog.export.be/2009/03/how-to-install-misterhouse-on-openwrt-kamikaze-809/</link>
		<comments>http://blog.export.be/2009/03/how-to-install-misterhouse-on-openwrt-kamikaze-809/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 14:52:32 +0000</pubDate>
		<dc:creator>nixo</dc:creator>
				<category><![CDATA[misterhouse]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://blog.export.be/?p=115</guid>
		<description><![CDATA[Misterhouse is home automation software written in perl. Because it is written in perl it can run on any OS that has perl binaries so even on a small router that runs openwrt. If you don&#8217;t have openwrt already running on your hardware first follow my guide to install openwrt with USB media for extra [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="misterhouse logo" src="http://misterhouse.sourceforge.net/mh_logo.gif" alt="" width="99" height="97" />Misterhouse is home automation software written in perl. Because it is written in perl it can run on any OS that has perl binaries so even on a small router that runs openwrt. If you don&#8217;t have openwrt already running on your hardware first follow <a title="install openwrt 8.09 on asus WL-500g deluxe with USB media for extra space" href="http://blog.export.be/?p=70" target="_self">my guide to install openwrt with USB media for extra space.</a></p>
<p>The first step is to install perl and all the modules misterhouse need . <span id="more-115"></span>Install following packages with the opkg command</p>
<p class="textbox">opkg install packagename</p>
<p>perl<br />
perlbase-autoloader<br />
perlbase-base<br />
perlbase-bytes<br />
perlbase-config<br />
perlbase-cwd<br />
perlbase-data<br />
perlbase-db-file<br />
perlbase-errno<br />
perlbase-essential<br />
perlbase-fcntl<br />
perlbase-file<br />
perlbase-filehandle<br />
perlbase-getopt<br />
perlbase-integer<br />
perlbase-io<br />
perlbase-posix<br />
perlbase-re<br />
perlbase-selectsaver<br />
perlbase-socket<br />
perlbase-symbol<br />
perlbase-term<br />
perlbase-text<br />
perlbase-time<br />
perlbase-xsloader<br />
perlbase-sys<br />
perlbase-encode<br />
perlbase-universal<br />
perlbase-net<br />
perlbase-filehandle</p>
<p>Then install misterhouse. Installing misterhouse is nothing more than unpacking the code to your mounted USB media and altering the config file(s). First download the latest stable code tarball and unpack it.</p>
<p class="textbox">cd /mnt/usb<br />
wget http://prdownloads.sourceforge.net/misterhouse/misterhouse-2.105.tar.gz<br />
tar xzvf misterhouse-2.105.tar.gz .</p>
<p>Now you have a directory /mnt/usb/mh<br />
As a first test you can try to run misterhouse to see if all perl packages  needed are installed and working.</p>
<p class="textbox">cd /mnt/usb/mh/bin<br />
./mhl</p>
<p>You may see some GD.pm and TK perl module errors in the log but can ignore them for the moment. We will disable these functions later. If you see a line &#8220;PM: Saving object states &#8230; done&#8221; then you are good and know that misterhouse is running. You can even browse to http://192.168.1.1:8080 to see the web interface.<br />
The next step is to create your own code files and to alter the misterhouse configuration file for your needs. This is explained on <a title="Misterhouse documentation" href="http://misterhouse.sourceforge.net/mh.html" target="_blank">the misterhouse homepage</a> or in the docs section of your misterhouse install directory .<br />
A first step could be to disable TK and GD code by adding the following lines to your mh.private.ini file</p>
<p class="textbox">tk=0<br />
gd=0</p>
<p>For my own project I run misterhouse as a proxy. A proxy is a stripped down misterhouse process that can interact with a main full misterhouse install on another server for example. In my next post I will explain how i setup my misterhouse proxy with a Velleman K8055 USB IO board, a 1-wire usb interface and a bluetooth dongle to detect if my mobile phone is nearby.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.export.be/2009/03/how-to-install-misterhouse-on-openwrt-kamikaze-809/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
