This repository contains source code of the controller software for remote power strip device.
Currently the script works only on Linux Platform.
python3 rps.py [arguments] [serialPort]
info
Get information about the connected device.
getAll
Get state of all channels.
getOne
Get state of one channel. You will have to pass the channel number as another argument.
setOne
Set the state of one channel. You will have to pass the channel number and state as other aguments.
addUser
Associate a user with a channel. This command requires sudo permissions.
removeUser
Remove User from a channel. This command requires sudo permissions.
--command [command]
-c [command]
The command to execute, find the list of commands below (this argument is always required)
--channel [channel number]
-ch [channel number]
The channel to access, its a number in the range 0,N-1 (N being the number of channels)
--state [state]
-s [state]
The state to set
--user [username]
-u [username]
The linux username
For all the following examples, assume that device is connected to port /dev/ttyUSB0
rps --command info /dev/ttyUSB0
OR
rps -c info /dev/ttyUSB0
rps --command getAll /dev/ttyUSB0
OR
rps -c getAll /dev/ttyUSB0
rps --command getOne --channel 3 /dev/ttyUSB0
OR
rps -c getOne -ch 3 /dev/ttyUSB0
rps --command setOne --channel 3 /dev/ttyUSB0
OR
rps -c setOne -ch 3 /dev/ttyUSB0
- Clone the repository in /opt. You will need sudo permissions for this.
git clone https://github.com/parmAshu/remote_power_strip.git
- Initialize the submodule by navigating into the cloned repository and executing the following commands.
git submodule init
git submodule update
- Add the alias to the script in .bashrc file(s)
alias rps="/opt/remote_power_strip/rps.py"
- This script currently works only on linux system.
- This script stores configuration file in /etc/rps; sudo permissions are required when you want for operations/commands that require modifying configuration file.