Skip to content

Commit

Permalink
Add boost to set command
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbeazley committed May 6, 2023
1 parent 93826e3 commit 5e437c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/max
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ sub do_set {
my ($room_id, $setpoint) = @_;
$room_id ||= 0;

my $usage = "Usage: $0 set <roomid> <eco|comfort|temperature per 0.5>\n";
my $usage = "Usage: $0 set <roomid> <boost|eco|comfort|temperature per 0.5>\n";
$room_id eq 'all' or _valid_uint8($room_id) && $room_id > 0 or die $usage;

$setpoint eq 'eco' or $setpoint eq 'comfort'
$setpoint eq 'eco' or $setpoint eq 'comfort' or $setpoint eq 'boost'
or _valid_temperature($setpoint) or die $usage;

$max ||= Max->connect($host);
Expand All @@ -114,7 +114,11 @@ sub do_set {
$room->devices or warn "No devices in " . $room->display_name . ".\n";
my $t = $setpoint =~ /eco|comfort/ ? $room->get_preset($setpoint) : $setpoint;
printf "Setting %s temperature to %s.\n", $room->display_name, $t;
$room->setpoint($t) or die "Setting temperature failed.\n";
if($setpoint eq 'boost'){
$room->boost() or die "Boosting temperature failed.\n";
}else{
$room->setpoint($t) or die "Setting temperature failed.\n";
}
}
print "Done.\n";
}
Expand Down

0 comments on commit 5e437c9

Please sign in to comment.