Learning about the System
The Console provides command and status information, and it also allows one to query the system. Using the console, one can learn about all the devices in the system, their states, the wires in the system, and information about the system in general.
The methods Command.
The most important command to know for the Console is the methods command. The methods command provides a list of all the commands available from the Console. Here is an example of running the methods command:
methods
["add_device", "devices", "get_script", "get_scripts", "info", "load_scripts", "methods", "peek", "poke", "put_script", "restart", "run_script", "unwire", "update", "wire", "wires"]
There are a bunch of commands here, and we won't cover all of them here. Many of them have to do with controlling the system, and we cover that in the Control section.
The devices Command
The devices command gives a list of all the devices in the system. If the system has just powered on and there is no power on Script, no devices will be returned.
Here is an example of the command when there are 2 Inverters in the system.
devices
[["inverter1","VIRTUAL_DEVICE"],["inverter2","VIRTUAL_DEVICE"]]
The devices command returns a bracketed list of bracketed lists. The outermost list is a list of the devices (2 Inverters, here), and the inner list is the ID of the device followed by its Device Type. Here, we have Inverters with IDs of "inverter1" and "inverter2", and their Device Type is "VIRTUAL_DEVICE".
The wires Command
The wires command lists all the wires in the system. Here is an example:
wires
[["inverter1:1S","inverter2:1"]]
In this example, there is a single wire connecting "inverter1"'s output to "inverter2"'s input. The wires command returns a bracketed list of wires. Each wire is a bracketed list with a start terminal and an end terminal.
The peek Command
The peek command lets one see terminal values in the system. One can see the value of an individual terminal or all the terminals for a particular device. The see a particular terminal value:
peek "inverter1:1S"
[true,"off"]
Type peek followed by a double quoted terminal name. The return value is a bracketed pair. The first value is true if the command is successful, and the second value is the value of the terminal.
The see all the terminal values on a device, peek at the whole device.
peek "inverter1"
{"1":"on","1S":"off"}
For "inverter1", there are two terminals and two terminal values. The output format a curly bracketed list with the terminal names, followed by a colon followed by the terminal value. Since "inverter1" is an Inverter, its "1S" value is the opposite of its "1" terminal value.
The info Command
The info command returns information about the system.
info
"Started: Fri Mar 22 13:54:31 UTC 2013\nCode built: Wed Mar 20 12:18:14 UTC 2013\nCurrent time: Fri Mar 22 14:14:24 UTC 2013\n"
Here we see when the system was last started, when the code was built, and what time the system thinks it is.
If one is using Interval Timers and they aren't turning on and off at the proper times, use the info command to see if the system time is set properly.
|