Plugwise Stretch 2.0 – Communicatie module (perl)
Informatie (ENG)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
NAME Device::Plugwise - Perl module to communicate with Plugwise hardware VERSION version 0.5 SYNOPSIS my $plugwise = Device::Plugwise->new(device => '/dev/cu.usbserial01'); $plugwise->command('on', 'ABCDEF'); # Enable Circle#ABCDEF while (1) { my $message = $plugwise->read(); print $message, "\n"; } $plugwise = Device::Plugwise->new(device => 'hostname:port'); $plugwise->command('on', 'ABCDEF'); # Enable Circle#ABCDEF DESCRIPTION Module for interfacing to Plugwise hardware. Current implemented functions are Switching ON/OFF of circles Query circles for their status Query the Circles+ for known circles Retrieve the live power consumption of a Circle Readout the historic power consumption of a Circle (1-hour average) IMPORTANT: This module required Plugwise firmware v2.37 or higher. METHODS "new(%parameters)" This constructor returns a new Device::Plugwise object. Supported parameters are listed below device The name of the device to connect to, The value can be a tty device name of "hostname:port" for a TCP connection. This parameter is required. filehandle The name of an existing filehandle to be used instead of the 'device' parameter. baud The baud rate for the tty device. The default is 9600. port The port for a TCP device. There is no default port. "device()" Returns the device used to connect to the equipment. If a filehandle was provided this method will return undef. "baud()" Returns the baud rate. Only makes sense when connected over a serial connection. "port()" Returns the TCP port for the device. Only makes sense when using this type of connection of course. "filehandle()" This method returns the file handle for the device. "list_circles_count()" This method returns the number of Circles that will be interrogated with the list_circles command. If you have more than 16 Circles in your network, increase the setting to a higher value. "read([$timeout])" This method blocks until a new message has been received by the device. When a message is received the message string is returned. An optional timeout (in seconds) may be provided. "read_one(\$buffer, [$do_not_write])" This method attempts to remove a single 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. By default, a received message triggers sending of the next queued message if the $do_no_write parameter is set then writes are not triggered. "write($command, $callback)" This method queues a command for sending to the connected device. The first write will be written immediately, subsequent writes are queued until a response to the previous message is received. "queue_size()" This method reports the number of commands that are in the queue to be sent to the stick. "status()" This method returns the status of the internal _plugwise hash. This can be used to extract network information and for debugging. Hash entries include connected : is the software connected to the USB stick stick_MAC : Zigbee MAC address of the stick network_key : Full zigbee network ID short_key : Short version of the network ID circles : List of IDs of Circles that have responded to a calibration request and that hence are known to be active on the wireless network "command($command, $target)" This method sends a command to the stick. Supported $commands with a target id are: on : switch a circle on off : switch a circle off status : request the current switch state, internal clock, live power consumption livepower : request the current power measured by the Circle history : request the energy consumption for a specific logaddress $target can either be a single short hardware MAC address or a comma-separated list of devices if multiple devices need to receive the same command. ACKNOWLEDGEMENTS The code of this module is heavily based the code by Mark Hindess (Device::Onkyo), thanks Mark! The initial Perl Plugwise interface code for firmware v1 was written by Jfn. AUTHOR Lieven Hollevoet <hollie@cpan.org> COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Lieven Hollevoet. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. |
[#/plugwise/overig/plugwise_perl_communicatie_module” ]