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

[Solved] Restarting HC2 from API


Go to solution Solved by FSE,

Question

Greetings!

I dig a lot inside forum to find a way to reboot HC2 but what I found was scripts that did not work as they use obsolete functions of API.

Is there any person that has this kind of vd/scene available and like to share with community?

 

Edited by FSE
Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Solved!!! 

    it reboots system! Tested and working!

     

    Please login or register to see this code.

    Link to post
    Share on other sites
    • 1

    I asked the software team about this. Maybe it will help ;)

     

    Bash

    Please login or register to see this code.

    PHP

    Please login or register to see this code.

    Python

    Please login or register to see this code.

     

     

     

    Link to post
    Share on other sites
    • 0

    Create a scene and paste down the scrip below:

    HomeCenter.SystemService.reboot();

    If you want to make it automatic, I just created another scene which runs this scene once a week.

     

    Link to post
    Share on other sites
    • 0
  • Inquirer
  • I will. I still missing if there is a url that call from another device and perform the reboot in case that fibaro has partial crashed

    Link to post
    Share on other sites
    • 0
    local _f = fibaro;
    local current = os.date("%H:%M", os.time()); -- finding the time
    local day = os.date("%A", os.time());        -- finding the weekday
     
    if (current == "08:30") and (day == "Sunday") then
        _f:debug("grey", "----------------------------------------");
        _f:debug("red", "Rebooting Homecenter2 in 1 minute");
        _f:debug("grey", "----------------------------------------");
        _f:sleep(60*1000);
        HomeCenter.SystemService.reboot();
    end
     
    Link to post
    Share on other sites
    • 0
  • Inquirer
  • thank you all!

    I wonder if there is a way to restart from another system like the script on this post. it is a bash script that can run on a raspberry and monitor the status of HC2. if it identifies that system crashed will call a url and also send an email.

    the url 

    Please login or register to see this code.

    on this script that reboots HC2 are obsolete. does anybody have a newer API url for reboot?

    @T.Konopka any help sir would be great.

     

     

    Link to post
    Share on other sites
    • 0
  • Inquirer
  • I checked curl command today. seems somethings is missing. 

     

    Quote

    # curl --request POST --url http://192.168.10.50/api/service/reboot --header 'Authorization: Basic YWRtaW46YWRtaW4='
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     <head>
      <title>411 - Length Required</title>
     </head>
     <body>
      <h1>411 - Length Required</h1>
     </body>
    </html> 

     

    Link to post
    Share on other sites
    • 0

    FSE: you are missing the following --header "Content-Length:0"

    the following works for me
     

    Quote

    curl --request POST --url http://10.10.10.52/api/service/reboot --header "Authorization: Basic YWRtaW46YWRtaW4=" --header "Content-Length:0"

     

    Link to post
    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...