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

Question: how to write RAW data to tcp socket with QA LUA


Joep

Question

Hello, I found a project who reverse engineered the Wi-Fi protocol from the Mertik controller connected to my fireplace. Yeay! ?

 

With the following (simplified) NodeJS code I can send the standby command to my fireplace:
 

Please login or register to see this code.

 

I know how to open a socket in HC3 QA but I don't get how to convert the message to a RAW buffer.
The JavaScript line does it with Buffer.from(prefix + msg, 'hex');
 

Does some LUA god know how to convert the message in QA LUA for the HC3? 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
13 hours ago, Joep said:

Hello, I found a project who reverse engineered the Wi-Fi protocol from the Mertik controller connected to my fireplace. Yeay! ?

 

With the following (simplified) NodeJS code I can send the standby command to my fireplace:
 

Please login or register to see this code.

 

I know how to open a socket in HC3 QA but I don't get how to convert the message to a RAW buffer.
The JavaScript line does it with Buffer.from(prefix + msg, 'hex');
 

Does some LUA god know how to convert the message in QA LUA for the HC3? 

5 bucks! :D 

 

ocal hostname = "192.168.1.1"

    local port = 2000

 

    local tcpSocket = Net.FTcpSocket(hostname, port)

    wr, err = tcpSocket:write(
      string.char(0x21, 0x89, 0x01, 0x50, 0x57, 0x31, 0x0A)
    );

 

Please login or register to see this code.

 

Edited by 10der
  • Like 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thank you very much! (gives 5 bucks) :)

     

    But the msg is variable, I have to input different values for different settings.

    The problem is how to convert it in LUA to your local buf = representation.

     

    Link to comment
    Share on other sites

    • 0

    Like this?

    Please login or register to see this code.

    Edited by jgab
    • Like 1
    • Thanks 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @10der and @jgab thank you very much for your help! This works! Now I can create a QA for my fireplace.

     

    I also got this tip this morning which works also:
     

    Please login or register to see this code.


    @10der: where are you on Discord? :)
     

    Link to comment
    Share on other sites

    • 0
    25 minutes ago, Joep said:

    Discord

    well, I take offense :D 

    (joke, I am was busy with doing my current fintech project)

    Link to comment
    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...