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


  • 0

Websockets from virtual device/lua


Question

Hi all,

I want to send commands to my Rotel amplifier from my HC2, using lua in a virtual device. The service I want to connect to is a websockets service on an RPi2 connected to the Rotel over USB. It's the json-serial-port-server by John Lauer,

Please login or register to see this link.

. I did find connections using tcpsockets in lua, but tcpsockets and websockets are different things. All other

Please login or register to see this link.

connections don't work. If I get something like a connection from lua, an additional window opens on top of my browser connection to my HC2. This is not useful. Anyone any idea how to use websockets from lua?

Thanks in advance,

Evert

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

If you want examples how to use tcp connections check my signature for the examples Glabol Caché iTach Wifi2IR Checker and UPS info through NUTS.

 

In short:

1 - Make a VD with the IP and port settings of your target device entered

2 - Write the lua code (for experimenting use a button and not the mainloop)

 

To initialise the TCP-port:

Please login or register to see this code.

Writing (send) command:

Please login or register to see this code.

If you need an <ENTER> command at the end for acknowledge sending:

Please login or register to see this code.

Read (receive) command:

Please login or register to see this code.

Close socket:

Please login or register to see this code.

Check response:

Please login or register to see this code.

Hope this helped. Success!

Link to post
Share on other sites

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...