Jump to content
  • 0

Wake On Lan in Scene


Go to solution Solved by boerremk,

Question

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

WOL.GIF

Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

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)

Link to post
Share on other sites
  • 0

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

wol.PNG

Link to post
Share on other sites
  • 0

@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 :)

 

 

Link to post
Share on other sites
  • 0

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

Link to post
Share on other sites
  • 0

@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

 

 

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