My first post here, and I'm a beginner with reference to the PLCBus communication protocol, so please bear with me.
I am attempting to roll a PLCBus controller using ruby (and thus the Ruby SerialPort gem), and I have had some success in being able to control my devices. Where I am having difficulties is with the responses I am getting from the units; I have a 1141+ controller, so I am expecting a 9-byte return packet, with the checksum at the end (as opposed to the 0x03 ETX on other firmwares).
In order to debug, I am running Interceptty on my /dev/ttyUSB0 device, which should be showing me all the packets returned to the serial port by the devices. I believe this to be working, as when I use my PLCBus 4043 UK (a hardware remote) to actuate my devices, I see a return packet as below (example shows unit with address A1 being turned on):
Code: Select all
> 0x02
> 0x06
> 0xa9
> 0x00
> 0x22 (")
> 0x64 (d)
> 0x00
> 0x0c
> 0xbd
What I get when I am using Ruby (or indeed the Perl script available in another thread on this forum) are some strangely formed packets, with varying numbers of bytes, and no clearly defined structure (examples below).
Example turning A1 ON with the Perl script (packet sent 02 05 a9 00 22 00 00 03):
Code: Select all
> 0x02
> 0x06
> 0xa9
> 0x00
> 0x22 (")
> 0x64 (d)
> 0x00
> 0x1c
> 0xad
> 0x02
> 0x06
> 0xa9
> 0x00
> 0x22 (")
> 0x64 (d)
> 0x00
> 0x20
> 0xa9
Code: Select all
> 0x06
> 0xa9
> 0x01
> 0x22 (")
> 0x64 (d)
> 0x1c
> 0x02
> 0xa9
> 0x01
> 0x64 (d)
> 0x20
Going by the fact that I can see correct frames when the hardware controller is used, I am led to think that there are two possible problems:
- The packet being sent is incorrect (though this seems unlikely as there are no reported issues with the Perl script)
- Writing to the serial port is being done in such a way that it is somehow blocking or garbling the returned packets
So my question is, has anyone else come across this? Can anyone suggest ways that I might be able to more thoroughly debug what is happening (I am unfamiliar with the 1141+ at a debugging level).
For reference, I am using a 1141+ from x10-hk.com, connected to a server running Ubuntu Oneiric Ocelot. I have tried actuating various different modules, including plug-in lamp modules and micro modules in 2-wire and 3-wire modes, to eliminate the possibility of faulty devices.
Many thanks for any assistance!