ha-warmup/warmup

Duration parameter for warmup.set_override service

Opened this issue · 0 comments

artmg commented

If a user was going to create a button or an automation to set an override, they would probably not use a fixed end time, but specify a duration instead.

This enhancement request is to allow an additional optional parameter to specify a duration when calling the service warmup.set_override. I propose the definition:

set_override:
  fields:
    duration:
      description: An optional duration for the override, in minutes, as an alternative to specifying until
      example: 120

Implementation note. Although the warmup4ie.py method set_override is defined with an until parameter, and the API request (type 3) specifies the until value only, it is highly likely that the API also includes other override request types that use duration because a) the properties include a value override_duration_mins and b) the server response returns the duration rather than the until.

2020-01-15 11:48:31 INFO (SyncWorker_0) [custom_components.warmup.warmup4ie.warmup4ie] Successfully set override, response from server: 
'{"status":{"result":"success"},"message":{"setOverrideByRoomId":{"query2":{"query":"mutation {deviceOverride(lid:54321,rid:12345,temperature:210,minutes:11)}"},
"result2":{"data":{"deviceOverride":true},"status":"success"}},"setOverride":{"overrideDur":"11"},"duration":"0.125"}}'