Skip to content

Commit

Permalink
WOL plugin #887
Browse files Browse the repository at this point in the history
  • Loading branch information
jokob-sk committed Dec 23, 2024
1 parent a4c3414 commit 8f8264c
Show file tree
Hide file tree
Showing 9 changed files with 698 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENV PATH="/opt/venv/bin:$PATH"
COPY . ${INSTALL_DIR}/


RUN pip install graphene flask netifaces tplink-omada-client pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython librouteros git+https://github.com/foreign-sub/aiofreepybox.git \
RUN pip install graphene flask netifaces tplink-omada-client wakeonlan pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython librouteros git+https://github.com/foreign-sub/aiofreepybox.git \
&& bash -c "find ${INSTALL_DIR} -type d -exec chmod 750 {} \;" \
&& bash -c "find ${INSTALL_DIR} -type f -exec chmod 640 {} \;" \
&& bash -c "find ${INSTALL_DIR} -type f \( -name '*.sh' -o -name '*.py' -o -name 'speedtest-cli' \) -exec chmod 750 {} \;"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN phpenmod -v 8.2 sqlite3
RUN apt-get install -y python3-venv
RUN python3 -m venv myenv

RUN /bin/bash -c "source myenv/bin/activate && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && pip3 install tplink-omada-client pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython librouteros "
RUN /bin/bash -c "source myenv/bin/activate && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && pip3 install tplink-omada-client wakeonlan pycryptodome requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet python-nmap dnspython librouteros "

# Create a buildtimestamp.txt to later check if a new version was released
RUN date +%s > ${INSTALL_DIR}/front/buildtimestamp.txt
Expand Down
2 changes: 1 addition & 1 deletion front/plugins/__template/rename_me.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_device_data(some_setting):
}
]

# Return the data to be detected by teh main application
# Return the data to be detected by the main application
return device_data

if __name__ == '__main__':
Expand Down
37 changes: 37 additions & 0 deletions front/plugins/wake_on_lan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Wake-on-LAN Plugin User Guide

## Overview
The Wake-on-LAN (WOL) plugin allows you to remotely wake devices on your network that support Wake-on-LAN functionality. This plugin sends a "magic packet" to the specified devices, which powers them on, provided they are configured to accept WOL requests.

## Configuration
All settings for the plugin can be configured via the user interface. The key settings include:

- **Broadcast IPs (`WOL_broadcast_ips`)**:
A list of IP addresses to use for broadcasting the WOL packet. Ensure these are valid network broadcast addresses for your environment.

- **Devices to Wake (`WOL_devices_to_wake`)**:
Defines the group of devices to be woken. You can choose from:
- `offline`: Wake devices that are currently offline.
- `down`: Wake devices that are in a "down" state.

- **Ports (`WOL_ports`)**:
A list of ports to use when sending the WOL packet. The default is usually port 9.

## Usage
1. Configure the settings through the UI.
2. The plugin will automatically detect devices based on the selected criteria (offline or down) and attempt to wake them by sending WOL magic packets.
3. The plugin logs the outcome of each attempt and processes results for monitoring and notifications.

## Logs
Logs for each run of the plugin are stored in the specified log path, where you can track:
- WOL packet sending attempts.
- Success or failure of waking devices.

## Notes
- Ensure the devices are configured to allow Wake-on-LAN in BIOS and the network adapter supports WOL when powered off.
- Make sure your network is configured to allow broadcast packets.

### Usage

- Head to **Settings** > **Plugin name** to adjust the default values.

Loading

0 comments on commit 8f8264c

Please sign in to comment.