LinuxMCE Forums

General => Developers => Topic started by: edbroni on March 18, 2011, 03:44:45 am

Title: Help in Ruby and GSD
Post by: edbroni on March 18, 2011, 03:44:45 am
Hi,

   I´m new in the forum. I´m also new in LinuxMCE, I installed the system two month ago. I read many posts but not found a answer to my question.
   I´m trying to build a home automation using a PLC with a ethernet interface. At this moment the house ligth are working fine with the PLC. I want to integrate the PLC to LinuxMCE.
   There are hexadecimal codes capable of create a connection between PLC and a PC. Now I´m trying to create that connection.
   I´m having trouble establishing that connection.
   Could anyone help me? Should the PLC be a server or client (I think a Server)? How do I open a connection and send/receive information?

Thanks in advance,

Edgar
Title: Re: Help in Ruby and GSD
Post by: JoakimL on March 18, 2011, 08:42:38 am
I think you need to provide some more information for anybody to help you.
- What device?
- What protocol does it use?
- Do you have any examples?
- And so on

/Joakim
Title: Re: Help in Ruby and GSD
Post by: edbroni on March 18, 2011, 01:41:44 pm
0JoakimL,

   - I use the FBS 24MA PLC from Fatek.
   - The protocol communication can be Fatek protocol or ModBus. (link:www.esea.cz/support/fatek/FBs_Manual/Manual_2/Appendix2.pdf)
   - A example of a command in Fatek protocol - in attached file. (The command is a hexadecimal code).
   
   My PLC are in the IP 192.168.1.3 (like server). I used this script in Ruby to connect at the PLC:

 require 'socket' 
 streamSock = TCPSocket.new( "192.168.1.3", 500 ) 
 str = streamSock.recv( 100 ) 
 print str 
 streamSock.close
   
   The port 500 is configured in PLC. When I run this script nothing happens.
   Anyone have an idea?

Thanks,

Edgar