Some smart-plugs
This commit is contained in:
parent
1b4ca5594e
commit
3231a11db0
|
@ -29,6 +29,10 @@ in
|
|||
src = ./scripts/workman-toggle;
|
||||
inherit bash;
|
||||
});
|
||||
bulb-toggle = (writeSubbedBin {
|
||||
name = "bulb-toggle";
|
||||
src = ./scripts/bulb-toggle;
|
||||
});
|
||||
innovpn-toggle = (writeSubbedBin {
|
||||
name = "innovpn-toggle";
|
||||
src = ./scripts/innovpn-toggle;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from sys import argv
|
||||
from PyP100 import PyP100
|
||||
|
||||
p100 = PyP100.P100(argv[1], argv[2], argv[3])
|
||||
|
||||
p100.handshake()
|
||||
p100.login()
|
||||
|
||||
if p100.getDeviceInfo()['result']['device_on']:
|
||||
p100.turnOff()
|
||||
else:
|
||||
p100.turnOn()
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
target=$1
|
||||
if [[ $(nmcli con show --active | grep tun0) ]]; then
|
||||
echo Active, deactivating
|
||||
nmcli con down VPN-aw
|
||||
nmcli con down VPN-${target}
|
||||
else
|
||||
echo Not active, activating
|
||||
nmcli con up VPN-aw
|
||||
nmcli con up VPN-${target}
|
||||
fi
|
||||
|
|
Reference in New Issue