<?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>Sebastian Mogilowskis Blog &#187; fhem</title>
	<atom:link href="http://www.mogilowski.net/lang/en-us/tag/fhem/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mogilowski.net</link>
	<description>Just another blog about administration, linux and other stuff</description>
	<lastBuildDate>Tue, 17 Jan 2012 13:42:30 +0000</lastBuildDate>
	<language>en-us</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ELV EM 1000 energy meter on debian with cacti</title>
		<link>http://www.mogilowski.net/lang/en-us/2008/12/28/elv-em-1000-energy-meter-on-debian-with-cacti</link>
		<comments>http://www.mogilowski.net/lang/en-us/2008/12/28/elv-em-1000-energy-meter-on-debian-with-cacti#comments</comments>
		<pubDate>Sun, 28 Dec 2008 10:36:27 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[elv]]></category>
		<category><![CDATA[em]]></category>
		<category><![CDATA[em1000]]></category>
		<category><![CDATA[emwz]]></category>
		<category><![CDATA[fhem]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=193</guid>
		<description><![CDATA[This article describes how you can use the EM 1000 with an EM 1000-WZ energiemeter on debian and log the values with cacti.. First you need the &#8220;ftdi_sio&#8221; kernel module. You need the &#8220;vendor&#8221; and &#8220;product&#8221; ID before you can use the module. lsusb Bus 005 Device 017: ID 0403:e0ef Future Technology Devices International, Ltd [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en-us">This article describes how you can use the EM 1000 with an EM 1000-WZ energiemeter on debian and log the values with cacti..</span></p>
<p><img class="aligncenter size-full wp-image-240" title="current power graph" src="http://cdn.mogilowski.net/wp-content/uploads/graph_imagephp.png" alt="current power graph" width="597" height="199" /></p>
<p><span lang="en-us">First you need the &#8220;ftdi_sio&#8221; kernel module. You need the &#8220;vendor&#8221; and &#8220;product&#8221; ID before you can use the module.</span></p>
<pre>
lsusb
Bus 005 Device 017: ID 0403:e0ef Future Technology Devices International, Ltd
</pre>
<p><span lang="en-us">now you can use the module with</span></p>
<pre>
modprobe ftdi_sio vendor=0x0403 product=0xe0ef
</pre>
<p><span lang="en-us">You have to replace the values of &#8220;vendor&#8221; and &#8220;product&#8221; ID with your values (Result of lsusb).</span></p>
<p><span lang="en-us">More details: (<a href="http://www.koeniglich.de/fhem/linux.html" target="_blank">EM Linux Driver</a>)</span></p>
<p><span lang="en-us">To add the kernel module permanent to the system, you have to add the following line to &#8220;/etc/modules&#8221;:</span></p>
<pre>
ftdi_sio options vendor=0x0403 product=0xe0ef
</pre>
<p><span lang="en-us">Now the EM 1000 is available as an USB device (/dev/ttyUSB0 for example).</span></p>
<p><span lang="en-us">You also need the &#8220;libdevice-serialport-perl&#8221; to read the sensor with perl.</span></p>
<pre>
aptitude install libdevice-serialport-perl
</pre>
<p><span lang="en-us">Now we need <a href="http://www.koeniglich.de/fhem/fhem.html" target="_blank">FHEM</a> to read the sensors.</span></p>
<p><span lang="en-us">FHEM runs as an server application and write the values every 5 minutes in a file. FHEM acceptes port 1-4 for an EMWZ sensor. My EMWZ is connected as device 5 to my EM 1000. I want to use cacti and not the FHEM log files and web interface, so i used a other method.</span></p>
<p><span lang="en-us">In the &#8220;contrib&#8221; directory of FHEM you find a file &#8220;em1010.pl&#8221; with this you can read the sensor:</span></p>
<pre>
./em1010.pl /dev/ttyUSB0 getDevStatus 5
</pre>

<pre>
Readings       (off  2): 1730
Nr devs        (off  6): 2
puls/5min      (off 13): 14
puls.max/5min  (off 15): 15
cur.power      (      ): 0.140 kW
cur.power max  (      ): 0.150 kW
energy h       (off 33): 0.138 kWh (h)
energy d       (off 37): 3.536 kWh (d)
energy w       (off 41): 38.850 kWh (w)
total energy   (off  7): 38.850 kWh (total)
Alarm PA       (off 45): 2300 W
Price CF       (off 47): 0.15 EUR/kWh
R/kW  EC       (off 49): 0
RAW    e901 c206 0000 02c2 9700 0094 b10e 000f
RAW    0080 0c02 1ab6 19a2 1700 00bf 19be 1780
RAW    0c8a 0000 00d0 0d00 00c2 9700 00fc 08dc
RAW    0500 00
</pre>
<p><span lang="en-us">Now we only need a script to bring this output in a cacti friendly form.</span></p>
<p><span lang="en-us">Copy the em1010.pl to &#8220;/usr/local/bin/&#8221;:</span></p>
<pre>
cp em1010.pl /usr/local/bin/
</pre>
<p><span lang="en-us">and create a new file &#8220;em1010wz.pl&#8221; in the cacti script path with the following content:</span></p>
<pre>
#!/usr/bin/perl
# 2008 - Mogilowski Sebastian
# Script that parses the output of em1010.pl getDevStatus for cacti internal processing:

# Settings:
$deviceNumber = 5;
$USBDevice = '/dev/ttyUSB0';
# - End settings -

open(DEV_STATE, "/usr/local/bin/em1010.pl $USBDevice getDevStatus $deviceNumber&#124;");

while(&#60;DEV_STATE&#62;) {
chomp;
if (s/^[ ]*cur\.power[ ]*\([ ]*\)[:][ ](\d+\.*\d+).*/\1/) {
print "cur_power:" . $_ * 1000 . " ";
}
}

close(DEV_STATE);
</pre>
<p><span lang="en-us">This perl script reads the EMWZ sensor and return the value of current power in a cacti readable form. The value will be transformed from kW into W.</span></p>
<p><span lang="en-us">The script reads only the value of &#8220;cur. power&#8221;, you can add other values from the sensor output if you like.</span></p>
<p><span lang="en-us">The next step is to create a &#8220;Data Input Method&#8221; (cur_power), a &#8220;Data Template&#8221; and a &#8220;Graph Template&#8221;.</span></p>
<p><span lang="en-us">You can download the final templates for cacti and the scripts here: <a class="downloadlink" href="http://www.mogilowski.net/wp-content/plugins/download-monitor/download.php?id=7" title="Version 1.0 heruntergeladen 419 mal" >Cacti Template EM1010WZ (19.82 KB)</a></span></p>
<p><strong>Update:</strong></p>
<p><span lang="en-us">If you use Munin try this solution:</span><br />
<a href="http://netaddict.de/howtos:em1010" target="_blank">http://netaddict.de/howtos:em1010</a></p>
<p><span><strong>Links:</strong></span></p>
<p><a href="http://www.koeniglich.de/fhem/fhem.html" target="_blank">http://www.koeniglich.de/fhem/fhem.html</a><br />
<a href="http://groups.google.com/group/FHZ1000-users-on-unix" target="_blank">http://groups.google.com/group/FHZ1000-users-on-unix</a><br />
<a href="http://www.elv.de/Funk-Energie-Me%C3%9Fsystem/x.aspx/cid_74/detail_1/detail2_439 " target="_blank">http://www.elv.de/Funk-Energie-Me%C3%9Fsystem/x.aspx/cid_74/detail_1/detail2_439</a><br />
<a href="http://forums.cacti.net/viewtopic.php?p=151850" target="_blank">http://forums.cacti.net/viewtopic.php?p=151850</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/en-us/2008/12/28/elv-em-1000-energy-meter-on-debian-with-cacti/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 18/32 queries in 0.020 seconds using apc
Object Caching 491/492 objects using apc
Content Delivery Network via cdn.mogilowski.net

Served from: www.mogilowski.net @ 2012-02-05 02:10:27 -->
