Compare commits

..

2 Commits

Author SHA1 Message Date
Kenwood fd88f66541 Push bash script 2021-08-17 19:10:20 -04:00
Kenwood fe79a33c9c Make bash script 2021-08-17 19:09:51 -04:00
2 changed files with 14 additions and 6 deletions

View File

@ -74,14 +74,11 @@ media_player:
# Poe switch! # Poe switch!
switch: switch:
- platform: telnet - platform: command_line
switches: switches:
lab_camera_power: lab_camera_power:
resource: 10.85.3.96 command_on: bash /config/scripts/hpe_switch.sh 2 on
port: 22 command_off: bash /config/scripts/hpe_switch.sh 2 off
command_on: "\n5\nconfig\ninterface 2 power"
command_off: "no interface 2 power"
timeout: 2
group: !include groups.yaml group: !include groups.yaml

11
scripts/hpe_switch.sh Executable file
View File

@ -0,0 +1,11 @@
# Written by joe
# Usage:
# ./hpe_switch.sh <interface> <state>
if [ $2 = "on" ]; then
state=""
else
state="no"
fi
{ sleep 1; echo -e ""; sleep 1; echo -e "5"; sleep 1; echo -e "config"; sleep 1; echo -e "$state interface $1 power"; sleep 1; echo -e "write memory"; sleep 1; echo -e "exit"; sleep 1; echo -e "exit"; sleep 1; echo -e "y"; } | telnet 10.85.3.96