<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.linuxmce.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhorst</id>
	<title>LinuxMCE - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.linuxmce.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhorst"/>
	<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php/Special:Contributions/Mhorst"/>
	<updated>2026-07-22T04:08:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=ZME_06443&amp;diff=29868</id>
		<title>ZME 06443</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=ZME_06443&amp;diff=29868"/>
		<updated>2012-04-21T15:03:52Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: Created page with &amp;quot;Category: Hardware {{versioninfo|810Status=According to category, Works without caveats|810UpdatedDate=21st April 2012|810UpdatedBy=mhorst|}} [[Category: Auto...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{{versioninfo|810Status=According to category, Works without caveats|810UpdatedDate=21st April 2012|810UpdatedBy=[[User:mhorst|mhorst]]|}}&lt;br /&gt;
[[Category: Automation]]&lt;br /&gt;
[[Category: RF Control]]&lt;br /&gt;
[[Category: ZWave]]&lt;br /&gt;
[[Category: ZWave_switch]]&lt;br /&gt;
[[Category: Works without caveats on 0810]]&lt;br /&gt;
&lt;br /&gt;
[[Image:duwi_zw_ws_05443.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
= Z-Wave wall-mounted switch transmitter, battery powered  = &lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
This is exactly the same hardware as the [[Düwi_Popp_ZW_WS_05443]] Z-Wave switch, but with new firmware developed by Z-Wave.Me.&lt;br /&gt;
&lt;br /&gt;
The firmware has many additional features compared to the original Düwi firmware. Most importantly, for LinuxMCE, is that LinuxMCE can receive events from this controller, even when the controller is not associated with any device.&lt;br /&gt;
&lt;br /&gt;
== Installation Notes / Experience ==&lt;br /&gt;
The user manual for the switch says I have to hold the Inclusion button for two seconds to add the switch to the existing network. This worked, in combination with pressing the button on the [[Aeon_Labs_Z-Wave_Interface]] in my core. However, I only received events after I also had presse the button on the Aeon Labs stick and pressed the controller three times. &lt;br /&gt;
&lt;br /&gt;
Association of devices to this controller can be performed via the LinuxMCE web-admin panel. However, I had to press the controller&#039;s button three times before the new configuration from LinuxMCE became active on the switch itself.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [http://en.z-wave.me/content/wall-controller]&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=D%C3%BCwi_Popp_ZW_WS_05443&amp;diff=29867</id>
		<title>Düwi Popp ZW WS 05443</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=D%C3%BCwi_Popp_ZW_WS_05443&amp;diff=29867"/>
		<updated>2012-04-21T14:51:49Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{{versioninfo|710Status=According to category, Works without caveats|710UpdatedDate=26th July 2010|710UpdatedBy=[[User:Valent|Valent]]|810Status=According to category, Works without caveats|810UpdatedDate=26th July 2010|810UpdatedBy=[[User:Valent|Valent]]|}}&lt;br /&gt;
[[Category: Automation]]&lt;br /&gt;
[[Category: RF Control]]&lt;br /&gt;
[[Category: ZWave]]&lt;br /&gt;
[[Category: ZWave_switch]]&lt;br /&gt;
[[Category: Works without caveats on 0710]]&lt;br /&gt;
[[Category: Works without caveats on 0810]]&lt;br /&gt;
&lt;br /&gt;
[[Image:duwi_zw_ws_05443.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
= Z-Wave wall-mounted switch transmitter, battery powered  = &lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
Düwi ZW WS 05443 Z-Wave switch that can be placed anywhere.&lt;br /&gt;
For wireless switching, resp. control of: all Z-Wave wireless switch inserts and wireless intermediate plugs, existing installations can also be expanded without flush-mounted power point, high flexibility with installation due to extremely flat design, to stick or screw on to various substrates, for installation in existing switch box or clipping-in in multiple combinations.&lt;br /&gt;
Voltage supply: 2 x 1.5 V battery (LR8 D425), &lt;br /&gt;
Range: up to 100 m free field, Range multiplies through the protected Z-Wave Routing System&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
LinuxMCE does not receive events from this controller directly, it can only detect that the controller is pressed by inspecting the state of the device that the controller is associated with.&lt;br /&gt;
See also [[ZME_06443]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [http://www.duewi.de/download.php?bid=5860&amp;amp;lid=4 Manual (German)]&lt;br /&gt;
* [http://pepper1.net/zwavedb/uploads/resources/c47dc5e2d0b4e8bbdfd813398373b833c4db3f4a.pdf Manual (English)]&lt;br /&gt;
* [http://www.duewi.de/index.php?productid=37276 Düwi Product page]&lt;br /&gt;
* [http://www.duewi.de/download.php?bid=5863&amp;amp;lid=4 Quickstart]&lt;br /&gt;
&lt;br /&gt;
== Where to buy ==&lt;br /&gt;
* [http://www.home4u-store.com/interact%C2%B3-funk-wandsender-d%C3%BCwi-05443-p-4567.html Home4U Store - 33€]&lt;br /&gt;
* [http://p5.hu/hu/termekek/reszletek/57_popp_z-wave_fali_ado/ P5.hu - 63€ (50€ + 25%)]&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=D%C3%BCwi_ZW_ESJ_05436&amp;diff=27652</id>
		<title>Düwi ZW ESJ 05436</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=D%C3%BCwi_ZW_ESJ_05436&amp;diff=27652"/>
		<updated>2011-04-12T17:17:07Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: /* Links */ Added a link to an english version of the manual&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{{versioninfo|710Status=According to category, Works without caveats|710UpdatedDate=26th July 2010|710UpdatedBy=[[User:Valent|Valent]]|810Status=According to category, Works without caveats|810UpdatedDate=26th July 2010|810UpdatedBy=[[User:Valent|Valent]]|}}&lt;br /&gt;
[[Category: Automation]]&lt;br /&gt;
[[Category: RF Control]]&lt;br /&gt;
[[Category: ZWave]]&lt;br /&gt;
[[Category: ZWave_wallplug]]&lt;br /&gt;
[[Category: Works without caveats on 0710]]&lt;br /&gt;
[[Category: Works without caveats on 0810]]&lt;br /&gt;
&lt;br /&gt;
[[Image:duwi_zw_esj_05436.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
= Düwi ZWave Sun Window Blind Insert = &lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&#039;&#039;&#039;Düwi ZW ESJ 05436 Z-Wave has dual function:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Switch/Dimmer:&lt;br /&gt;
Serves for the switching or dimming of connected lights either via radio signals or directly over clipped-on radio-rockers.&lt;br /&gt;
&lt;br /&gt;
;Sun blind control: &lt;br /&gt;
The Düwi wireless insert of sun blind is for the wireless opening and closing of window blinds, shutters,sun blinds and electronic gates. The wireless sun blind automatically turns off the contact after about 2 minutes (value set at delivery) in order to protect the motor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Technical specifications:&lt;br /&gt;
* Switching capacity&lt;br /&gt;
** ohmic 1800W&lt;br /&gt;
** 460VA (motors + luminescent lamps)&lt;br /&gt;
** 500W incandescent bulbs &lt;br /&gt;
* Operating voltage: 230 V~, 50 Hz&lt;br /&gt;
* Switching time: 2 minutes (time period is factory set)&lt;br /&gt;
* Micro fuse: T 8 A H&lt;br /&gt;
* Standby : &amp;lt; 1 W&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [ftp://ftp.zwaveeurope.com/pub/man/en/DUW/DUW_064367_in_en.pdf Installation manual]&lt;br /&gt;
* [http://www.duewi.de/index.php?productid=37344 Product page]&lt;br /&gt;
* [http://www.duewi.de/download.php?bid=5856&amp;amp;lid=4 Manual]&lt;br /&gt;
* [http://www.pepper1.net/zwavedb/uploads/resources/dec54c7d90379524e6ae65cff6cd9c8c50739893.pdf Manual (English)]&lt;br /&gt;
* [http://www.duewi.de/download.php?bid=5863&amp;amp;lid=4 Quickstart]&lt;br /&gt;
&lt;br /&gt;
== Where to buy ==&lt;br /&gt;
* [http://www.home4u-store.com/interact%C2%B3-funk-einsatz-jalousie-aktor-jalousie-d%C3%BCwi-05436-p-4566.html Home4U Store - 45€]&lt;br /&gt;
* [http://www.zwave4u.com/products/en/Window-Control/Duwi-Z-Wave-Window-Blind-Insert.html ZWave4U - 58€]&lt;br /&gt;
* [http://p5.hu/hu/termekek/reszletek/55_popp_fali_redonyvezerlo_betet/ P5.hu - 74€ (59€ + 25%)]&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=D%C3%BCwi_Popp_ZW_WS_05443&amp;diff=27499</id>
		<title>Düwi Popp ZW WS 05443</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=D%C3%BCwi_Popp_ZW_WS_05443&amp;diff=27499"/>
		<updated>2011-04-03T11:43:52Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: /* Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{{versioninfo|710Status=According to category, Works without caveats|710UpdatedDate=26th July 2010|710UpdatedBy=[[User:Valent|Valent]]|810Status=According to category, Works without caveats|810UpdatedDate=26th July 2010|810UpdatedBy=[[User:Valent|Valent]]|}}&lt;br /&gt;
[[Category: Automation]]&lt;br /&gt;
[[Category: RF Control]]&lt;br /&gt;
[[Category: ZWave]]&lt;br /&gt;
[[Category: ZWave_switch]]&lt;br /&gt;
[[Category: Works without caveats on 0710]]&lt;br /&gt;
[[Category: Works without caveats on 0810]]&lt;br /&gt;
&lt;br /&gt;
[[Image:duwi_zw_ws_05443.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
= Z-Wave wall-mounted switch transmitter, battery powered  = &lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
Düwi ZW WS 05443 Z-Wave switch that can be placed anywhere.&lt;br /&gt;
For wireless switching, resp. control of: all Z-Wave wireless switch inserts and wireless intermediate plugs, existing installations can also be expanded without flush-mounted power point, high flexibility with installation due to extremely flat design, to stick or screw on to various substrates, for installation in existing switch box or clipping-in in multiple combinations.&lt;br /&gt;
Voltage supply: 2 x 1.5 V battery (LR8 D425), &lt;br /&gt;
Range: up to 100 m free field, Range multiplies through the protected Z-Wave Routing System&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [http://www.duewi.de/download.php?bid=5860&amp;amp;lid=4 Manual (German)]&lt;br /&gt;
* [http://pepper1.net/zwavedb/uploads/resources/c47dc5e2d0b4e8bbdfd813398373b833c4db3f4a.pdf Manual (English)]&lt;br /&gt;
* [http://www.duewi.de/index.php?productid=37276 Düwi Product page]&lt;br /&gt;
* [http://www.duewi.de/download.php?bid=5863&amp;amp;lid=4 Quickstart]&lt;br /&gt;
&lt;br /&gt;
== Where to buy ==&lt;br /&gt;
* [http://www.home4u-store.com/interact%C2%B3-funk-wandsender-d%C3%BCwi-05443-p-4567.html Home4U Store - 33€]&lt;br /&gt;
* [http://p5.hu/hu/termekek/reszletek/57_popp_z-wave_fali_ado/ P5.hu - 63€ (50€ + 25%)]&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Bluetooth_Dongle&amp;diff=27345</id>
		<title>Bluetooth Dongle</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Bluetooth_Dongle&amp;diff=27345"/>
		<updated>2011-03-27T11:01:15Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: /* Turning off automatic discovery */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{{Versioninfo}}&lt;br /&gt;
[[Category: Tutorials| ]]&lt;br /&gt;
[[Category: Bluetooth]]&lt;br /&gt;
&lt;br /&gt;
==What is the purpose?==&lt;br /&gt;
&amp;lt;p&amp;gt;If you have Bluetooth in the computer that you will use as a LinuxMCE Media Director, this device [http://wiki.linuxmce.org/index.php/Control_LinuxMCE_using_a_Symbian_Series_60_mobile_phone_with_Bl turns your mobile phone into a remote control] and gives you &amp;quot;follow-me&amp;quot; capabilities--your lighting preferences, media and more can follow you around the house.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements and Compatibility==&lt;br /&gt;
&amp;lt;p&amp;gt;Runs on both Linux, using the Bluez library, and Windows, using the standard Windows/Widcom drivers.  Although it should work with all Bluetooth devices, we always use USB Bluetooth dongles with the CSR chipset for both Windows and Linux.  The D-Link DBT-120 and TDK are some of the more common models.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Turning off automatic discovery==&lt;br /&gt;
To prevent LinuxMCE from finding bluetooth devices outside of your home the autodetection (of any BT device) can be turned off as followed: [http://forum.linuxmce.org/index.php?topic=3139.msg16493#msg16493]&lt;br /&gt;
# Login in Web Admin&lt;br /&gt;
# Go to Advanced -&amp;gt; Configuration -&amp;gt; Devices&lt;br /&gt;
# Open the CORE&lt;br /&gt;
# Open DCERouter and click on Orbiter Plugin&lt;br /&gt;
# Check the Ignore check box under &amp;quot;Device data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Turn it back on again to autodetect new devices you&#039;re adding to the network, after which you can turn it off again once they&#039;re added.&lt;br /&gt;
&lt;br /&gt;
==Things to Consider When Purchasing an Adapter== &lt;br /&gt;
&amp;lt;p&amp;gt;  - A single Class 1 adapter (range 100m, 330 ft) will provide Bluetooth service to your whole house.  With this setup, the system will not be able to detect which room you are in (ie: no follow-me functionality), but it will be able to detect when you arrive home.  This adapter is best placed on the Core for always-on functionality.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;  - A Class 2 adapter (range 10m, 33 ft) is good for Media Directors that are quite far apart (ie: on opposite sides of a large house).  If the Bluetooth ranges don&#039;t overlap, then the system will be able to distinguish your location by room.  If the Bluetooth ranges do overlap, the system may hop you back &amp;amp; forth between rooms rapidly.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;  - A Class 3 adapter (range 1m, 3 ft) can be used for a setup with multiple Media Directors that are too close to use Class 2 adapters.  The downside is that you must be fairly close to the Media Director to be detected.  You might consider using a USB extension cord to move this adapter towards the middle of the room for better detection.  A USB extension cord is also useful if two Media Directors are too close to each other (ie: opposite sides of an adjoining wall).  Having said all of that, Class 3 adapters are not common for the simple reason that their range makes them practically useless except for true PANs, which is not an LinuxMCE use-case. While it is true that many devices can achieve 3m, many will only achieve the specified 1m, especially with local environment considerations, and this renders it useless for LinuxMCE.[http://forum.linuxmce.org/index.php?topic=8175.msg54219#msg54219]&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;  - Remember, Bluetooth is two-way communication, so the effective range will be the shorter of the two devices that are communicating.  If you put Class 2 adapters on all of your Media Directors, but your Orbiter has a Class 3 adapter, then you will be limited to the Class 3 range.&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=How_to_add_your_own_GSD_device&amp;diff=22788</id>
		<title>How to add your own GSD device</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=How_to_add_your_own_GSD_device&amp;diff=22788"/>
		<updated>2010-04-11T17:31:29Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Programmer&#039;s Guide]]&lt;br /&gt;
[[Category: Serial]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: GSD]]&lt;br /&gt;
&lt;br /&gt;
Generic_Serial_Device (also known as [[GSD]]) is a LinuxMCE device that allows an end-user to do simple programming for RS232, serial USB or network connected devices.&lt;br /&gt;
This enables them to quickly and easily write drivers for such devices.&lt;br /&gt;
&lt;br /&gt;
Note, however, that a GSD device driver is more limited than a compiled driver. The GSD driver allows only a single communication channel with the device (RS232, serial USB or a TCP connection across a network).&lt;br /&gt;
If your device has other communication channels (an UDP connection for example), you will have to write a driver in another language and compile it.&lt;br /&gt;
&lt;br /&gt;
== How to add your own GSD device ==&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
For those of you who like to learn by example, there are some already in the LinuxMCE database.&lt;br /&gt;
In the LinuxMCE web admin interface go to Advanced--&amp;gt;Configuration--&amp;gt;Device Templates and pick one of the following device templates:&lt;br /&gt;
* Panasonic IP camera: A simple driver that enables the retrieval of video frames from this network enabled camera&lt;br /&gt;
* Proliphix NT series thermostat: A more elaborate driver for a network enabled thermostat. This driver also sends events to the LMCE system in case, for example, the ambient temperature changes.&lt;br /&gt;
&lt;br /&gt;
=== Creating a new GSD device ===&lt;br /&gt;
&lt;br /&gt;
The steps to add GSD device are following:&lt;br /&gt;
&lt;br /&gt;
==== Install the necessary packages ====&lt;br /&gt;
Be sure that you have installed GSD package - &lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg -l &#039;pluto-generic-serial-device&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
(it should be there).&lt;br /&gt;
&lt;br /&gt;
==== Create a device template ====&lt;br /&gt;
Created a device template for your system and specify that it should use GSD. The [[Edit_Device_Template]] page may be of help here.&lt;br /&gt;
&lt;br /&gt;
Some things you should take into account:&lt;br /&gt;
* Add your template under the proper category; add it under category lighting interfaces if you want to control lighting devices only. To control all kind of devices (security, climate etc) it&#039;s better to use Interface::Specialize.&lt;br /&gt;
* Specify a communication type - RS232, Ethernet etc. and do not forget to specify the way to connect to the device, i.e.:&lt;br /&gt;
** For an Ethernet device, add the TCP Port (#69) to the device data.&lt;br /&gt;
* Specify that your device is controlled via category &amp;quot;Device Category:Core&amp;quot; (&amp;quot;Computers - Core&amp;quot;). Otherwise the driver will not be started on the core.&lt;br /&gt;
&lt;br /&gt;
Furthermore you should add the commands implemented by your device, and the events it can generate. If possible, try to fill in the Plug &amp;amp; Play section to ensure that your device will be automatically detected.&lt;br /&gt;
Also, fill in the comment fields provide others with information about your device template.&lt;br /&gt;
&lt;br /&gt;
==== Adding the device ====&lt;br /&gt;
If you have added Plug &amp;amp; Play information to your device template, a quick reload of the router, followed by the connection of your device will result in the device being detected and added automatically.&lt;br /&gt;
&lt;br /&gt;
If auto-detection is not possible, however, you will have to add your device manually.&lt;br /&gt;
This is done on the GSD page: Wizard --&amp;gt; Devices --&amp;gt; Generic Serial Devices.&lt;br /&gt;
&lt;br /&gt;
After installing the device, and a quick reload of your router you should see GSD process in the console:&lt;br /&gt;
&amp;lt;code&amp;gt;ps -elf|grep Generic_Serial_Device&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;5 S root     10085     1  0  76   0 -   683 -      Jul17 ?        00:00:00 SCREEN -d -m -S LinCon_8000-30 /usr/pluto/bin/Spawn_Device.sh 30 localhost Generic_Serial_Device&lt;br /&gt;
5 S root     10086 10085  0  75   0 -   646 wait   Jul17 pts/8    00:00:00 /bin/bash /usr/pluto/bin/Spawn_Device.sh 30 localhost Generic_Serial_Device&lt;br /&gt;
0 S root     31800 10086  0  79   0 - 123146 295621 Jul17 pts/8   00:00:00 ./Generic_Serial_Device -d 30 -r localhost -l /var/log/pluto/30_Generic_Serial_Device.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells you that a Generic_Serial_Device driver is running. The line containing &amp;quot;./Generic_Serial_Device&amp;quot; shows you the process is running and that this instance of the driver has been given device id 30, and that the logging will be written to the file &amp;quot;/var/log/pluto/30_Generic_Serial_Device.log&amp;quot;. In this log you can find all Ruby errors, connection status and other useful information.&lt;br /&gt;
&lt;br /&gt;
==== Adding the Ruby code ====&lt;br /&gt;
From the Device Template page and from the GSD page you can edit the Ruby codes for your device. There you can write the actual code for the methods implemented by your device.&lt;br /&gt;
&lt;br /&gt;
You should implement the commands you selected for your device, and you should also implement the &amp;quot;Ruby Internal Commands&amp;quot;. These commands consist of the following 6 functions:&lt;br /&gt;
;Private Method Listing:&lt;br /&gt;
: This is not really a function in itself, but rather a section in your Ruby script where you may define common functions that are used in the rest of your driver. A good example would be a function to write a line to the device&#039;s log file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def log(line)&lt;br /&gt;
  # This function logs a line to the log file of the device&lt;br /&gt;
  log = File.open(&amp;quot;/var/log/pluto/&amp;quot; + device_.devid_.to_s + &amp;quot;_Generic_Serial_Device.log&amp;quot;, &amp;quot;a&amp;quot;)&lt;br /&gt;
  log.puts Time.now.to_s + &amp;quot; (Ruby script):&amp;quot; + line.to_s&lt;br /&gt;
  log.close&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Process IDLE: This function is executed each one - two seconds. It may be useful to check for a connection between your device and LinuxMCE, or to poll your device for updates.&lt;br /&gt;
:See the Proliphix NT series thermostat driver for an example of polling, where the time between polls is reduced to once every 5 minutes, instead of once every few seconds.&lt;br /&gt;
&lt;br /&gt;
;Process Incoming Data: This function is called when some data comes from your device:&lt;br /&gt;
&amp;lt;pre&amp;gt;recv = conn_.Recv(100,500);&amp;lt;/pre&amp;gt;&lt;br /&gt;
:recv contains now the data received from the physical device (say some switch is OFF). You can parse it to update a status of that switch in LinuxMCE:&lt;br /&gt;
&amp;lt;pre&amp;gt;cmd = Command.new(device_.devid_, -1001, 1, 2, 48)&lt;br /&gt;
cmd.params_[10] = 0&lt;br /&gt;
SendCommand(cmd)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Process Receive Command For Child: if your device is a parent device for some other devices, this function is called when a command is send to one of the child devices.&lt;br /&gt;
:This function should therefore forward the command to it&#039;s children. For example, a GSD device that controls dimmer or switches might receive a some command like: ON, OFF or SET LEVEL for one of it&#039;s children. It should then send these commands in the desired format to the physical device:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmdId           = cmd.id_                                   # Command ID: ON, OFF, SET LEVEL&lt;br /&gt;
cmdTo           = cmd.devidto_                              # Device ID in LinuxMCE&lt;br /&gt;
devPort         = device_.childdevices_[cmdTo].devdata_[12] # 12 contains a port/channel&lt;br /&gt;
childType       = device_.childdevices_[cmdTo].devtemplid_  # Template ID to know type of device: switch or dimmer&lt;br /&gt;
&lt;br /&gt;
case cmdId&lt;br /&gt;
      when 192 #192 is ON                     &lt;br /&gt;
           command = &#039;&amp;lt;your ON command format&amp;gt;&#039;           &lt;br /&gt;
      when 193 #193 is OFF                        &lt;br /&gt;
           command = &#039;&amp;lt;your OFF command format&amp;gt;&#039; &lt;br /&gt;
      when 184 #184 is Level of dimmer&lt;br /&gt;
           command = &#039;&amp;lt;your SET LEVEL command format&amp;gt;&#039;                   &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
conn_.Send(command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In this example the command includes following parameters: cmdTo - the LinuxMCE ID of the child device - to update the status in LinuxMCE, devPort - Port Number - to know where send actual command, cmdId - command type - ON, OFF, SET LEVEL, level value for SET LEVEL. It might be good idea to push unsuccessful commands into array in the GSD device to run them once again.&lt;br /&gt;
&lt;br /&gt;
:NOTE: From trial and error, I have come to the assumption that ON/OFF and SETLEVEL, internally, have seperate values.  Be careful as you can have a device that is OFF with a setlevel of 100%.  This results in a pretty UGLY message when to attempt the following:  Use cmd[184]=100 to turn a device ON. (but don&#039;t actually send a cmd[192].. when you attempt to turn the device OFF, you&#039;ll get an ugly message in the GSD device saying that the &#039;CMD[193] won&#039;t be processed because it is useless&#039;.  (I&#039;m paraphrasing.. you get the idea...)  What makes this worse, is when you use an orbiter to turn a device on, it will send you a cmd[184], not a cmd[192].  You will need to watch for this and send a cmd[192] as needed.&lt;br /&gt;
&lt;br /&gt;
:NOTE FOR ABOVE:  I have found a way to force the command through.  a bit of history first:&lt;br /&gt;
 The reason we get the infamous &#039;won&#039;t be processed because it is useless&#039; is because DCE has to deal with NON Discrete codes.&lt;br /&gt;
 for instance:  a device that has a power toggle.  IF we turn it on, it turns on.&lt;br /&gt;
 Now, if we turn it ON again, DCE thinks it&#039;s on and because it&#039;s a toggle, it won&#039;t send the command.  That is why we get this message.&lt;br /&gt;
 I dug pretty deep to find this next piece:  params[120]=1&lt;br /&gt;
 this parameter, when set inside a command, will FORCE DCERouter to send the command regardless of what it thinks the state is.&lt;br /&gt;
 Hope this helps other GSD programmers.  DDamron&lt;br /&gt;
&lt;br /&gt;
;Process Initialize: This function is called when GSD device is starting. It&#039;s good point to initialize common variables. It is also a good place get the actual status of your device and notify LinuxMCE of it, since the state might have changed while the GSD driver was down.&lt;br /&gt;
&lt;br /&gt;
;Process Release: This function is called when the GSD device is closing.&lt;br /&gt;
&lt;br /&gt;
Note: LinuxMCE caches your Ruby code, so you should do a quick reload of your router each time when you modify your Ruby code!&lt;br /&gt;
&lt;br /&gt;
=== Other Ruby code examples ===&lt;br /&gt;
&lt;br /&gt;
==== Sending an event ====&lt;br /&gt;
&lt;br /&gt;
To send an event to the LinuxMCE system you can use the following snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmd = Command.new(device_.devid_, -1001, 1, 2, 25)&lt;br /&gt;
cmd.params_[30] = 20&lt;br /&gt;
SendCommand(cmd)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will send the command from your device (device_.devid_) to the LinuxMCE event handler (-1001), identifying it as a priority 1 message, of the event type (2).&lt;br /&gt;
Furthermore the event has id 25, which means it&#039;s a &amp;quot;Temperature Changed&amp;quot; event (the device template page shows the ids of the events you have added to the device).&lt;br /&gt;
&lt;br /&gt;
Additional parameters of the event can be set by using the cmd.params_ mapping. The device template page has an edit button for each event that enables you to see the parameters associated with that event, including a description of its use.&lt;br /&gt;
In our example it shows that the parameter with index 30 is the current ambient temperature in degrees Celcius.&lt;br /&gt;
&lt;br /&gt;
After the cmd object has been initialized it is send to the LinuxMCE system using the SendCommand function.&lt;br /&gt;
&lt;br /&gt;
Note that the same piece of code can be used to send commands instead of events. The only changes are that the message type will be 1 (command) instead of 2 (event), and that the destination will probably differ from the event handler device -1001.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
This section contains some tips on troubleshooting your new driver.&lt;br /&gt;
&lt;br /&gt;
=== Viewing the logs ===&lt;br /&gt;
&lt;br /&gt;
The best way to test the new GSD device is to edit the file /etc/pluto.conf and comment out the LogLevels filter, so the logging is verbose.  You can do this by typing:&lt;br /&gt;
&lt;br /&gt;
vim /etc/pluto.conf&lt;br /&gt;
&lt;br /&gt;
Then move to the start of the line that starts with LogLevels, press &#039;i&#039; for Insert mode in vim, type a # character, then press [ESC]:wq&lt;br /&gt;
The # at the start of a line means it&#039;s commented out, or ignored.&lt;br /&gt;
&lt;br /&gt;
now do a reload router.  You can do this from the console with: /usr/pluto/bin/MessageSend dcerouter 0 -1000 7 1&lt;br /&gt;
&lt;br /&gt;
Then go to the log directory:&lt;br /&gt;
&lt;br /&gt;
cd /var/log/pluto&lt;br /&gt;
&lt;br /&gt;
ls&lt;br /&gt;
&lt;br /&gt;
ls will list the contents of the directory:  There will be a log file that starts with the device number of the gsd device.  To follow it type:&lt;br /&gt;
&lt;br /&gt;
tail -f [filename]&lt;br /&gt;
&lt;br /&gt;
rather than typing in the full filename, you can just type the first letters (ie the device number) and press tab, which does an auto complete.&lt;br /&gt;
&lt;br /&gt;
Now send commands to the device.  You can do this through the web site or the console.  For example, assuming your GSD device has the device id 57, you can send it an ON command (ON is command #192), you could type: /usr/pluto/bin/MessageSend dcerouter 0 57 1 192&lt;br /&gt;
&lt;br /&gt;
The log will show a bunch of data.  The lines that start with 40 and 41 are the serial data that is being sent to/from the device.  To filter the tail so it only shows the serial data, type:&lt;br /&gt;
&lt;br /&gt;
tail -f [filename] | grep &#039;^40\|^41&#039;&lt;br /&gt;
&lt;br /&gt;
=== Getting the device to start ===&lt;br /&gt;
If your device will not start (anymore) as described in section [[How to add your own GSD device#Adding the device]] there can be several causes.&lt;br /&gt;
&lt;br /&gt;
Check that your device is controlled by the core, as described in [[How to add your own GSD device#Create a device template]]. Otherwise the core assumes another device will start the driver.&lt;br /&gt;
&lt;br /&gt;
If your Ruby code contains an error, LinuxMCE may decide to disable the device. So, check that your device is not disabled: on Wizard--&amp;gt;Devices--&amp;gt;Generic Serial Devices click on &amp;quot;Advanced&amp;quot; for your device and make sure the Disabled box is NOT ticked. If it is, untick it, save, and do a quick reload of the router.&lt;br /&gt;
&lt;br /&gt;
Sometimes a quick reload of the router does not suffice. In that case you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/pluto/bin/Start_LocalDevices.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This should start your device. If not, the output of that script is a good place to look for further clues.&lt;br /&gt;
&lt;br /&gt;
== Sharing your driver ==&lt;br /&gt;
&lt;br /&gt;
Once your driver is working properly, you can share it with the rest of the LinuxMCE community.&lt;br /&gt;
The procedure for this is as follows:&lt;br /&gt;
* Do an sqlCVS update from the web-admin to ensure that your database is up-to-date (Advanced --&amp;gt; sqlCVS --&amp;gt; Update, select all sections)&lt;br /&gt;
* Create a Trac ticked describing your device (http://svn.linuxmce.org)&lt;br /&gt;
* Do a check-in of your changes: Use the sqlCVS diff function (Advanced --&amp;gt; sqlCVS --&amp;gt; Diff) to determine the updates to the &amp;quot;dce&amp;quot; and &amp;quot;ir&amp;quot; sections of your database and check them in anonymously. The comment of your check-in should mention the Trac ticket number.&lt;br /&gt;
* The developers will verify this and check the driver into the database&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[GSD Ruby Interface]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[GSD - Ruby codes ]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[Generic Serial Device]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Proliphix_NT_series_thermostat&amp;diff=22787</id>
		<title>Proliphix NT series thermostat</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Proliphix_NT_series_thermostat&amp;diff=22787"/>
		<updated>2010-04-11T17:23:54Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: /* Status */  Update status&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Climate]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Proliphix_nt20e_network_thermostat.jpg|thumb|200px|Proliphix NT20e network thermostat]]&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The Proliphix thermostats are IP enabled thermostats with a built in web-server, enabling easy configuration from a standard webbrowser.&lt;br /&gt;
&lt;br /&gt;
The thermostat does not contain batteries. It obtains it&#039;s power via Power-over-Ethernet or from the HVAC system itself. The model numbers ending in &amp;quot;h&amp;quot; obtain their power from the HVAC system, while the model numbers ending in &amp;quot;e&amp;quot; obtain their power from the ethernet.&lt;br /&gt;
Note that the lower numbered thermostats only support a propietary PoE standard, whereas the higher numbered models also support the IEEE 802.3af standard.&lt;br /&gt;
&lt;br /&gt;
= Status =&lt;br /&gt;
&lt;br /&gt;
A driver has been developed based on the Proliphix Device Protocol Revision 1.11. (See http://forum.linuxmce.org/index.php?topic=9538.0)&lt;br /&gt;
This driver has been tested with the following models:&lt;br /&gt;
* Proliphix NT-100e&lt;br /&gt;
&lt;br /&gt;
The driver implements the standard LinuxMCE thermostat commands. Which means that from LinuxMCE the following commands can be executed:&lt;br /&gt;
* The thermostat&#039;s mode can be changed (Off, Heating only, Cooling only, Automatic)&lt;br /&gt;
* The fan mode can be changed (Auto or Always On)&lt;br /&gt;
* The temperature set-point can be changed&lt;br /&gt;
&lt;br /&gt;
Furthermore the driver reports the standard LinuxMCE thermostat status messages to the system. This means LinuxMCE is aware of the following:&lt;br /&gt;
* The thermostat&#039;s mode&lt;br /&gt;
* The fan mode&lt;br /&gt;
* The current heating set-point&lt;br /&gt;
* The current ambient temperature (this is the average temperature for models with multiple sensors, reading individual sensor is not supported)&lt;br /&gt;
&lt;br /&gt;
The only additional feature of the driver is that it synchronizes the thermostat&#039;s time with the LinuxMCE system time. This way the clock will never be out of sync for more than 10 minutes, and the thermostat will not have to be manually updated when switching to (or from) Daylights Savings Time.&lt;br /&gt;
&lt;br /&gt;
Of course the thermostat&#039;s administration page can still be accessed normally to update the schedule and other settings.&lt;br /&gt;
&lt;br /&gt;
NOTE: The driver is in the process of being committed to the LinuxMCE repository, see Trac Ticket #671 (http://svn.linuxmce.org/trac.cgi/ticket/671)&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* Manufacturer: http://www.proliphix.com/&lt;br /&gt;
* Proliphix Device Protocol specification: http://rtc.rubyforge.org/svn/trunk/docs/PDP_API_R1_11.pdf&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=How_to_add_your_own_GSD_device&amp;diff=22784</id>
		<title>How to add your own GSD device</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=How_to_add_your_own_GSD_device&amp;diff=22784"/>
		<updated>2010-04-11T14:55:21Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: /* Sending an event */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Programmer&#039;s Guide]]&lt;br /&gt;
[[Category: Serial]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: GSD]]&lt;br /&gt;
&lt;br /&gt;
Generic_Serial_Device (also known as [[GSD]]) is a LinuxMCE device that allows an end-user to do simple programming for RS232, serial USB or network connected devices.&lt;br /&gt;
This enables them to quickly and easily write drivers for such devices.&lt;br /&gt;
&lt;br /&gt;
Note, however, that a GSD device driver is more limited than a compiled driver. The GSD driver allows only a single communication channel with the device (RS232, serial USB or a TCP connection across a network).&lt;br /&gt;
If your device has other communication channels (an UDP connection for example), you will have to write a driver in another language and compile it.&lt;br /&gt;
&lt;br /&gt;
== How to add your own GSD device ==&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
For those of you who like to learn by example, there are some already in the LinuxMCE database.&lt;br /&gt;
In the LinuxMCE web admin interface go to Advanced--&amp;gt;Configuration--&amp;gt;Device Templates and pick one of the following device templates:&lt;br /&gt;
* Panasonic IP camera: A simple driver that enables the retrieval of video frames from this network enabled camera&lt;br /&gt;
* Proliphix NT series thermostat: A more elaborate driver for a network enabled thermostat. This driver also sends events to the LMCE system in case, for example, the ambient temperature changes.&lt;br /&gt;
&lt;br /&gt;
=== Creating a new GSD device ===&lt;br /&gt;
&lt;br /&gt;
The steps to add GSD device are following:&lt;br /&gt;
&lt;br /&gt;
==== Install the necessary packages ====&lt;br /&gt;
Be sure that you have installed GSD package - &lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg -l &#039;pluto-generic-serial-device&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
(it should be there).&lt;br /&gt;
&lt;br /&gt;
==== Create a device template ====&lt;br /&gt;
Created a device template for your system and specify that it should use GSD. The [[Edit_Device_Template]] page may be of help here.&lt;br /&gt;
&lt;br /&gt;
Some things you should take into account:&lt;br /&gt;
* Add your template under the proper category; add it under category lighting interfaces if you want to control lighting devices only. To control all kind of devices (security, climate etc) it&#039;s better to use Interface::Specialize.&lt;br /&gt;
* Specify a communication type - RS232, Ethernet etc. and do not forget to specify the way to connect to the device, i.e.:&lt;br /&gt;
** For an Ethernet device, add the TCP Port (#69) to the device data.&lt;br /&gt;
* Specify that your device is controlled via category &amp;quot;Device Category:Core&amp;quot; (&amp;quot;Computers - Core&amp;quot;). Otherwise the driver will not be started on the core.&lt;br /&gt;
&lt;br /&gt;
Furthermore you should add the commands implemented by your device, and the events it can generate. If possible, try to fill in the Plug &amp;amp; Play section to ensure that your device will be automatically detected.&lt;br /&gt;
Also, fill in the comment fields provide others with information about your device template.&lt;br /&gt;
&lt;br /&gt;
==== Adding the device ====&lt;br /&gt;
If you have added Plug &amp;amp; Play information to your device template, a quick reload of the router, followed by the connection of your device will result in the device being detected and added automatically.&lt;br /&gt;
&lt;br /&gt;
If auto-detection is not possible, however, you will have to add your device manually.&lt;br /&gt;
This is done on the GSD page: Wizard --&amp;gt; Devices --&amp;gt; Generic Serial Devices.&lt;br /&gt;
&lt;br /&gt;
After installing the device, and a quick reload of your router you should see GSD process in the console:&lt;br /&gt;
&amp;lt;code&amp;gt;ps -elf|grep Generic_Serial_Device&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;5 S root     10085     1  0  76   0 -   683 -      Jul17 ?        00:00:00 SCREEN -d -m -S LinCon_8000-30 /usr/pluto/bin/Spawn_Device.sh 30 localhost Generic_Serial_Device&lt;br /&gt;
5 S root     10086 10085  0  75   0 -   646 wait   Jul17 pts/8    00:00:00 /bin/bash /usr/pluto/bin/Spawn_Device.sh 30 localhost Generic_Serial_Device&lt;br /&gt;
0 S root     31800 10086  0  79   0 - 123146 295621 Jul17 pts/8   00:00:00 ./Generic_Serial_Device -d 30 -r localhost -l /var/log/pluto/30_Generic_Serial_Device.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells you that a Generic_Serial_Device driver is running. The line containing &amp;quot;./Generic_Serial_Device&amp;quot; shows you the process is running and that this instance of the driver has been given device id 30, and that the logging will be written to the file &amp;quot;/var/log/pluto/30_Generic_Serial_Device.log&amp;quot;. In this log you can find all Ruby errors, connection status and other useful information.&lt;br /&gt;
&lt;br /&gt;
==== Adding the Ruby code ====&lt;br /&gt;
From the Device Template page and from the GSD page you can edit the Ruby codes for your device. There you can write the actual code for the methods implemented by your device.&lt;br /&gt;
&lt;br /&gt;
You should implement the commands you selected for your device, and you should also implement the &amp;quot;Ruby Internal Commands&amp;quot;. These commands consist of the following 6 functions:&lt;br /&gt;
;Private Method Listing:&lt;br /&gt;
: This is not really a function in itself, but rather a section in your Ruby script where you may define common functions that are used in the rest of your driver. A good example would be a function to write a line to the device&#039;s log file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def log(line)&lt;br /&gt;
  # This function logs a line to the log file of the device&lt;br /&gt;
  log = File.open(&amp;quot;/var/log/pluto/&amp;quot; + device_.devid_.to_s + &amp;quot;_Generic_Serial_Device.log&amp;quot;, &amp;quot;a&amp;quot;)&lt;br /&gt;
  log.puts Time.now.to_s + &amp;quot; (Ruby script):&amp;quot; + line.to_s&lt;br /&gt;
  log.close&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Process IDLE: This function is executed each one - two seconds. It may be useful to check for a connection between your device and LinuxMCE, or to poll your device for updates.&lt;br /&gt;
:See the Proliphix NT series thermostat driver for an example of polling, where the time between polls is reduced to once every 5 minutes, instead of once every few seconds.&lt;br /&gt;
&lt;br /&gt;
;Process Incoming Data: This function is called when some data comes from your device:&lt;br /&gt;
&amp;lt;pre&amp;gt;recv = conn_.Recv(100,500);&amp;lt;/pre&amp;gt;&lt;br /&gt;
:recv contains now the data received from the physical device (say some switch is OFF). You can parse it to update a status of that switch in LinuxMCE:&lt;br /&gt;
&amp;lt;pre&amp;gt;cmd = Command.new(device_.devid_, -1001, 1, 2, 48)&lt;br /&gt;
cmd.params_[10] = 0&lt;br /&gt;
SendCommand(cmd)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Process Receive Command For Child: if your device is a parent device for some other devices, this function is called when a command is send to one of the child devices.&lt;br /&gt;
:This function should therefore forward the command to it&#039;s children. For example, a GSD device that controls dimmer or switches might receive a some command like: ON, OFF or SET LEVEL for one of it&#039;s children. It should then send these commands in the desired format to the physical device:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmdId           = cmd.id_                                   # Command ID: ON, OFF, SET LEVEL&lt;br /&gt;
cmdTo           = cmd.devidto_                              # Device ID in LinuxMCE&lt;br /&gt;
devPort         = device_.childdevices_[cmdTo].devdata_[12] # 12 contains a port/channel&lt;br /&gt;
childType       = device_.childdevices_[cmdTo].devtemplid_  # Template ID to know type of device: switch or dimmer&lt;br /&gt;
&lt;br /&gt;
case cmdId&lt;br /&gt;
      when 192 #192 is ON                     &lt;br /&gt;
           command = &#039;&amp;lt;your ON command format&amp;gt;&#039;           &lt;br /&gt;
      when 193 #193 is OFF                        &lt;br /&gt;
           command = &#039;&amp;lt;your OFF command format&amp;gt;&#039; &lt;br /&gt;
      when 184 #184 is Level of dimmer&lt;br /&gt;
           command = &#039;&amp;lt;your SET LEVEL command format&amp;gt;&#039;                   &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
conn_.Send(command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In this example the command includes following parameters: cmdTo - the LinuxMCE ID of the child device - to update the status in LinuxMCE, devPort - Port Number - to know where send actual command, cmdId - command type - ON, OFF, SET LEVEL, level value for SET LEVEL. It might be good idea to push unsuccessful commands into array in the GSD device to run them once again.&lt;br /&gt;
&lt;br /&gt;
:NOTE: From trial and error, I have come to the assumption that ON/OFF and SETLEVEL, internally, have seperate values.  Be careful as you can have a device that is OFF with a setlevel of 100%.  This results in a pretty UGLY message when to attempt the following:  Use cmd[184]=100 to turn a device ON. (but don&#039;t actually send a cmd[192].. when you attempt to turn the device OFF, you&#039;ll get an ugly message in the GSD device saying that the &#039;CMD[193] won&#039;t be processed because it is useless&#039;.  (I&#039;m paraphrasing.. you get the idea...)  What makes this worse, is when you use an orbiter to turn a device on, it will send you a cmd[184], not a cmd[192].  You will need to watch for this and send a cmd[192] as needed.&lt;br /&gt;
&lt;br /&gt;
:NOTE FOR ABOVE:  I have found a way to force the command through.  a bit of history first:&lt;br /&gt;
 The reason we get the infamous &#039;won&#039;t be processed because it is useless&#039; is because DCE has to deal with NON Discrete codes.&lt;br /&gt;
 for instance:  a device that has a power toggle.  IF we turn it on, it turns on.&lt;br /&gt;
 Now, if we turn it ON again, DCE thinks it&#039;s on and because it&#039;s a toggle, it won&#039;t send the command.  That is why we get this message.&lt;br /&gt;
 I dug pretty deep to find this next piece:  params[120]=1&lt;br /&gt;
 this parameter, when set inside a command, will FORCE DCERouter to send the command regardless of what it thinks the state is.&lt;br /&gt;
 Hope this helps other GSD programmers.  DDamron&lt;br /&gt;
&lt;br /&gt;
;Process Initialize: This function is called when GSD device is starting. It&#039;s good point to initialize common variables. It is also a good place get the actual status of your device and notify LinuxMCE of it, since the state might have changed while the GSD driver was down.&lt;br /&gt;
&lt;br /&gt;
;Process Release: This function is called when the GSD device is closing.&lt;br /&gt;
&lt;br /&gt;
Note: LinuxMCE caches your Ruby code, so you should do a quick reload of your router each time when you modify your Ruby code!&lt;br /&gt;
&lt;br /&gt;
=== Other Ruby code examples ===&lt;br /&gt;
&lt;br /&gt;
==== Sending an event ====&lt;br /&gt;
&lt;br /&gt;
To send an event to the LinuxMCE system you can use the following snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmd = Command.new(device_.devid_, -1001, 1, 2, 25)&lt;br /&gt;
cmd.params_[30] = 20&lt;br /&gt;
SendCommand(cmd)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will send the command from your device (device_.devid_) to the LinuxMCE event handler (-1001), identifying it as a priority 1 message, of the event type (2).&lt;br /&gt;
Furthermore the event has id 25, which means it&#039;s a &amp;quot;Temperature Changed&amp;quot; event (the device template page shows the ids of the events you have added to the device).&lt;br /&gt;
&lt;br /&gt;
Additional parameters of the event can be set by using the cmd.params_ mapping. The device template page has an edit button for each event that enables you to see the parameters associated with that event, including a description of its use.&lt;br /&gt;
In our example it shows that the parameter with index 30 is the current ambient temperature in degrees Celcius.&lt;br /&gt;
&lt;br /&gt;
After the cmd object has been initialized it is send to the LinuxMCE system using the SendCommand function.&lt;br /&gt;
&lt;br /&gt;
Note that the same piece of code can be used to send commands instead of events. The only changes are that the message type will be 1 (command) instead of 2 (event), and that the destination will probably differ from the event handler device -1001.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
This section contains some tips on troubleshooting your new driver.&lt;br /&gt;
&lt;br /&gt;
=== Viewing the logs ===&lt;br /&gt;
&lt;br /&gt;
The best way to test the new GSD device is to edit the file /etc/pluto.conf and comment out the LogLevels filter, so the logging is verbose.  You can do this by typing:&lt;br /&gt;
&lt;br /&gt;
vim /etc/pluto.conf&lt;br /&gt;
&lt;br /&gt;
Then move to the start of the line that starts with LogLevels, press &#039;i&#039; for Insert mode in vim, type a # character, then press [ESC]:wq&lt;br /&gt;
The # at the start of a line means it&#039;s commented out, or ignored.&lt;br /&gt;
&lt;br /&gt;
now do a reload router.  You can do this from the console with: /usr/pluto/bin/MessageSend dcerouter 0 -1000 7 1&lt;br /&gt;
&lt;br /&gt;
Then go to the log directory:&lt;br /&gt;
&lt;br /&gt;
cd /var/log/pluto&lt;br /&gt;
&lt;br /&gt;
ls&lt;br /&gt;
&lt;br /&gt;
ls will list the contents of the directory:  There will be a log file that starts with the device number of the gsd device.  To follow it type:&lt;br /&gt;
&lt;br /&gt;
tail -f [filename]&lt;br /&gt;
&lt;br /&gt;
rather than typing in the full filename, you can just type the first letters (ie the device number) and press tab, which does an auto complete.&lt;br /&gt;
&lt;br /&gt;
Now send commands to the device.  You can do this through the web site or the console.  For example, assuming your GSD device has the device id 57, you can send it an ON command (ON is command #192), you could type: /usr/pluto/bin/MessageSend dcerouter 0 57 1 192&lt;br /&gt;
&lt;br /&gt;
The log will show a bunch of data.  The lines that start with 40 and 41 are the serial data that is being sent to/from the device.  To filter the tail so it only shows the serial data, type:&lt;br /&gt;
&lt;br /&gt;
tail -f [filename] | grep &#039;^40\|^41&#039;&lt;br /&gt;
&lt;br /&gt;
=== Getting the device to start ===&lt;br /&gt;
If your device will not start (anymore) as described in section [[How to add your own GSD device#Adding the device]] there can be several causes.&lt;br /&gt;
&lt;br /&gt;
Check that your device is controlled by the core, as described in [[How to add your own GSD device#Create a device template]]. Otherwise the core assumes another device will start the driver.&lt;br /&gt;
&lt;br /&gt;
If your Ruby code contains an error, LinuxMCE may decide to disable the device. So, check that your device is not disabled: on Wizard--&amp;gt;Devices--&amp;gt;Generic Serial Devices click on &amp;quot;Advanced&amp;quot; for your device and make sure the Disabled box is NOT ticked. If it is, untick it, save, and do a quick reload of the router.&lt;br /&gt;
&lt;br /&gt;
Sometimes a quick reload of the router does not suffice. In that case you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/pluto/bin/Start_LocalDevices.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This should start your device. If not, the output of that script is a good place to look for further clues.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[GSD Ruby Interface]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[GSD - Ruby codes ]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[Generic Serial Device]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Proliphix_NT_series_thermostat&amp;diff=22783</id>
		<title>Proliphix NT series thermostat</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Proliphix_NT_series_thermostat&amp;diff=22783"/>
		<updated>2010-04-11T14:52:27Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: Creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Climate]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Proliphix_nt20e_network_thermostat.jpg|thumb|200px|Proliphix NT20e network thermostat]]&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The Proliphix thermostats are IP enabled thermostats with a built in web-server, enabling easy configuration from a standard webbrowser.&lt;br /&gt;
&lt;br /&gt;
The thermostat does not contain batteries. It obtains it&#039;s power via Power-over-Ethernet or from the HVAC system itself. The model numbers ending in &amp;quot;h&amp;quot; obtain their power from the HVAC system, while the model numbers ending in &amp;quot;e&amp;quot; obtain their power from the ethernet.&lt;br /&gt;
Note that the lower numbered thermostats only support a propietary PoE standard, whereas the higher numbered models also support the IEEE 802.3af standard.&lt;br /&gt;
&lt;br /&gt;
= Status =&lt;br /&gt;
&lt;br /&gt;
A driver has been developed based on the Proliphix Device Protocol Revision 1.11. (See http://forum.linuxmce.org/index.php?topic=9538.0)&lt;br /&gt;
This driver has been tested with the following models:&lt;br /&gt;
* Proliphix NT-100e&lt;br /&gt;
&lt;br /&gt;
The driver implements the standard LinuxMCE thermostat commands. Which means that from LinuxMCE the following commands can be executed:&lt;br /&gt;
* The thermostat&#039;s mode can be changed (Off, Heating only, Cooling only, Automatic)&lt;br /&gt;
* The fan mode can be changed (Auto or Always On)&lt;br /&gt;
* The temperature set-point can be changed&lt;br /&gt;
&lt;br /&gt;
Furthermore the driver reports the standard LinuxMCE thermostat status messages to the system. This means LinuxMCE is aware of the following:&lt;br /&gt;
* The thermostat&#039;s mode&lt;br /&gt;
* The fan mode&lt;br /&gt;
* The current heating set-point&lt;br /&gt;
* The current ambient temperature (this is the average temperature for models with multiple sensors, reading individual sensor is not supported)&lt;br /&gt;
&lt;br /&gt;
The only additional feature of the driver is that it synchronizes the thermostat&#039;s time with the LinuxMCE system time. This way the clock will never be out of sync for more than 10 minutes, and the thermostat will not have to be manually updated when switching to (or from) Daylights Savings Time.&lt;br /&gt;
&lt;br /&gt;
Of course the thermostat&#039;s administration page can still be accessed normally to update the schedule and other settings.&lt;br /&gt;
&lt;br /&gt;
NOTE: The driver has not yet been committed to the LinuxMCE repository yet.&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* Manufacturer: http://www.proliphix.com/&lt;br /&gt;
* Proliphix Device Protocol specification: http://rtc.rubyforge.org/svn/trunk/docs/PDP_API_R1_11.pdf&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=File:Proliphix_nt20e_network_thermostat.jpg&amp;diff=22782</id>
		<title>File:Proliphix nt20e network thermostat.jpg</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=File:Proliphix_nt20e_network_thermostat.jpg&amp;diff=22782"/>
		<updated>2010-04-11T14:33:36Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: Proliphix NT20e network enabled thermostat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Proliphix NT20e network enabled thermostat&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=How_to_add_your_own_GSD_device&amp;diff=22781</id>
		<title>How to add your own GSD device</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=How_to_add_your_own_GSD_device&amp;diff=22781"/>
		<updated>2010-04-11T14:25:23Z</updated>

		<summary type="html">&lt;p&gt;Mhorst: Updated with my experiences of writing my first GSD driver&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Programmer&#039;s Guide]]&lt;br /&gt;
[[Category: Serial]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: GSD]]&lt;br /&gt;
&lt;br /&gt;
Generic_Serial_Device (also known as [[GSD]]) is a LinuxMCE device that allows an end-user to do simple programming for RS232, serial USB or network connected devices.&lt;br /&gt;
This enables them to quickly and easily write drivers for such devices.&lt;br /&gt;
&lt;br /&gt;
Note, however, that a GSD device driver is more limited than a compiled driver. The GSD driver allows only a single communication channel with the device (RS232, serial USB or a TCP connection across a network).&lt;br /&gt;
If your device has other communication channels (an UDP connection for example), you will have to write a driver in another language and compile it.&lt;br /&gt;
&lt;br /&gt;
== How to add your own GSD device ==&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
For those of you who like to learn by example, there are some already in the LinuxMCE database.&lt;br /&gt;
In the LinuxMCE web admin interface go to Advanced--&amp;gt;Configuration--&amp;gt;Device Templates and pick one of the following device templates:&lt;br /&gt;
* Panasonic IP camera: A simple driver that enables the retrieval of video frames from this network enabled camera&lt;br /&gt;
* Proliphix NT series thermostat: A more elaborate driver for a network enabled thermostat. This driver also sends events to the LMCE system in case, for example, the ambient temperature changes.&lt;br /&gt;
&lt;br /&gt;
=== Creating a new GSD device ===&lt;br /&gt;
&lt;br /&gt;
The steps to add GSD device are following:&lt;br /&gt;
&lt;br /&gt;
==== Install the necessary packages ====&lt;br /&gt;
Be sure that you have installed GSD package - &lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg -l &#039;pluto-generic-serial-device&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
(it should be there).&lt;br /&gt;
&lt;br /&gt;
==== Create a device template ====&lt;br /&gt;
Created a device template for your system and specify that it should use GSD. The [[Edit_Device_Template]] page may be of help here.&lt;br /&gt;
&lt;br /&gt;
Some things you should take into account:&lt;br /&gt;
* Add your template under the proper category; add it under category lighting interfaces if you want to control lighting devices only. To control all kind of devices (security, climate etc) it&#039;s better to use Interface::Specialize.&lt;br /&gt;
* Specify a communication type - RS232, Ethernet etc. and do not forget to specify the way to connect to the device, i.e.:&lt;br /&gt;
** For an Ethernet device, add the TCP Port (#69) to the device data.&lt;br /&gt;
* Specify that your device is controlled via category &amp;quot;Device Category:Core&amp;quot; (&amp;quot;Computers - Core&amp;quot;). Otherwise the driver will not be started on the core.&lt;br /&gt;
&lt;br /&gt;
Furthermore you should add the commands implemented by your device, and the events it can generate. If possible, try to fill in the Plug &amp;amp; Play section to ensure that your device will be automatically detected.&lt;br /&gt;
Also, fill in the comment fields provide others with information about your device template.&lt;br /&gt;
&lt;br /&gt;
==== Adding the device ====&lt;br /&gt;
If you have added Plug &amp;amp; Play information to your device template, a quick reload of the router, followed by the connection of your device will result in the device being detected and added automatically.&lt;br /&gt;
&lt;br /&gt;
If auto-detection is not possible, however, you will have to add your device manually.&lt;br /&gt;
This is done on the GSD page: Wizard --&amp;gt; Devices --&amp;gt; Generic Serial Devices.&lt;br /&gt;
&lt;br /&gt;
After installing the device, and a quick reload of your router you should see GSD process in the console:&lt;br /&gt;
&amp;lt;code&amp;gt;ps -elf|grep Generic_Serial_Device&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;5 S root     10085     1  0  76   0 -   683 -      Jul17 ?        00:00:00 SCREEN -d -m -S LinCon_8000-30 /usr/pluto/bin/Spawn_Device.sh 30 localhost Generic_Serial_Device&lt;br /&gt;
5 S root     10086 10085  0  75   0 -   646 wait   Jul17 pts/8    00:00:00 /bin/bash /usr/pluto/bin/Spawn_Device.sh 30 localhost Generic_Serial_Device&lt;br /&gt;
0 S root     31800 10086  0  79   0 - 123146 295621 Jul17 pts/8   00:00:00 ./Generic_Serial_Device -d 30 -r localhost -l /var/log/pluto/30_Generic_Serial_Device.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells you that a Generic_Serial_Device driver is running. The line containing &amp;quot;./Generic_Serial_Device&amp;quot; shows you the process is running and that this instance of the driver has been given device id 30, and that the logging will be written to the file &amp;quot;/var/log/pluto/30_Generic_Serial_Device.log&amp;quot;. In this log you can find all Ruby errors, connection status and other useful information.&lt;br /&gt;
&lt;br /&gt;
==== Adding the Ruby code ====&lt;br /&gt;
From the Device Template page and from the GSD page you can edit the Ruby codes for your device. There you can write the actual code for the methods implemented by your device.&lt;br /&gt;
&lt;br /&gt;
You should implement the commands you selected for your device, and you should also implement the &amp;quot;Ruby Internal Commands&amp;quot;. These commands consist of the following 6 functions:&lt;br /&gt;
;Private Method Listing:&lt;br /&gt;
: This is not really a function in itself, but rather a section in your Ruby script where you may define common functions that are used in the rest of your driver. A good example would be a function to write a line to the device&#039;s log file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def log(line)&lt;br /&gt;
  # This function logs a line to the log file of the device&lt;br /&gt;
  log = File.open(&amp;quot;/var/log/pluto/&amp;quot; + device_.devid_.to_s + &amp;quot;_Generic_Serial_Device.log&amp;quot;, &amp;quot;a&amp;quot;)&lt;br /&gt;
  log.puts Time.now.to_s + &amp;quot; (Ruby script):&amp;quot; + line.to_s&lt;br /&gt;
  log.close&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Process IDLE: This function is executed each one - two seconds. It may be useful to check for a connection between your device and LinuxMCE, or to poll your device for updates.&lt;br /&gt;
:See the Proliphix NT series thermostat driver for an example of polling, where the time between polls is reduced to once every 5 minutes, instead of once every few seconds.&lt;br /&gt;
&lt;br /&gt;
;Process Incoming Data: This function is called when some data comes from your device:&lt;br /&gt;
&amp;lt;pre&amp;gt;recv = conn_.Recv(100,500);&amp;lt;/pre&amp;gt;&lt;br /&gt;
:recv contains now the data received from the physical device (say some switch is OFF). You can parse it to update a status of that switch in LinuxMCE:&lt;br /&gt;
&amp;lt;pre&amp;gt;cmd = Command.new(device_.devid_, -1001, 1, 2, 48)&lt;br /&gt;
cmd.params_[10] = 0&lt;br /&gt;
SendCommand(cmd)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Process Receive Command For Child: if your device is a parent device for some other devices, this function is called when a command is send to one of the child devices.&lt;br /&gt;
:This function should therefore forward the command to it&#039;s children. For example, a GSD device that controls dimmer or switches might receive a some command like: ON, OFF or SET LEVEL for one of it&#039;s children. It should then send these commands in the desired format to the physical device:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmdId           = cmd.id_                                   # Command ID: ON, OFF, SET LEVEL&lt;br /&gt;
cmdTo           = cmd.devidto_                              # Device ID in LinuxMCE&lt;br /&gt;
devPort         = device_.childdevices_[cmdTo].devdata_[12] # 12 contains a port/channel&lt;br /&gt;
childType       = device_.childdevices_[cmdTo].devtemplid_  # Template ID to know type of device: switch or dimmer&lt;br /&gt;
&lt;br /&gt;
case cmdId&lt;br /&gt;
      when 192 #192 is ON                     &lt;br /&gt;
           command = &#039;&amp;lt;your ON command format&amp;gt;&#039;           &lt;br /&gt;
      when 193 #193 is OFF                        &lt;br /&gt;
           command = &#039;&amp;lt;your OFF command format&amp;gt;&#039; &lt;br /&gt;
      when 184 #184 is Level of dimmer&lt;br /&gt;
           command = &#039;&amp;lt;your SET LEVEL command format&amp;gt;&#039;                   &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
conn_.Send(command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: In this example the command includes following parameters: cmdTo - the LinuxMCE ID of the child device - to update the status in LinuxMCE, devPort - Port Number - to know where send actual command, cmdId - command type - ON, OFF, SET LEVEL, level value for SET LEVEL. It might be good idea to push unsuccessful commands into array in the GSD device to run them once again.&lt;br /&gt;
&lt;br /&gt;
:NOTE: From trial and error, I have come to the assumption that ON/OFF and SETLEVEL, internally, have seperate values.  Be careful as you can have a device that is OFF with a setlevel of 100%.  This results in a pretty UGLY message when to attempt the following:  Use cmd[184]=100 to turn a device ON. (but don&#039;t actually send a cmd[192].. when you attempt to turn the device OFF, you&#039;ll get an ugly message in the GSD device saying that the &#039;CMD[193] won&#039;t be processed because it is useless&#039;.  (I&#039;m paraphrasing.. you get the idea...)  What makes this worse, is when you use an orbiter to turn a device on, it will send you a cmd[184], not a cmd[192].  You will need to watch for this and send a cmd[192] as needed.&lt;br /&gt;
&lt;br /&gt;
:NOTE FOR ABOVE:  I have found a way to force the command through.  a bit of history first:&lt;br /&gt;
 The reason we get the infamous &#039;won&#039;t be processed because it is useless&#039; is because DCE has to deal with NON Discrete codes.&lt;br /&gt;
 for instance:  a device that has a power toggle.  IF we turn it on, it turns on.&lt;br /&gt;
 Now, if we turn it ON again, DCE thinks it&#039;s on and because it&#039;s a toggle, it won&#039;t send the command.  That is why we get this message.&lt;br /&gt;
 I dug pretty deep to find this next piece:  params[120]=1&lt;br /&gt;
 this parameter, when set inside a command, will FORCE DCERouter to send the command regardless of what it thinks the state is.&lt;br /&gt;
 Hope this helps other GSD programmers.  DDamron&lt;br /&gt;
&lt;br /&gt;
;Process Initialize: This function is called when GSD device is starting. It&#039;s good point to initialize common variables. It is also a good place get the actual status of your device and notify LinuxMCE of it, since the state might have changed while the GSD driver was down.&lt;br /&gt;
&lt;br /&gt;
;Process Release: This function is called when the GSD device is closing.&lt;br /&gt;
&lt;br /&gt;
Note: LinuxMCE caches your Ruby code, so you should do a quick reload of your router each time when you modify your Ruby code!&lt;br /&gt;
&lt;br /&gt;
=== Other Ruby code examples ===&lt;br /&gt;
&lt;br /&gt;
==== Sending an event ====&lt;br /&gt;
&lt;br /&gt;
To send an event to the LinuxMCE system you can use the following snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmd = Command.new(device_.devid_, -1001, 1, 2, 25)&lt;br /&gt;
cmd.params_[30] = 20&lt;br /&gt;
SendCommand(cmd)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will send the command from your device (&amp;lt;pre&amp;gt;device_.devid_&amp;lt;/pre&amp;gt;) to the LinuxMCE event handler (&amp;lt;pre&amp;gt;-1001&amp;lt;/pre&amp;gt;), identifying it as a priority &amp;lt;pre&amp;gt;1&amp;lt;/pre&amp;gt; message, of the event type (&amp;lt;pre&amp;gt;2&amp;lt;/pre&amp;gt;).&lt;br /&gt;
Furthermore the event has id &amp;lt;pre&amp;gt;25&amp;lt;/pre&amp;gt;, which means it&#039;s a &amp;quot;Temperature Changed&amp;quot; event (the device template page shows the ids of the events you have added to the device).&lt;br /&gt;
&lt;br /&gt;
Additional parameters of the event can be set by using the &amp;lt;pre&amp;gt;cmd.params_&amp;lt;/pre&amp;gt; mapping. The device template page has an edit button for each event that enables you to see the parameters associated with that event, including a description of its use.&lt;br /&gt;
In our example it shows that the parameter with index 30 is the current ambient temperature in degrees Celcius.&lt;br /&gt;
&lt;br /&gt;
After the &amp;lt;pre&amp;gt;cmd&amp;lt;/pre&amp;gt; object has been initialized it is send to the LinuxMCE system using the &amp;lt;pre&amp;gt;SendCommand&amp;lt;/pre&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
Note that the same piece of code can be used to send commands instead of events. The only changes are that the message type will be 1 (command) instead of 2 (event), and that the destination will probably differ from the event handler device -1001.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
This section contains some tips on troubleshooting your new driver.&lt;br /&gt;
&lt;br /&gt;
=== Viewing the logs ===&lt;br /&gt;
&lt;br /&gt;
The best way to test the new GSD device is to edit the file /etc/pluto.conf and comment out the LogLevels filter, so the logging is verbose.  You can do this by typing:&lt;br /&gt;
&lt;br /&gt;
vim /etc/pluto.conf&lt;br /&gt;
&lt;br /&gt;
Then move to the start of the line that starts with LogLevels, press &#039;i&#039; for Insert mode in vim, type a # character, then press [ESC]:wq&lt;br /&gt;
The # at the start of a line means it&#039;s commented out, or ignored.&lt;br /&gt;
&lt;br /&gt;
now do a reload router.  You can do this from the console with: /usr/pluto/bin/MessageSend dcerouter 0 -1000 7 1&lt;br /&gt;
&lt;br /&gt;
Then go to the log directory:&lt;br /&gt;
&lt;br /&gt;
cd /var/log/pluto&lt;br /&gt;
&lt;br /&gt;
ls&lt;br /&gt;
&lt;br /&gt;
ls will list the contents of the directory:  There will be a log file that starts with the device number of the gsd device.  To follow it type:&lt;br /&gt;
&lt;br /&gt;
tail -f [filename]&lt;br /&gt;
&lt;br /&gt;
rather than typing in the full filename, you can just type the first letters (ie the device number) and press tab, which does an auto complete.&lt;br /&gt;
&lt;br /&gt;
Now send commands to the device.  You can do this through the web site or the console.  For example, assuming your GSD device has the device id 57, you can send it an ON command (ON is command #192), you could type: /usr/pluto/bin/MessageSend dcerouter 0 57 1 192&lt;br /&gt;
&lt;br /&gt;
The log will show a bunch of data.  The lines that start with 40 and 41 are the serial data that is being sent to/from the device.  To filter the tail so it only shows the serial data, type:&lt;br /&gt;
&lt;br /&gt;
tail -f [filename] | grep &#039;^40\|^41&#039;&lt;br /&gt;
&lt;br /&gt;
=== Getting the device to start ===&lt;br /&gt;
If your device will not start (anymore) as described in section [[How to add your own GSD device#Adding the device]] there can be several causes.&lt;br /&gt;
&lt;br /&gt;
Check that your device is controlled by the core, as described in [[How to add your own GSD device#Create a device template]]. Otherwise the core assumes another device will start the driver.&lt;br /&gt;
&lt;br /&gt;
If your Ruby code contains an error, LinuxMCE may decide to disable the device. So, check that your device is not disabled: on Wizard--&amp;gt;Devices--&amp;gt;Generic Serial Devices click on &amp;quot;Advanced&amp;quot; for your device and make sure the Disabled box is NOT ticked. If it is, untick it, save, and do a quick reload of the router.&lt;br /&gt;
&lt;br /&gt;
Sometimes a quick reload of the router does not suffice. In that case you can run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/pluto/bin/Start_LocalDevices.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This should start your device. If not, the output of that script is a good place to look for further clues.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[GSD Ruby Interface]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[GSD - Ruby codes ]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[Generic Serial Device]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhorst</name></author>
	</entry>
</feed>