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


ShutDown Suspend Reboot


henri-allauch-13190

Recommended Posts

I can not stop the HC3 by a function in a QA.

shutdown and suspend gives me an error.

 

 

Please login or register to see this code.

 

 

 

 

Please login or register to see this link.

works correctly ->

Do you have an example?

where is my mistake?

I don't see the difference between shutdown and suspend.

thank you for information

Link to comment
Share on other sites

IMHO or more precisely AFAIR error function never got response. only text

 

Please login or register to see this code.

Link to comment
Share on other sites

  • Topic Author
  • Thank's

    Please login or register to see this code.

    [22.09.2021] [12:53:19] [ERROR] [QA_ACTIONS_227]: Error Commande Api
    [22.09.2021] [12:53:19] [ERROR] [QA_ACTIONS_227]: Erreur : End of file

     

    But we get the same message and the suspend is not ok

    Link to comment
    Share on other sites

    tbh. i do not know what 

    Please login or register to see this code.

    is.

     

    @tinmancan you publish this internal endpoint?

    Link to comment
    Share on other sites

    let me look deeper into the UI API, there is no suspend, however i see shutdown:

     

    Please login or register to see this image.

    /monthly_2021_09/image.png.618c4b48cf92bcd86449fe8b33d91745.png" />

     

    that function is System Controller function, so call like /api/service/shutdown, the lowest permission ist authenticated user, so we should be able to run it.

     

    so let's call it from QA

     

    image.png.fccff18942fe5bbbeeb1292347812d32.png

     

    nope, nothing, ok let's check if that shell command exists, maybe Fibaro forgot something:

     

    image.png.653b5006602ae3127bd15bf3b5a69cbe.png

    image.png.e449a9c2305bc6fdd802d7398ecac9c3.png

     

    yep, that works, my HC3 rebooted to recovery and i was able to shut it down, so must be something else.

     

     

    Let's try different way, i remember there was once API for this, and seems to be still there for scenes at least:

     

    image.png.9a76cccbf845c01563a5df9a95ef124b.png

     

    the call is 

     

    fibaro.homeCenter.systemService.reboot() 

    or

    fibaro.homeCenter.systemService.suspend()

     

    so let's try it from QA ...

     

    image.png.0cb522d2695a5c1e5545ba7b1228dc97.png

     

    nope, that is not working ... again API difference between QucikApps and Scenes, not tragic, but yeah.

     

    hmm let's try from scene, it is in scene API, so it should work

     

    image.png.e8860800fdde57bcf5cb1549ab78fea5.png

     

    image.png.6e41e0b06328e2394c3838915379add5.png

     

    no errors ... but HC3 still up, so shutdown is not working, so maybe the call behind suspend is not working?

     

    No, that works when i run it from shell, my HC3 got into suspend mode (and i was able to wake it up with power button)

    image.png.105eb6955ff71c8f47df9e04ba954474.png

     

     

    Let' try for reboot from scene:
     

    image.png.37eb96dd8364bc95125e478cb99da514.png

     

    image.png.b8307146537661ce205e5d6006892e3e.png

     

    So reboot works from scene, suspend not, but they are defined as such, so definitley bug somewhere.

     

    Anyway, as we can't use these calls in QA, let's go back to QuickApps and try something else, let's sent HTTP calls to localhost

     

    Please login or register to see this code.

     

     

    reboot -> works

    recovery -> works

    shutdown -> not really, HC3 LEDs started to blink from left to right but nothing else, HC3 still alive, so definitely double bug, have to reboot HC3 to get rid of the blinking LEDs.

    (actually not double bug, the LED performs as expected, see below why, there is permission for led animation, so it blinks)

     

    Let's test the same to real IP (because there is difference how the API works when calling localhost)

     

    reboot -> works

    recovery -> works
    shutdown -> same as with localhost, not working, LED's blinking again...

     

    We can't use proxy trick, because this is POST request, that not supported by proxy calls.

     

    Solution: afaik currently no soluton (except you add SwitchBot to push the power button hehe), this is why:

     

    @A.Socha or @m.roszak this is for you guys.

     

    As both, for scenes and QuickApps, the shell functions are there and working when i run them as root, must be something else.
    The HC3/HC3L/Yubii are protected, to prevent manpulations of file sytsem, or to be able to execute things, which Fibaro not allowed.
    And indeed, in the permission map, there is entry for "reboot" and "reboot to recovery", but nothing for "suspend" and/or "shutdown". 
    That's all, so it can't work, till Fibaro allows this in permission map.
    As suspend is allowed from power button, i don't see any reason to not allow it from API as well.

     

     

    Edited by tinman
    • Like 3
    • Thanks 3
    Link to comment
    Share on other sites

  • Topic Author
  • Thanks  @tinman  for your thorough testing. Your notoriety will allow support to take charge of this problem.

    The interest of the suspend or the shutdown is to put the HC3 in safety before the power cut detected by a back-up power supply

    • Thanks 1
    Link to comment
    Share on other sites

    On 9/22/2021 at 8:51 PM, henri-allauch-13190 said:

    Thanks  @tinman  for your thorough testing. Your notoriety will allow support to take charge of this problem.

    The interest of the suspend or the shutdown is to put the HC3 in safety before the power cut detected by a back-up power supply

    Definitely an interesting idea. The question of whether the HC's internal processes are set up correctly will perform this hibernation and be able to return to the previous state when power is restored. However, we have already seen a few cases where the connected devices on the UPS do not update the devices status and wait for the pooling time, ...and in some cases it is necessary to switch back and forth for the correct status.
    As I say, the idea is certainly interesting and correct, but I am concerned about the function of the whole.

     

    @m.roszak

    Possible question for Fibaro:
    Add official functions for connecting the device to the UPS (debug these hibernation processes, restoring device states, etc.)

     

    @tinman

    Tinman, thanks for the analysis.

     

    eM.

    Link to comment
    Share on other sites

    50 minutes ago, Martin_N said:

    Definitely an interesting idea. The question of whether the HC's internal processes are set up correctly will perform this hibernation and be able to return to the previous state when power is restored.

     

    that part is already implemented since day one, the HC3 can get into suspend with the power button

     

    Please login or register to see this image.

    /monthly_2021_09/image.png.0d50f03336d53ca09025c8f0652f3dd3.png" />

     

    and of course after wakeup, all services will get properly retarted/restored.

     

    50 minutes ago, Martin_N said:

    Add official functions for connecting the device to the UPS (debug these hibernation processes, restoring device states, etc.)

     

    to add specific tool, like

    Please login or register to see this link.

    or

    Please login or register to see this link.

    does not make sense, they are not generic enough. I would prefer to not have any additional binaries running on my HC3, which i can't control properly (remember, we are users only).

     

    For me using apc ups, with nmc, is easy to check apc state with a QuickApp, and when to power drops to specific level, to write e.g. scene variable (if one really need extra initialization for own things, scene with se-start trigger and check for that specific scene variable) with status "ups suspend", and do suspend (once is working).
    For sure it's not cheap, cheaper would be to use raspi or so, to check and sent pwr state to HC3.

     

    As i said above, the suspend button is working, for me would be enough to have that suspend API working again.

     

     

    • Thanks 1
    Link to comment
    Share on other sites

    Giving an access to the suspend mode using API is relatively easy to do.
    Waking the HC3 up is a different subject and won't be that easy. 

    Is allowing to suspend via API will be enough?

    Link to comment
    Share on other sites

    1 hour ago, m.roszak said:

    Waking the HC3 up is a different subject and won't be that easy.

    Does HC3 has HW on board to support WoL?

    Link to comment
    Share on other sites

    Using WoL is certainly an interesting idea.
    For example, I use the WoL application on a smartphone to turn on the NAS.
    However, the automatic start of HC3 will mean the use of another external device to start (some RPi, ESP, .., smart phone app, ..).
    Example for WoL with ESP solution for about 4-5USD.

    Please login or register to see this link.


    And on that topic.
    In the event of a power failure, the UPS keeps the HC3 turned on, "something" after a while instructs the suspend mode for the HC3.

    We have two scenarios when using a UPS after executing the SUSPEND command for HC3:
    1) The UPS will turn off the power to the HC3 after the specified time (or after discharging the batteries). When power is restored, the UPS will start automatically and the restored power supply will wake up the HC3

    2) In a short time (before the batteries run down), the power supply to the UPS input will be restored without first shutting down the HC3. However, the HC3 will remain in SUSPEND mode because it has nothing to wake it up and there has been no complete power failure.
    This solution will require some external element to perform any of the following actions:
    a) power on / off for HC3 behind the UPS.
    b) by sending a WoL command
    c) activation of hw input on HC3 (only in the next generation of devices)


    Ideally, therefore, the HW input would be on HC3, which would cause the device to start (or wake up). Then the HC3 power supply behind the UPS would not have to be drastically turned on / off, but only a start instruction would come.

    Link to comment
    Share on other sites

    • 9 months later...

    I have been testing the shutdown and suspend calls today and it's still not working for me.

    Reboot does work though.

    I am doing a remote curl call from my server that manages my UPS.

    Is there some news about this ?

     

    • Like 1
    Link to comment
    Share on other sites

    • 3 months later...
    On 7/17/2022 at 12:26 PM, diedvdyk said:

    I have been testing the shutdown and suspend calls today and it's still not working for me.

    Reboot does work though.

    I am doing a remote curl call from my server that manages my UPS.

    Is there some news about this ?

     

     

    Same for me, reboot works but shutdown and suspend don't seem to be doing anything.
    I'd also like to gracefully shutdown the HC3 on power failure.

    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
    Reply to this topic...

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