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

Hi all.

 

Wonder if anyone can help with this issue i have.

 

I have setup a plugin for WOL (Wake On Lan) so i can press a virtual button on my phone and it turns on a PC.

 

I now want to include this in to a scene so when i start the scene, the PC turns on with other devices. Ony wanted this since getting the amazon Echo service working with my setup. Idea is to walk in the room and say, Alexa, Turn on Cinema and all will just turn on and work.

 

Issue is, i can't add in the WOL plugin with a scene.

 

Has anyone managed to do this and if so, how?

 

Thanks,

 

Hal

Please login or register to see this attachment.

9 answers to this question

Recommended Posts

  • 0
Posted

If I look at your VD I see 1 button, so this should work from a scene:

 

fibaro:call(vdid, "pressButton", "1")

 

You have to change vdid to the id of the VD (can be found in the address bar of your browser)

  • 0
  • Inquirer
  • Posted

    SO managed to find the following scene but cant get it to run.

     

    --[[
    %% properties
    %% globals
    --]]

    -- convert MAC adress, every 2 Chars (7-bit ASCII), to one Byte Char (8-bits)
    function convertMacAddress(address)
    local s = string.gsub(address, ":", "");
    local x = ""; -- will contain converted MAC
    for i=1, 12, 2 do
    x = x .. string.char(tonumber(string.sub(s, i, i+1), 16));
    end
    return x;
    end

    fibaro:log("Start process");

    -- MAC adress
    local _macAddress = convertMacAddress("44:8A:5B:29:B3:9E");
    -- Create Magic Packet 6 x FF
    local _magicPacket = string.char(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
    -- Broadcast Address
    local _broadcastAddress = "255.255.255.255";
    -- Default port used
    local _wakeOnLanPort = 9;

    fibaro:sleep(750);

    for i = 1, 16 do
    _magicPacket = _magicPacket .. _macAddress;
    end

    fibaro:log("Magic packet successfully created");

    fibaro:sleep(1000);

    socket = Net.FUdpSocket();
    socket:setBroadcast(true);

    local bytes, errorCode = socket:write(_magicPacket, _broadcastAddress, _wakeOnLanPort);
    --check for error
    if errorCode == 0 then
    fibaro:log("Successfully sent");
    else
    fibaro:log("Transfer failed");
    end

    -- clean up memory
    socket = nil;

    fibaro:sleep(1000);
    fibaro:log("Please wait for the computer to startup.");

     

    All is get is the following debug error.

     

    [DEBUG] 00:01:02: line 16: attempt to call method 'log' (a nil value)

     

    Can anyone help.

     

    Thanks,

     

    Hal

    Please login or register to see this attachment.

    • 0
    Posted

    @Hallamnet do a search for the sonos plugin scene - I think you should be able to run the api commands to 'press' the button in the plugin for you, by utilising that work from before.

     

    I'm just stuck on getting WOL to work for my PC at this stage :)

     

     

    • 0
  • Inquirer
  • Posted

    Thanks for the quick reply.

     

    Unfortunately, this is not possible the way the plug-in works. There is no button number to use:-(

     

    All works fine with the plug-in but want to get it working with a scene and i can use the HA Bridge with alexa.

     

    Thanks very much though.

     

    Hal

    • 0
    Posted

    @hallamnet, no problem just an idea.  (i'm new to this so educated guessing :))

     

    I was thinking that by calling the api of the HC2 (rather than a fibaro:call), you can call/'press' the button on the main interface of the plugin?  (in the thread iv'e linked below)

     

    local http = net.HTTPClient() http:request("http://127.0.0.1:11111/api/plugins/callUIEvent?deviceID=" .. PluginID.. "&elementName=" .. event .. "_Button&eventType=onReleased", { options = { method ='GET' }, success = successCallback, error = errorCallback }) end

     

     

    • 0
    Guest lockton9334
    Posted

    fibaro:call(vdid, 'turnOn') works for me

    • 0
    Posted

    In HC3 you can add device: Other device -> Wake On Lan, which gets an id X.  In Wake On Lan you select the mac address of the PC you want to wake up. In a LUA scene you start it with fibaro:call(X, 'turnOn')

    • Like 1
    • 0
    Posted (edited)

    Sorry for reviving this old thread but I run into a bit of problems regarding this subject.

     

    I created a VD on my HC2 to see if my server is online. The main loop of the VD checks every 5 minutes to see if my server is still running. 

     

    Please login or register to see this code.

     

    This works beautifully. Now I want to create a button that if pressed it will try to wake to server via WOL. Unfortunately my server is in the 192.168.1.XX range and my HC2 is in the 192.168.2.XX range

     

    On my laptop I can use 

    Please login or register to see this code.

     

    Is there a way to put this in the script? I tried putting the broadcast IP to a different value but it does not work

    Please login or register to see this code.

     

    I also tried the plugin but this also just scans in the 192.168.2.XX range. Putting the MAC in there did not boot the server

    Edited by seabird
    added plugin info
    • 0
    Posted
    2 hours ago, seabird said:

    Sorry for reviving this old thread but I run into a bit of problems regarding this subject.

     

    I created a VD on my HC2 to see if my server is online. The main loop of the VD checks every 5 minutes to see if my server is still running. 

     

    Please login or register to see this code.

     

    This works beautifully. Now I want to create a button that if pressed it will try to wake to server via WOL. Unfortunately my server is in the 192.168.1.XX range and my HC2 is in the 192.168.2.XX range

     

    On my laptop I can use 

    Please login or register to see this code.

     

    Is there a way to put this in the script? I tried putting the broadcast IP to a different value but it does not work

    Please login or register to see this code.

     

    I also tried the plugin but this also just scans in the 192.168.2.XX range. Putting the MAC in there did not boot the server

    Ignore my ignorance. WOL does not work across different subnets. 

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