nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
225 stars 50 forks source link

Cannot set indefinite hold via API #98

Closed jbrockerville closed 4 years ago

jbrockerville commented 4 years ago

As written, there is no way set an indefinite hold via the API. If you leave until out of the url, e.g.

curl -d "hold=on&activity=manual" -X POST http://192.168.1.203:3000/api/1/hold

Then it simply defaults to one hour in the future. That's ok. However, if you can set otmr = {}, then an indefinite hold is set. I did this locally... infinitude(158)

if ($c->req->param('until')) {
    $setting->{until} = &qtr_hr($c->req->param('until'));
} else {
    $setting->{until} = {}
}
$zone->otmr([$setting->{until}]);
nebulous commented 4 years ago

What do you think would fit the principle of least surprise when it comes to until values for an unrestricted hold, given that we have some users who may rely on the +1 hour default?

until=0 until=forever until=anything-not-matching DD:DD ?

nebulous commented 4 years ago

I created PR#99 with an example of until=forever. If that branch solves your problem then I'll merge it.

jbrockerville commented 4 years ago

Fair point about not breaking it for other users possibly relying the default behaviour. Just tried it out. Works fine. Good solution. Ship it! Thanks!