This repository provides a hacky integration to control the PoE (Power over Ethernet) ports of Netgear GS30XEPP series switches directly from Home Assistant.
It leverages a Python script to interact with the switch’s API and a set of Home Assistant configuration files to expose each port as a controllable entity.
- Netgear GS30XEPP PoE Control Hack for Home Assistant
- Control PoE per port on Netgear GS30XEPP switches.
- Python script handles login, CSRF protection, API calls, and logout.
- Home Assistant configuration integrates the script dynamically per port.
- State management is handled via
input_booleanentities to ensure reliability even if the script fails or Home Assistant restarts.
The login requires only the hashed password.
To obtain it:
- Open browser developer tools.
- Go to the Network tab and enable Preserve Log.
- Perform a login attempt and locate the
login.cgicall. - In the Payload, copy the value of the
passwordattribute.
This hash is used directly by the script.
The Python script follows a 4-step process:
- Performs login with a 35-second timeout.
- Implements retry logic because the web server may take time to wake up on the first call.
- Retrieves a hidden hash field required to prevent CSRF attacks.
- This token is mandatory for subsequent API modification calls.
- Sends an API call to enable or disable PoE on the target port.
- Logs out to release the session.
💡 The script includes a shebang (
#!/usr/bin/env python3) to simplify execution within Home Assistant.
Before using the script in Home Assistant, you need to:
- Copy the Python script (Netgear_GS30XEPP_POE_Control.py) into the same directory as your Home Assistant configuration, typically alongside configuration.yaml.
- Make the script executable by running the following command on your Home Assistant host:
chmod +x /config/Netgear_GS30XEPP_POE_Control.pyThe integration is designed to be dynamic per port. Several configuration files are used:
Defines the shell command to call the Python script with the required arguments:
netgear_poe: "bash -c '/config/Netgear_GS30XEPP_POE_Control.py {{ url }} {{ user }} {{ pass_hash }} {{ port }} {{ state }}'"Arguments :
url: Switch URLuser: Username (typically admin)pass_hash: Hashed passwordport: Target port numberstate: Desired state (on or off)
Defines the poe_control service that:
- Calls the Python script to enable/disable PoE.
- Updates the associated
input_booleanfor the target port.
poe_control:
description: "Control PoE dynamically"
fields:
port:
description: "Physical port number"
example: 1
state:
description: "PoE state (on/off)"
example: "on"
sequence:
- service: shell_command.netgear_poe
data:
url: !secret url_netgear_GS308EEP
user: "admin"
pass_hash: !secret hash_netgear_GS308EEP
port: "{{ port }}"
state: "{{ state }}"
- service: "input_boolean.turn_{{ state }}"
target:
entity_id: "input_boolean.gs308epp_poe_port{{ port }}_status"
mode: queuedThis ensures that the switch state is not updated if the script fails.
The script runs in mode: queued to buffer multiple activation/deactivation requests.
Defines one input_boolean per port.
Each port’s input_boolean acts as a state holder:
- If the script fails, the switch entity does not incorrectly update its state.
- On restart, Home Assistant restores the last known state from the
input_boolean.
script: !include scripts.yaml
template: !include template.yaml
shell_command: !include shell-command.yaml
#-----------------input boolean-----------------
input_boolean:
gs308epp_poe_port4_status:
name: POE status GS308EPP PORT 4
gs308epp_poe_port5_status:
name: POE status GS308EPP PORT 5
gs308epp_poe_port6_status:
name: POE status GS308EPP PORT 6
gs308epp_poe_port7_status:
name: POE status GS308EPP PORT 7
gs308epp_poe_port8_status:
name: POE status GS308EPP PORT 8Defines the switch entities for each port.
These switches call the poe_control service from scripts.yaml with the correct arguments.
- switch:
- name: "POE Switch GS308EPP PORT 4"
unique_id: gs308epp_poe_port4
state: "{{ is_state('input_boolean.gs308epp_poe_port4_status', 'on') }}"
turn_on:
- service: script.poe_control
data:
port: 4
state: "on"
turn_off:
- service: script.poe_control
data:
port: 4
state: "off"
icon: >
{% if is_state('input_boolean.gs308epp_poe_port4_status', 'on') %}
mdi:flash
{% else %}
mdi:flash-off
{% endif %}Stores sensitive credentials:
url_netgear_GS308EEP: "http://192.168.1.100"
hash_netgear_GS308EEP: "your_password_hash_here"User toggles switch in Home Assistant
│
▼
script.poe_control (port, state)
│
▼
shell_command.netgear_poe
│
▼
Python script:
- Login
- Get CSRF token
- Send PoE command
- Logout
│
▼
Netgear GS30XEPPBefore integrating the Python script into Home Assistant, it is recommended to test the Netgear GS30XEPP web API endpoints using an API client such as Bruno.
- Bruno allows you to send HTTP requests to the switch’s web interface and validate responses.
- You can reproduce the sequence of calls used in the script via the collection:
- Login request with the hashed password.
- Retrieval of the hidden CSRF token.
- API call to enable/disable PoE on a specific port.
- Logout request.
- This step ensures that your credentials, hash, and API parameters are correct before deploying the automation in Home Assistant.
- Using Bruno also makes it easier to debug issues if the firmware or API changes after an update.
- Provides a hacky but effective way to control PoE ports on Netgear GS30XEPP switches.
- Python script handles login, CSRF token retrieval, PoE API calls, and logout.
- Home Assistant integration ensures dynamic port control, buffered requests, and reliable state management via input_boolean.
- Designed to be modular and easily extended to all ports of the switch.
This project is provided as a proof‑of‑concept hack to control PoE ports on Netgear GS30XEPP switches.
Please note the following:
- The Python script can be adjusted or extended depending on the parameters you want to manage on each port (Enabling/Disabling Port Power, Power Limit (W), Detection Type...).
- Netgear may update the switch firmware and change the underlying API. In such cases, the script logic (login, CSRF token retrieval, API calls) may need to be adapted to remain functional.
- This project is provided as-is for personal and educational use. Use at your own risk. Respect your device’s terms of service.
If you appreciate this project, please don’t hesitate to ⭐ it and feel free to provide your feedback !