Max - Perl interface for "eQ-3 MAX! Cube LAN Gateway"
use Max;
my $host = Max->discover or die;
my $max = Max->connect($host);
my $max = Max->connect("192.168.1.9");
for my $device ($max->devices) { ... }
for my $room ($max->rooms) { ... }
my $device = $max->pair;
$device->set_room(42);
$max->room(42)->set_temperature(21.5);
This library is a very simple and incomplete interface for the Max! system. It implements a minimal set of features and does not depend on other Perl modules.
The distribution comes with a binary, max
, which implements a simple shell interface.
Connects to the Cube and returns a new Max object.
Attempts to discover the Cube's IP address on the network. Naively believes that the first device to respond is a Max! Cube with no further checks.
Returns the Max::Device object for the given device address, provided either in binary or as a 6-digit hexadecimal string. Returns undef if no such device is registered.
Returns a list of discovered devices as Max::Device objects. The order is not guaranteed.
In scalar context, returns the number of devices.
Disconnects gracefully. No methods involving communication with the Cube should be called after disconnecting.
Given a Max::Device or a 6-digit hexadecimal address, removes the indicated device from the Cube. Does not (yet) remove the device from the internal cache, so even after forget(), it will still be listed.
Initiates device pairing on the Cube. If successful, returns a Max::Device object that represents the newly paired device. Dies on recognised errors.
Sends a UDP command to immediately reboot the Cube. After this, the object should not be reused because the TCP connection will have died.
Returns the Max::Room object for the given room ID. Creates a new object (but doesn't register a new room with the Cub) if the given ID is new.
Returns a list of discovered rooms as Max::Room objects, ordered by ID.
In scalar context, returns the number of rooms.
Writes the metadata (such as room and device names) back to the Cube. Will overwrite the existing metadata on the device with the current client-side state.
The Max! Cube is completely insecure. It's probably wise to run it on a separate network without any internet connection.
The Max! Cube cannot handle concurrent connections and this library does not try to work around that issue.
Connection errors are not handled properly.
Pick your favourite OSI approved license :)
http://www.opensource.org/licenses/alphabetical
Juerd Waalboer <#####@juerd.nl> <http://juerd.nl/>