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

HC3 and parameters


Guest kallecux

Question

Guest kallecux

 

I despair - I try to change the parameters of a device via Lua but I get a 401 - access denied feedback.

Why? Does anyone have a tip for me. Thank you!

 

 

[DEBUG] 07.03.2020 16:34:05: onInit

[DEBUG] 07.03.2020 16:34:06: Error: 401 - Zugriff verweigert

 

This is my code:

Please login or register to see this spoiler.

 

Greetings

Karl Heinz

 

P.S: 

I tried different variants of the closing brackets because the template I found was inconclusive. But without success. "}]}}" respectively "}}]}"

Edited by kallecux
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
2 hours ago, kallecux said:

 

I despair - I try to change the parameters of a device via Lua but I get a 401 - access denied feedback.

Why? Does anyone have a tip for me. Thank you!

 

 

[DEBUG] 07.03.2020 16:34:05: onInit

[DEBUG] 07.03.2020 16:34:06: Error: 401 - Zugriff verweigert

 

This is my code:

Please login or register to see this spoiler.

With httpclient you need to authorize. Use api.put()

Link to comment
Share on other sites

  • 0
Guest kallecux
  • Inquirer
  • Hi @jgab thank you for the hint, if i go this way i get response 400.

     

    Please login or register to see this code.

    is the data structure wrong?

    Greetings!

    Link to comment
    Share on other sites

    • 0
    5 hours ago, kallecux said:

    Hi @jgab thank you for the hint, if i go this way i get response 400.

     

    Please login or register to see this code.

    is the data structure wrong?

    Greetings!

     

    Haven't tested this (isn't it risks to set parameter like this?) but this "more" correct. - need to send the data payload as second argument to api.put,

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
    Guest kallecux
  • Inquirer
  • @jgab Yes you are right it works - i think it is better to convert der parameter with json.encode - thank you very much!!

     

    I played with the swagger function - it is very helpful!

     

    You say:

     

    Quote

    (isn't it risks to set parameter like this?) 

     

    Which way would you say is the best way to set parameter? 

    Greetings!

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