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

Posted

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

 

 

 

20 answers to this question

Recommended Posts

  • 0
Posted

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

  • 0
  • Inquirer
  • Posted

    Thanks I will try

     

    • 0
    Posted
    On 3/8/2020 at 1:37 PM, eric78 said:

    Thanks I will try

     

    did you find the correct api?

     

    • 0
    Posted

    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!

    • 0
    Posted
    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 ;)

    • 0
    Posted (edited)

    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
    • 0
    Posted
    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!

    • 0
    Posted
    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. 

    • 0
    Posted (edited)

    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
    • 0
    Posted (edited)

    Please login or register to see this code.

    Edited by MH8
    • 0
    Posted
    On 3/8/2020 at 2:20 PM, Krikroff said:

    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

    I tried to turn on and turn off a light with both swagger and with the curl commandline on my laptop but it takes 30 seconds before the light changes.

    Is this the way it works or can I speed up things somehow?

    • 0
    Posted

    30 seconds is not acceptable ;)

    • 0
    Posted
    1 hour ago, Krikroff said:

    30 seconds is not acceptable ;)

    We agree on that :P

    Any hints on where to start troubleshooting?

    I have only 4-6% CPU load and 39% free RAM

    • 0
    Posted

    Have you the problem when you turn on/off from HC UI or from mobile app ?

    • 0
    Posted
    1 hour ago, Krikroff said:

    Have you the problem when you turn on/off from HC UI or from mobile app ?

    No. Fast as a shark. Instant control

    • 0
    Posted
    42 minutes ago, storskogen said:

    No. Fast as a shark. Instant control

     

    ME STUPID! ?

    I didn´t look carefully on the code in swagger

    "delay": 30 ?

    With "delay": 0 there is no delay :P 

     

     

    • Like 1
    • 0
    Posted

    That’s my next question ? for sure it’s ok with 0 delay ?

    • 0
    Posted

    Hello

     

    Where can I find HC3 LITE API SWAGGER?

     

    Thanks,

    G.

    • 0
    Posted

    Do you mean a manual?

     

    Please login or register to see this link.

    • 0
    Posted

    Hi All

    I have used the above commands to operate scenes and devices via a URL call and all works OK - except

    Every time I issue a URL call via Edge Browser on Windows it opens a browser window with what appears to be Java code (not sure about that)

    {
        "endTimestampMillis": 1715211160212,
        "id": 0,
        "jsonrpc": "2.0",
        "result": {
            "result": 0
        },
        "startTimestampMillis": 1715211160203
    }

    This is annoying as this window has to be closed manually

    Is there a parameter that can be inserted on the api command line to close this window or a separate command to close that window 

    that the api command opened

    Regards Ro

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