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

Turning off/sleep the Computer


pjjarzembowski
 Share

Question

Hello,

I am trying to turn off (sleep, hibernate) the computer in my lan network. Is there an easy way to do that from Fibaro? Turning it on, is very simple with WoL, but turning off by software is very difficult for me.

I know that this can be done by Fibaro wall plug, but I would like to do it by software rather than hard reset. I have Fibaro Home Center Lite but if there, is no possibility with HCL so maybe someone has a working lua code for that (I will buy a HC2 very soon so this would not be a problem for me). Thanks in advance for Help!!

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 0

@pjjarzembowski Directly triggered by HC2 should not be possible.  I also want to have a better solution.

 

Right now my solution to turn off PC is like this.

 

1) VM that contains an apache+php server ( build up apache+php on the target machine should work too)

2) IFTTT applet to call the php script on above VM (both if and then use webhook)

3) HC2 scene to trigger IFTTT webhook applet (imagine as an IFTTT middleware sit between HC2 and IFTTT site)

4) Another HC2 to trigger PC turn off (parse parameter to IFTTT middleware)

 

workflow:

1) When I am away, the scene sends a parameter to IFTTT midware

2) IFTTT midware sends the parameter to my IFTTT webhook applet setup on iftttt.com.  The applet picks the parameter and calls the php script (http://webserver/shutdown.php, post, plain text)

3) When the webserver received the IFTTT webhook call, it execute shutdown.php which looks below.

Please login or register to see this code.

 

You can search the forum to find the IFTTT midware scene. The away scene that parse data to IFTTT midware looks below.
 
if ( I am Away) then  
fibaro:startScene(iftttEngine ,{'turn_off_pc', 'Value1', 'Value2', 'Value3'})
end
 
I see you have WOL plugin, somehow net -h (hibernate) does not work, -f is shutdown, might need some linux guru for help this part later on.
 
If you feel this is doable at your end, you may want to deal with security issue as well. Webhook sends plain text.
 
I also believe that lua scene can directly call a php script to run so that no need to use IFTTT. Unfortunately I am not a programmer at all :( Hope this gives you some insight.
 
Edited by Sirhideo
Link to comment
Share on other sites

  • 0

did u see?

 

Please login or register to see this image.

 

Description
WakeOnLan – plugin enables the device to be turned on from another location over a network connection or Internet using Fibaro interface. Just find their IP and MAC addresses and use remote access to switch them on from anywhere in the world.

 

Link to comment
Share on other sites

  • 0
7 hours ago, Sirhideo said:

@pjjarzembowski Directly triggered by HC2 should not be possible.  I also want to have a better solution.

 

Right now my solution to turn off PC is like this.

 

1) VM that contains an apache+php server ( build up apache+php on the target machine should work too)

2) IFTTT applet to call the php script on above VM (both if and then use webhook)

3) HC2 scene to trigger IFTTT webhook applet (imagine as an IFTTT middleware sit between HC2 and IFTTT site)

4) Another HC2 to trigger PC turn off (parse parameter to IFTTT middleware)

 

workflow:

1) When I am away, the scene sends a parameter to IFTTT midware

2) IFTTT midware sends the parameter to my IFTTT webhook applet setup on iftttt.com.  The applet picks the parameter and calls the php script (http://webserver/shutdown.php, post, plain text)

3) When the webserver received the IFTTT webhook call, it execute shutdown.php which looks below.

Please login or register to see this code.

 

You can search the forum to find the IFTTT midware scene. The away scene that parse data to IFTTT midware looks below.
 
if ( I am Away) then  
fibaro:startScene(iftttEngine ,{'turn_off_pc', 'Value1', 'Value2', 'Value3'})
end
 
I see you have WOL plugin, somehow net -h (hibernate) does not work, -f is shutdown, might need some linux guru for help this part later on.
 
If you feel this is doable at your end, you may want to deal with security issue as well. Webhook sends plain text.
 
I also believe that lua scene can directly call a php script to run so that no need to use IFTTT. Unfortunately I am not a programmer at all :( Hope this gives you some insight.
 

 wow this seems more complicated than it needs to be.

 

On my windows laptop I'm using eventghost for intercepting notifications and creating events such as shut down, restart , starting an app etc.

to receive notifications from hc2 to my laptop I use autoRemote chrome extension.

 

Also with eventghost I intercept the shut down request and delay it a couple of secs just to send a notification to my hc2 that the laptop is shutting down.

If you need a detailed 101, just DM me.

Link to comment
Share on other sites

  • 0

@Sirhideo & @pjjarzembowski, I think it's better to leave my solution here, maybe it can be improved.

So basically I have a VD that controls the status of my laptop. (on / off) 

Please login or register to see this image.

/monthly_2018_05/5aed40565ea4b_VDexample.PNG.8c6d4eced35bb8d749cec4e80ab094ed.PNG" />

 

  1. First of all take a look at 

    Please login or register to see this link.

    .
  2. Create 3 new macros:
    1.  for turning off the computer / hibernate
    2.  for OnShutdown event to intercept the shutdown event from windows and send a notification to hc2
    3.  for OnStartup event to intercept the startup event from windows and send a notification to hc2

                  5aed40f9237b0_eventghostmacros.PNG.7737afe45a853a3f3e9fe0173f4d4ec7.PNG

                   

         3. The python scripts are very basic, they are just a http get on a hc2 scene that sets a variable of the status

                 5aed41ff86b40_pythonscript.PNG.c959fb8c6a5f61cf521e06dc1a7a9990.PNG

 

          4. This is the scene that is being called (I know it's messy code and must be improved) 

                 status.PNG.80533db9daba1ea71ac6bb00718a6256.PNG

 

           5. In the VD I have the following calls: 

                                1. Turn on laptop which calls the wake on lan device

                                2. Calls another scene that sends the message to my laptop to shut down. 

Please login or register to see this code.

  

  @pjjarzembowski, unfortunately you need lua to http get autoremote message system.

 

 Hope this helps

 

Edited by grimy112
Link to comment
Share on other sites

  • 0
  • Inquirer
  • I had some time tonight at work, and I was trying to make it work without fibaro or other controllers, just from the phone with android. So I can tell that it works well with phone. But then I was thinking how to integrate this with Fibaro. Unfortuntely I will be at work (at see) for aother 2 weeks so what I am going to write is only theoretical because I left my controller at home. I think it is possible to do it from Home Center Lite, and this is how it could be done:

     

    1) Instal EventGhost

    2) Install Plugin autoremote on EventGhost

    3) Install Plugin Webserver  on EventGhost

     

    4) When I Integrated my Rpi2 (domoticz) with Fibaro I use json protocol for device changing. It looks like this:

     

    http://192.168.208.1:8080/json.htm?type=command&param=udevice&idx=63&nvalue=27&svalue=77

     

    It does not matter what it is doing, but when I put it into web browser it is appering on events in EventGhost. It can be use as a trigger for action, in my case Lock PC.

     

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

     

     

    Ofcourst this type of protocol can not be use in Fibaro in that style. It must be somehow changed.

     

    5) It should look like this:

     

    Please login or register to see this attachment.

     

    I have taken the photo from the internet so the IP address  in our case should be 192.168.208.1

     

     

    And that should look the inside of our  Virtual button. In our case it should be

    GET    /json.htm?type=command&param=udevice&idx=63&nvalue=27&svalue=77 HTTP/1.10x0D0x0A0x0D0x0A

     

    Please login or register to see this image.

    /monthly_2018_05/image.png.bd82eeb0613e354f4ed7ce238bbed58c.png" />

     

     

    7) I do not know if that would work, but I think it will.  If someone has an access to Fibaro controller and have time to check it I will be very grateful.

     

     

     

     

     

     

    Please login or register to see this attachment.

    Edited by pjjarzembowski
    Link to comment
    Share on other sites

    • 0
    On 5/4/2018 at 7:28 PM, Sirhideo said:
    6 hours ago, pjjarzembowski said:

    I had some time tonight at work, and I was trying to make it work without fibaro or other controllers, just from the phone with android. So I can tell that it works well with phone. But then I was thinking how to integrate this with Fibaro. Unfortuntely I will be at work (at see) for aother 2 weeks so what I am going to write is only theoretical because I left my controller at home. I think it is possible to do it from Home Center Lite, and this is how it could be done:

     

    1) Instal EventGhost

    2) Install Plugin autoremote on EventGhost

    3) Install Plugin Webserver  on EventGhost

     

    4) When I Integrated my Rpi2 (domoticz) with Fibaro I use json protocol for device changing. It looks like this:

     

    http://192.168.208.1:8080/json.htm?type=command&param=udevice&idx=63&nvalue=27&svalue=77

     

    It does not matter what it is doing, but when I put it into web browser it is appering on events in EventGhost. It can be use as a trigger for action, in my case Lock PC.

     

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

     

     

    Ofcourst this type of protocol can not be use in Fibaro in that style. It must be somehow changed.

     

    5) It should look like this:

     

    Please login or register to see this attachment.

     

    I have taken the photo from the internet so the IP address  in our case should be 192.168.208.1

     

     

    And that should look the inside of our  Virtual button. In our case it should be

    GET    /json.htm?type=command&param=udevice&idx=63&nvalue=27&svalue=77 HTTP/1.10x0D0x0A0x0D0x0A

     

    Please login or register to see this link.

     

     

    7) I do not know if that would work, but I think it will.  If someone has an access to Fibaro controller and have time to check it I will be very grateful.

     

     

     

     

     

     

    Please login or register to see this attachment.

    If you have eventghost and autoremote running you shouldn't need the webserver plugin. You cand just send a notification through autoremote to the pc. 

    Go to autoremote options to get your browser key and you can paste the get from my post in your VD

    Link to comment
    Share on other sites

    • 0

    Hi @grimy112 I can get your solution to work.  Is there a way not to use Autoremote Chrome extension to pickup message from HC2 and redirect to Eventghost?  Chrome seems need to be opened all the time and shutdown/hibernate macro cannot set Forced.

     

    is EventGhost Autoremote plugin able to receive message?

     

     

    Edited by Sirhideo
    Link to comment
    Share on other sites

    • 0

    After reading Tips on AutoRemote site, it doesn't even need a key and send through a personal URL

     

    Please login or register to see this image.

    /monthly_2018_05/Untitled.jpg.c223b0662c08084580e7bc9e75795718.jpg" alt="Untitled.jpg.c223b0662c08084580e7bc9e75795718.jpg" />

     

    and now eventghost picks message from hc2 directly.

    Link to comment
    Share on other sites

    • 0
    2 minutes ago, Sirhideo said:

    After reading Tips on AutoRemote site, it doesn't even need a key and send through a personal URL

     

    Please login or register to see this link.

     

    and now eventghost picks message from hc2 directly.

    nice

    Link to comment
    Share on other sites

    • 0

    Since it can be done through http, now we can use VD button to directly trigger EventGhost macro.  Here is an example (basic code to make it work) of Hibernate button.


     

    Please login or register to see this code.

     

    and for VD configuration you need to enter your target PC IP and Port (eventghost port default 1818) on General Tab.

    Edited by Sirhideo
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I can now tell that this method wroks for Home Center lite:

    192.168.1.16 my laptop

    8080 port TCP

     

    Code:

    GET http://192.168.208.1:8080/?shutdown HTTP/1.10x0D0x0A0x0D0x0A

     

    In my case this http request is starting a Winamp and Totalcmd in my computer. It can start anything else just pick it from eventghost (start a program, shutdown computer, lock computer, hibernate, log off, Python Scrypt, Webserver ...) :)

     

    Ps. I have shutdown Autoremote with Chrome and it also works :)

    In order this to run you have to had installed webserver plugin for eventghost. I have instal it with port 8080

     

    image.png.61c3e307f93c5bdc2d6635aa5506d3dc.png

     

    image.png.cc25c12607a55b7543ecf02a25cd1d4f.png

     

    Please login or register to see this attachment.

    Edited by pjjarzembowski
    Link to comment
    Share on other sites

    • 0

    Hi

     

    I read a few solutions here to shutdown a OC from HC2.... can anyone to show a clear simple solutions?

    Link to comment
    Share on other sites

    • 0

    Hi all

     

    in the meen time I find it  . Thanks 

    Please login or register to see this link.

     

    Please login or register to see this link.

    Link to comment
    Share on other sites

    • 0

    hi,

     

    can you share/show how to turn off computer from FIBARO (I am using HC2)

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