2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.avmfritz.internal.hardware.callbacks;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jetty.http.HttpMethod;
17 import org.openhab.binding.avmfritz.internal.hardware.FritzAhaWebInterface;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * Callback implementation for updating heating modes
24 * @author Christoph Weitkamp - Initial contribution
27 public class FritzAhaSetHeatingModeCallback extends FritzAhaReauthCallback {
29 private final Logger logger = LoggerFactory.getLogger(FritzAhaSetHeatingModeCallback.class);
31 public static final String BOOST_COMMAND = "sethkrboost";
32 public static final String WINDOW_OPEN_COMMAND = "sethkrwindowopen";
34 private final String ain;
39 * @param webInterface connection to FRITZ!Box
40 * @param ain AIN of the device
41 * @param command the mode to set or deactivate
42 * @param endTimestamp the end timestamp in seconds, maximum allowed value is now + 24h in the future, 0 to
45 public FritzAhaSetHeatingModeCallback(FritzAhaWebInterface webInterface, String ain, String command,
47 super(WEBSERVICE_PATH, String.format("switchcmd=%s&ain=%s&endtimestamp=%d", command, ain, endTimestamp),
48 webInterface, HttpMethod.GET, 1);
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);