Skip to content

Commit

Permalink
Add room boost
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbeazley committed May 6, 2023
1 parent b0ed403 commit 93826e3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bin/max
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ sub do_set {
print "Done.\n";
}

sub do_boost {
my ($room_id) = @_;
$room_id ||= 0;

my $usage = "Usage: $0 boost <roomid>\n";
$room_id eq 'all' or _valid_uint8($room_id) && $room_id > 0 or die $usage;

$max ||= Max->connect($host);

for my $room ($room_id eq 'all' ? $max->rooms : $max->room($room_id)) {
$room->devices or warn "No devices in " . $room->display_name . ".\n";
printf "Boosting %s.\n", $room->display_name;
$room->boost() or die "Boosting temperature failed.\n";
}
print "Done.\n";
}

sub do_status {
$max ||= Max->connect($host);
clear;
Expand Down
6 changes: 6 additions & 0 deletions lib/Max/Room.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ sub setpoint {
return $self->_send_radio(0x40, sprintf "%02x", $t2 | 0x40);
}

sub boost {
my ($self) = @_;
my $t2 = $self->_get_setpoint * 2;
return $self->_send_radio(0x40, sprintf "%02x", $t2 | 0xc0);
}

sub too_cold {
my ($self, $maxdelta) = @_;
$maxdelta ||= 0;
Expand Down

0 comments on commit 93826e3

Please sign in to comment.