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 API


eric78
 Share

Question

Dear all

 

In the past, few days ago :=) with my HC2 I used these commands lines

 

Please login or register to see this link.

/api/callAction?deviceID=28&name=turnOn  and

http://ADMIN:[email protected]/api/sceneControl?id=10&action=start

 

The first one, to activate a device, is works fine with HC3, no problem

The second, to execute a scene doesn't work with the HC3

 

Please, could you give me the new command line for HC3 to execute a scene

 

Thanks in advance

 

 

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

As i said before ;) try with 

 

POST Method

/api/scenes/YOUR_SCENE_ID/execute

and in the body: {} if no arguments to pass

 

You can see the API using swagger from the HC3 interface

Link to comment
Share on other sites

  • 0

Tried that, the first part seems to work. When entering this in a browser, a page opens, asking for a login and password. After filling in the required part, nothing happens. Not sure if the password was correct or not :), just a white page. Scene did not execute.

 

Can you give a hint what input and what dividers are expected? Swagger was not clear on that ;)

 

Thanks!

Link to comment
Share on other sites

  • 0
On 3/15/2020 at 1:32 PM, morpheus75 said:

 

On 3/8/2020 at 2:37 PM, eric78 said:

Thanks I will try

 

did you find the correct api?

 

 

POST Method

/api/scenes/YOUR_SCENE_ID/execute

 

44 minutes ago, [email protected] said:

Tried that, the first part seems to work. When entering this in a browser, a page opens, asking for a login and password. After filling in the required part, nothing happens. Not sure if the password was correct or not :), just a white page. Scene did not execute.

 

Can you give a hint what input and what dividers are expected? Swagger was not clear on that ;)

 

Thanks!


Requires POST method, you do not do that directly in browser. Tub can achieve this directly with swagger or postman or others...

do not forget to pass the body ;)

Link to comment
Share on other sites

  • 0

How would I pass the body? 

I'm using HA Bridge.

Thanks

 

Sorted! - In HA BRidge you have to add the elements under the respective heading and i have got scenes to work.

Thanks

Edited by morpheus75
Updated
Link to comment
Share on other sites

  • 0
On 3/24/2020 at 9:55 PM, Krikroff said:

 

POST Method

/api/scenes/YOUR_SCENE_ID/execute

 


Requires POST method, you do not do that directly in browser. Tub can achieve this directly with swagger or postman or others...

do not forget to pass the body ;)

 

Thanks for your reply. With homecenter 2 it was as simple as just passing an URL (via POST) to execute a scene. Now in HC3 it doesn't wordt. How can i achieve something tat was simple at first, but seems hard now? A guide or steps would help a lot? I'm not a programmer or someone who is building websites all day and this way it is somehow a search and find game ;) . Apparently there are a lot of people who find this easy? Thanks!

Link to comment
Share on other sites

  • 0
On 3/8/2020 at 10:53 AM, eric78 said:

Dear all

 

In the past, few days ago :=) with my HC2 I used these commands lines

 

Please login or register to see this link.

/api/callAction?deviceID=28&name=turnOn  and

Please login or register to see this link.

 

The first one, to activate a device, is works fine with HC3, no problem

The second, to execute a scene doesn't work with the HC3

 

Please, could you give me the new command line for HC3 to execute a scene

 

Thanks in advance

 

Couldn't get it to work either. As a work around i created a quick app (binary switch or something else) that can be triggered from devices :). You can create a scene with the created quick app as trigger. Don't forget to switch your binary switch back to off, i didn't have the toggle option to choose from. I didn't test a normal switch yet, maybe that gives the toggle option so you don't have to switch the device off again. 

 

 

 

Couldn't get it to work either. As a work around i created a quick app (binary switch or something else) that can be triggered from devices :). You can create a scene with the created quick app as trigger. Don't forget to switch your binary switch back to off, i didn't have the toggle option to choose from. I didn't test a normal switch yet, maybe that gives the toggle option so you don't have to switch the device off again. 

Link to comment
Share on other sites

  • 0

Hours spent in troubleshooting and it was up to me only .... wrong device looking to a wrong IP :) 

But this worked for me to trigger the API:

 

 

    self.http:request("http://127.0.0.1/api/service/backups", {
        options = {
            data = json.encode(requestBody),
            method = "PUT",
        },
        success = function(response)
            self:debug(response.status)
            self:debug(response.data)
        end,
        error = function(message)
            self:debug("error:", message)
        end
    })
Edited by moltos
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.

 Share

×
×
  • Create New...