NAME Device::CurrentCost - Perl modules for Current Cost energy monitors VERSION version 1.110390 SYNOPSIS use Device::CurrentCost; my $envy = Device::CurrentCost->new(device => '/dev/ttyUSB0'); $|=1; # don't buffer output while (1) { my $msg = $envy->read() or next; print $msg->summary, "\n"; } use Device::CurrentCost::Constants; my $classic = Device::CurrentCost->new(device => '/dev/ttyUSB1', type => CURRENT_COST_CLASSIC); ... DESCRIPTION Module for reading from Current Cost energy meters. IMPORTANT: This is an early release and the API is still subject to change. The API for history is definitely not complete. This will change soon and an mechanism for aggregating the history (which is split across many messages) should be added. METHODS "new(%parameters)" This constructor returns a new Current Cost device object. The supported parameters are: device The name of the device to connect to. The value should be a tty device name, e.g. "/dev/ttyUSB0". This parameter is mandatory. type The type of the device. Currently either "CURRENT_COST_CLASSIC" or "CURRENT_COST_ENVY". The default is "CURRENT_COST_ENVY". baud The baud rate for the device. The default is derived from the type and is either 57600 (for Envy) or 9600 (for classic). "device()" Returns the path to the device. "type()" Returns the type of the device. "baud()" Returns the baud rate. "posix_baud()" Returns the baud rate in POSIX#Termios format. "filehandle()" Returns the filehandle being used to read from the device. "open()" This method opens the serial port and configures it. "read($timeout)" This method blocks until a new message has been received by the device. When a message is received a data structure is returned that represents the data received. IMPORTANT: This API is still subject to change. "read_one(\$buffer)" This method attempts to remove a single Current Cost message from the buffer passed in via the scalar reference. When a message is removed a data structure is returned that represents the data received. If insufficient data is available then undef is returned. IMPORTANT: This API is still subject to change. AUTHOR Mark Hindess COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Mark Hindess. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.