https://github.com/mannkind/qnap-qsw
A quick and dirty script to take action on a QNAP QSW-M2116P-2T2S.
https://github.com/mannkind/qnap-qsw
Last synced: 11 months ago
JSON representation
A quick and dirty script to take action on a QNAP QSW-M2116P-2T2S.
- Host: GitHub
- URL: https://github.com/mannkind/qnap-qsw
- Owner: mannkind
- Created: 2024-01-02T03:15:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-07T05:41:35.000Z (over 2 years ago)
- Last Synced: 2024-06-21T19:53:59.175Z (about 2 years ago)
- Language: Go
- Size: 26.4 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# qnap-qsw
A quick and dirty script to take action on a QNAP QSW-M2116P-2T2S.
## Commands
### Login
```
./qnap-qsw login --host switch.lan --password BLAH
```
### Disable/Enable POE Ports
```
./qnap-qsw poeMode --host switch.lan --password BLAH --disable-ports 1,2,3,4
./qnap-qsw poeMode --host switch.lan --password BLAH --disable-ports 1,2 --poeplus-ports 3,4 --poeplusplus-ports 19,20
```
### Home Assistant
#### shell_commands.yaml
```
qnap_qsw_poe: "/config/qnap-qsw poeMode --host {{ host }} --password {{ password }} --disable-ports '{{ disable_ports }}' --poe-ports '{{ poe_ports }}' --poeplus-ports '{{ poeplus_ports }}' --poeplusplus-ports '{{ poeplusplus_ports }}'"
```
#### automations.yaml
```
- alias: "Turn off non-essential POE ports during power outage"
description: ""
trigger:
- type: turned_off
platform: device
device_id:
entity_id: binary_sensor.ups_online_status
domain: binary_sensor
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- service: shell_command.qnap_qsw_poe
data:
host: switch.lan
password:
disable_ports: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,19,20
mode: single
- alias: "Turn on non-essential POE ports after power outage"
description: ""
trigger:
- type: turned_on
platform: device
device_id:
entity_id: binary_sensor.ups_online_status
domain: binary_sensor
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- service: shell_command.qnap_qsw_poe
data:
host: switch.lan
password:
poeplus_ports: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,16
poeplusplus_ports: 19,20
mode: single
```