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

Calling a scene via API - method removed?


RiccardoCanetta

Question

Hi, I am trying to call a scene from a RaspberryPi using a Python script. Unfortunately I cannot use the format

http://user%40email.com:password@myHC2ip/api/sceneControl?action=start&id=11

as I get a "missing parameter". It seems that neither curl nor python's urllib3 pass the "&" correctly (I also tried replacing it with %26).

So I am trying to use the /api/scenes/11/actions/start format but in this case I get "501 Not Implemented"

 

Was the latter method removed from a certain version of HC2? I am on 4.140

 

Thanks
R

Edited by rcanetta
Wrong category.
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hello,

try to use these formats of calling a scene via API mentioned bellow, maybe that help.

Please login or register to see this code.

or

Please login or register to see this code.

or

Please login or register to see this code.

 

@ = %40  = @ (ASCII interpretation)

There is only difference in @ sign interpretation, so you could try every option and give me information if any of call mentioned above woks, can not test it right now by myself.

 

Port - Default port for HC2 is 80, if you do not change it. It should work also without port.

ID=1 - consider that you know what this stands for, but only for sure. Number 1 stands for ID of scene which you want to run via this call. You can find this ID in Advanced tab in particular scene or using REST API of Fibaro gateway

Please login or register to see this code.

 

Notice: But probably there is an issue with using @ sign in username, so the best solution would be create the new user with username not using email adress in Fibaro HC2. Do not forget assign the scenes and devices to new user of HC2. You can allow the new user to use all scenes or devices or just some of them. Then try again like this:

Please login or register to see this code.

Let me know if it helps, so we can help others 8-)

Edited by SmarterHOME
Link to comment
Share on other sites

  • 0
23 hours ago, rcanetta said:

So I am trying to use the /api/scenes/11/actions/start format but in this case I get "501 Not Implemented"

 

Was the latter method removed from a certain version of HC2? I am on 4.140

 

I haven't used that syntax for ages! I even forgot it existed, thank you for reminding me, but it might be gone indeed... ;-)

 

Does this help? Library "requests" handles all the encoding and escaping. Works on my mac, python 2 and 3

 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 5 hours ago, petergebruers said:

     

    I haven't used that syntax for ages! I even forgot it existed, thank you for reminding me, but it might be gone indeed... ;-)

     

    Does this help? Library "requests" handles all the encoding and escaping. Works on my mac, python 2 and 3

     

    Please login or register to see this code.

     

     

    Hi, happy that I made you feel younger! :-))

     

    Thanks a lot, this worked!!

     

    Have a great weekend

    Riccardo

    Link to comment
    Share on other sites

    • 0

    Hi,

     

    I can confirm there are some http-requests which works - and some that seems to have an issue.

     

    1. I've been trying to directly control a specific device using the method which can be "built" by page

    Please login or register to see this link.

    Recommendations - use Username (not email) and password and don't make any of these complicated.

    Of course this is a problem with security to have easy passwords, but, since you're not able to use HTTPS anyway you're still sending everything in plain text over a network connection so, you should NOT have these kind of triggers doing anything which you don't want other people to be able to activate - not even if you're on your own network. Security is relative - it's only as strong as your knowledge about protection allows and there is always going to be someone who's more clever than you and can circumvent your efforts.

    Normal characters "works". "Works" - is a relative meaning for me and this function, because strangely I can get one, perhaps two triggers of a device this way - if I am lucky. Then no more responses on them.

     

    2. Scenes - also from same webpage works better. I have an odd method of telling when to actually send the http-request to start a scene so I have a reliabillity issue because of that. However, sending this string through a reliable trigging method, always works. The best with this one is that if you need to add or change a device, you do that in the scene and don't have to fiddle with the http-strings as such.

     

    Good luck,

    DrPepper

     

    HC2 running 4.160 SW version

    Link to comment
    Share on other sites

    • 0

    Is it possible to pass arguments when starting a scene via HTTP API? I mean arguments in a manner similar to fibaro:args()?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 3/18/2018 at 11:25 PM, Ros said:

    Is it possible to pass arguments when starting a scene via HTTP API? I mean arguments in a manner similar to fibaro:args()?

     

    Hi, I have never seen anything like this. But, you can use a global variable and act in the scene based on the value of the GlobalVariable...

     

    Just my 2c

    R

    Link to comment
    Share on other sites

    • 0

     

    1 hour ago, rcanetta said:

    I have never seen anything like this

     

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