np05bctl -- Command line utility for accessing the Synaccess NP-05B networked power strip
$ np05bctl --addr=10.1.2.3 --user=bob --pass=w00t login pset 3 1 ["login", "OK"] ["pstat", "OK", {"1": 0, "2": 0, "3": 1, "4": 0, "5": 0}] $ np05bctl --addr=10.1.2.3 -p stat [ "stat", "OK", { "eth": "on", "gw": "192.168.1.1", "ip": "10.1.2.3", "mac": "00:90:c2:12:34:56", "mask": "255.255.0.0", "model": "NP-05B", "port_http": "80", "port_telnet": "23", "power_hr": { "1": 0, "2": 0, "3": 1, "4": 0, "5": 0 }, "s_gw": "192.168.1.1", "s_ip": "10.1.2.3", "s_mask": "255.255.0.0", "source": "static", "src_ip": "0.0.0.0" } ]
np05bctl is a light wrapper around Device::Power::Synaccess::NP05B, providing its functionality as a command line utility.
np05bctl
Please see Device::Power::Synaccess::NP05B for details.
-p Pretty-format json output -q Do not print results of command to stdout --addr=<#> Dotted IP address of NP-05B (default: 192.168.1.100) --user=<s> Username for logging into NP-05B (default: admin) --pass=<s> Password for logging into NP-05B (default: admin)
Command results are written to stdout as JSON of one of the two formats:
[<operation>, "OK", <optional JSON object>] [<operation>, "ERROR", <error description>]
Commands may be stacked. For instance, to authenticate and then turn on ports 3 and 4:
np05bctl login pset 3 1 pset 4 1 ["login", "OK"] ["pstat", "OK", {"1": 0, "2": 0, "3": 1, "4": 0, "5": 0}] ["pstat", "OK", {"1": 0, "2": 0, "3": 1, "4": 1, "5": 0}]
Authenticate with the NP-05B. Depending on your configuration this might not be necessary.
NP-05B
Turn outlet X on (Y=1) or off (Y=2).
For the author's five-port device, the valid range for X is 1..5
Show which outlets are on or off.
Dump the NP-05B's system configuration.
This software is provided "as-is," without any express or implied warranty. In no event shall the author be held liable for any damages arising from the use of the software.
At the time of this writing, following login with stat does not work correctly. If you have configured your NP-05B to allow unauthenticated commands, stat without login works fine. This is a fairly heinous bug and the author will be fixing it.
login
stat
Support additional features as they become implemented in Device::Power::Synaccess::NP05B (also developed by this author).
TTK Ciar <ttk@ciar.org>
Copyright (C) 2017 TTK Ciar
You may use and distribute this program under the same terms as Perl itself.
To install App::np05bctl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::np05bctl
CPAN shell
perl -MCPAN -e shell install App::np05bctl
For more information on module installation, please visit the detailed CPAN module installation guide.