Skip to content

Latest commit

 

History

History
177 lines (107 loc) · 3.96 KB

Device.pod

File metadata and controls

177 lines (107 loc) · 3.96 KB

NAME

Max::Device - Class to represent an eQ-3 Max! device

SYNOPSIS

use Max;

for my $device ($max->devices) { ... }
for my $device ($room->devices) { ... }

$device->room->setpoint(21.5);

my $room = $device->room(42);
$device->add_link($other_device);

if ($device->has_temperature) {
    say "Current temperature is " . $device->temperature;
}

if ($device->is_cube) { ... }

if ($device->has_valve) {
    printf "Valve is %d%% open.", $device->valve;
}

if ($device->flags_as_string =~ /battery/) {
    say "Low battery.";
}

DESCRIPTION

Represents a device in an "eQ-3 Max!" network.

Class methods

Max::Device->new(...)

Considered an internal method; should not be called directly.

Instance methods

Given another Max::Device object, sets up a unidirectional link between the devices. In a typical situation, devices will be cross-linked, but this method does not automate that.

Returns true on success, false on failure.

addr

Returns the address in binary form.

addr_hex

Returns the address as 6 hexadecimal digits.

config_display('current'|'setpoint')

Configures the device to display either the current temperature, or the setpoint temperature. Will work on wall thermostats, or emit a warning otherwise.

config_temperatures($comfort, $eco, $max, $min)

Configures the device temperature presets and on-device setpoint limits. To keep any of the values unchanged, provide it as undef. Will work on heaters and wall thermostats, or emit a warning otherwise.

display_name($include_addr)

Returns the configured name, or a string comprised of the device's type and address. The address is added, even for devices that have a configured name, if the argument $include_addr is true.

flags_as_string

Returns a space-joined list of flag in alphabetical order. Possible flags are:

init
link
battery
error
invalid

has_temperature, has_valve, is_cube

Returns a boolean value according to the device type.

mode_num, mode

Returns the current mode as a number, or as a string. Possible modes are:

0 auto
1 manual
2 vacation
3 boost

name

Returns the configured name (binary).

name($name)

Sets a new name, but does not write the metadata to the cube. Use $max->write_metadata to store the new name.

room

Returns the Max::Room object for the associated room.

room($room)

Given a Max::Room object or a numeric room ID, configures the device to associate with that room.

Returns undef on failure. Returns a Max::Room object on success, and updates the Max::Room object in the parent Max object.

serial

Returns the device's serial number.

setpoint

Returns the currently target temperature.

Setting the target temperature of individual devices is not supported; use $device->room->setpoint to set the target for the entire room.

temperature

Returns the measured temperature. Note: not all devices support this feature. Most notably, the TRVs don't. Use has_temperature to test this.

type_num, type

Returns the type either as a number, or as a string. Possible types are:

0 cube
1 heater
2 heater+
3 thermostat
4 shutter
5 button

valve

Returns the current position of the valve. 0 is fully closed, 100 is fully open. Note: not all devices have a valve. Use has_valve to test this.

CAVEATS

  • Shutter and button devices are not (yet) supported.

  • Tricks exist to read the current measured temperature from a TRV, but because that involves waiting for parameters to change, this library does not implement such tricks. Consider buying a wall thermostat for every room.

LICENSE

Pick your favourite OSI approved license :)

http://www.opensource.org/licenses/alphabetical

AUTHOR

Juerd Waalboer <#####@juerd.nl> <http://juerd.nl/>