Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#148 Wake on LAN via CLI #149

Closed
wants to merge 3 commits into from
Closed

Conversation

samba2
Copy link

@samba2 samba2 commented Feb 12, 2022

see issue #148 for details

@kbr
Copy link
Owner

kbr commented Feb 13, 2022

FritzHosts provides get_wakeonlan_status and set_wakeonlan_status methods for the "AutoWakeOnLAN" feature of the router. Currently I have no NAS for checking – but may be that already satisfies (at least partially) your use-case?

@samba2
Copy link
Author

samba2 commented Feb 13, 2022

No, for clarity I took a screen shot:
image

the API calls used in get_wakeonlan_status and set_wakeonlan_status are for the left hand checkbox which allows you (appropriate port forwarding + dyndns provided) to wake up an internal host via Wake on LAN (WOL) magic packet.
What the Fritzbox does: in the moment it receives a packet from the internet which is destined to the host, than the Fritzbox sends the WOL magic packet to the host to wake it up.

The code in this PR is about the righthand side. It simply is for "given I am in the local network I'd like to wakeup this host.
If the host to be woken up and the waking up host are in the same layer 2 network (so e.g. both on LAN or both on wifi) also third party programs to broadcast the magic packet could be used.
However, in my situation the host to be woken up (my NAS) is in the LAN and the waking up host is on wifi. Since the magic packet is not routed the only method to wake the NAS up is to use this "Computer starten" functionality of the Fritzbox which thankfully is exposed via the API.

Copy link
Owner

@kbr kbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. Due to missing hardware I'm unable to test the code but I have added some comments about the implementation. Also I suggest to rename the module to something like "fritzwakeonlan.py". This way it is obvious what the module is about (and does not sound and read like a miss-spelled "fritzwool" – whatever that may be ;).
Thanks for your contribution.

@samba2
Copy link
Author

samba2 commented May 5, 2024

@kbr sorry for the slight delay 🙂 I've worked on your feedback and also ran the code locally:

Successfully wakes up my diskstation:

fritzwol -i 192.168.178.1 -p *** diskstation

fritzconnection v1.9.1
FRITZ!Box 7530 at http://192.168.178.1
FRITZ!OS: 7.57

Waking up host 'diskstation'...
Done

Gives error when hostname is not known at Fritzbox:

fritzwol -i 192.168.178.1 -p *** foo

fritzconnection v1.9.1
FRITZ!Box 7530 at http://192.168.178.1
FRITZ!OS: 7.57

Waking up host 'foo'...
Host 'foo' is unknown at Fritzbox.

@samba2
Copy link
Author

samba2 commented May 5, 2024

If you feel like shaping the comments a bit more, please go ahead.

@deluxestyle
Copy link

I would be really interested in this. Is there any progress?

@kbr kbr closed this Jul 16, 2024
@kbr
Copy link
Owner

kbr commented Jul 16, 2024

See #195

@kbr kbr reopened this Jul 16, 2024
@kbr kbr closed this Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants