Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Question

Posted

Hi,

 

I am using HC-2 to configure all my Home Automation system.

 

I have created Virtual device to control IR devices. As to show case Lable I need to code using Lua.

Can any one tell me what's wrong with following Lua code.

 

local hc = fibaro:getSelfId();
local ip = fibaro:getValue (hc, 'IPAddress');
local port = fibaro:getValue (hc,'TCPPort');
tcpSocket = Net.FTcpSocket (ip,port);

fibaro:debug(hc);
fibaro:debug(ip);
fibaro:debug(port);

tcpSocket:setReadTimeout(3000);
tcpSocket:write("sendir,1:1,1,36337,1,1,95,33,16,16,16,16,16,32,16,32,32,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32,16,16,32,16,16,16,4651\r");
tcpSocket:disconnect();
fibaro : call(hc, "setProperty", "ui.Label1.value","20°C");

 

 

For debugging purpose, I have used socket tester.  On it, some time I am able to receive string, some time not. Some time socket connection remain open.

Can any one help me.

Is there any possibility to have problem with router?

Please login or register to see this attachment.

2 answers to this question

Recommended Posts

  • 0
Posted

Hi @Ananta Creation,

 

Try this code which forks for me flawlessly:

Please login or register to see this code.

Also you have some kind of reporting so you know if problem is with tcpSocket or with command itself.

BTW what IR device are you using for control?

  • 0
  • Inquirer
  • Posted

    Hi @Sankotronic,

     

    Thanks. It's working for me also.

     

    Few clarification for above syntax,

     1. use of ".." before  "enter" in sendCommand

    Please login or register to see this code.

     

    2.

    Please login or register to see this code.

    3. can you let me know, what's wrong in my lua code. It is working fine with other two HC-2.

     

     

     

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...