]> git.basschouten.com Git - openhab-addons.git/blob
1e5ffcac4824f1cb70934b3bebca27250d422ac5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.avmfritz.internal.hardware.callbacks;
14
15 import static org.eclipse.jetty.http.HttpMethod.GET;
16
17 import java.math.BigDecimal;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.avmfritz.internal.hardware.FritzAhaWebInterface;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23
24 /**
25  * Callback implementation for updating heating values Supports reauthorization
26  *
27  * @author Christoph Weitkamp - Initial contribution
28  * @author Christoph Weitkamp - Added support for AVM FRITZ!DECT 300 and Comet
29  *         DECT
30  */
31 @NonNullByDefault
32 public class FritzAhaSetHeatingTemperatureCallback extends FritzAhaReauthCallback {
33
34     private final Logger logger = LoggerFactory.getLogger(FritzAhaSetHeatingTemperatureCallback.class);
35
36     private static final String WEBSERVICE_COMMAND = "switchcmd=sethkrtsoll";
37
38     private final String ain;
39
40     /**
41      * Constructor
42      *
43      * @param webIface Interface to FRITZ!Box
44      * @param ain AIN of the device that should be switched
45      * @param temperature New temperature
46      */
47     public FritzAhaSetHeatingTemperatureCallback(FritzAhaWebInterface webIface, String ain, BigDecimal temperature) {
48         super(WEBSERVICE_PATH, WEBSERVICE_COMMAND + "&ain=" + ain + "&param=" + temperature, webIface, GET, 1);
49         this.ain = ain;
50     }
51
52     @Override
53     public void execute(int status, String response) {
54         super.execute(status, response);
55         if (isValidRequest()) {
56             logger.debug("Received response '{}' for item '{}'", response, ain);
57         }
58     }
59 }