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

Woonveilig JSON and VD intergration [ SOLVED ]


D-Vine

Question

Hello

 

Can somebody help me with a  JSON POST command ?

Simple Idea I need to press a VD button when there is a POST command made

 

-- 'mode': '0' = Disarm   should be like {'area': '1', 'mode': '0'}
-- 'mode': '1' = Full Arm schould be {'area': '1', 'mode': '1'}

 

I tried several thing but only get "  " to send in debug 

And when I change the code to send ' '   the scripts fails

 


SOLVED:

 

seems that the github forum reactions and phyton code where misleading.

with httpPost:post and other raw data was the trick

Edited by D-Vine
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hi!


here's how to do a POST from a VD:
 

Please login or register to see this code.

 

Does that work for you?

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 2 hours ago, doezel said:

    Hi!

    here's how to do a POST from a VD:
     

    Does that work for you?

     

     

    Thanks for your reply.

    Works I hope 

    accept the login I need to add user name and password...

    So after this I can test it

     

    How can I add it into this code?

    schould be like this if it's in one line

    Username:Password@192.168.178.134/action/panelCondPost

     

    Please login or register to see this code.

     

    Edited by D-Vine
    Link to comment
    Share on other sites

    • 0

    Hmmm, can't find how to add credentials quickly.

    But then I found this:

    this uses  Net.FHttp (for which you already now how to add credentials) and then describes to do a POST with a JSON string payload.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 19 hours ago, doezel said:

    Hmmm, can't find how to add credentials quickly.
    But then I found this:

    this uses  Net.FHttp (for which you already now how to add credentials) and then describes to do a POST with a JSON string payload.

     

    Tried it but in VD already at first line got error in lua.... 

    think your code is best but now need to figure out how to get user and password in it... 

     

    UPDATE:

    I just pust the userand password in front of the IP adress and the denied had gone...

    now can test the codes if they work

    Please login or register to see this code.

     

    This should be the payload

    Please login or register to see this code.

    When I run inspector got the area that is always 1

    mode 0 = Disarm

    mode 1 = Arm

     

    but no luck when sending got a TCP failed now

    Please login or register to see this code.

    Please login or register to see this code.

     

    Edited by D-Vine
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I edit the first post...

    Just need a simple POST command hope somebody can help me with this

    Link to comment
    Share on other sites

    • 0

    Why are you encoding the jsonstring?

    try this:

    Please login or register to see this code.

    and tcpstring wasn't empty, you can read it like this:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 12/24/2018 at 10:52 AM, doezel said:

    Why are you encoding the jsonstring?

    try this:

    Please login or register to see this code.

    and tcpstring wasn't empty, you can read it like this:

    Please login or register to see this code.

     

     

    solved with httpPost:POST command and area1&mode

     

    Edited by D-Vine
    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...