alexmohr / sonyapilib

Contains a python api to control sony devices.
MIT License
20 stars 11 forks source link

Send wakeonlan magic packet to broadcast instead of IP #24

Closed dilruacs closed 5 years ago

dilruacs commented 5 years ago

https://github.com/alexmohr/sonyapilib/blob/367490d53dbd8b4c20ea145f14600e3e3356ef71/sonyapilib/device.py#L132

Problem: if the device uses DHCP and the device was powered down long enough for the lease to expire, the WOL sequence won't work. Possible solutions:

alexmohr commented 5 years ago

If you wan't to solve that problem please use the v4 branch as base, otherwise I'll solve it myself :)

alexmohr commented 5 years ago

The wake on lan library supports this sort of already but using always 255.255.255.255 as broadcast

dilruacs commented 5 years ago

I can solve this problem later today, when I am in the same building as the device again :-)

The problem with using 255.255.255.255 is that it didn't work correctly on my multi-homed Home Assistant VM.

alexmohr commented 5 years ago

I can solve this problem later today, when I am in the same building as the device again :-)

The problem with using 255.255.255.255 is that it didn't work correctly on my multi-homed Home Assistant VM.

Maybe it would be better to implement the discovery of the broadcast address in the wakeonlan library.

dilruacs commented 5 years ago

I do not think we should make something overly complicated and build a detection. For example: the Home Assistant WOL component (https://www.home-assistant.io/components/wake_on_lan/) just sends to 255.255.255.255 as a default (works all the time, if just a single LAN adapter is available) and offers a configuration item for those that have special needs.

PR: https://github.com/alexmohr/sonyapilib/pull/25

alexmohr commented 5 years ago

Solved in #25