예제 #1
0
        //hmip/home/group/heating/setControlMode
        //set menu mode: {"controlMode":"MANUAL","groupId":"5ba14748-1b83-4bd6-aff0-2b11f8b5c361"}
        public async Task <bool> SetControlMode(string groupId, ClimateControlMode controlMode = ClimateControlMode.AUTOMATIC, CancellationToken cancellationToken = default)
        {
            var requestObject = new SetControlModeRequestObject(groupId, controlMode);
            var stringContent = GetStringContent(requestObject);

            var httpResponseMessage = await HttpClient.PostAsync("hmip/group/heating/setControlMode", stringContent, cancellationToken);

            if (httpResponseMessage.IsSuccessStatusCode)
            {
                return(true);
            }

            throw new ArgumentException($"Request failed: {httpResponseMessage.ReasonPhrase}");
        }
예제 #2
0
 public SetControlModeRequestObject(string groupId, ClimateControlMode controlMode)
 {
     GroupId     = groupId;
     ControlMode = controlMode;
 }