2 * Copyright (c) 2010-2021 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.opensprinkler.internal.api;
15 import org.eclipse.jetty.client.HttpClient;
16 import org.openhab.binding.opensprinkler.internal.api.exception.GeneralApiException;
17 import org.openhab.binding.opensprinkler.internal.config.OpenSprinklerHttpInterfaceConfig;
18 import org.openhab.binding.opensprinkler.internal.util.Hash;
21 * The {@link OpenSprinklerHttpApiV213} class is used for communicating with
22 * the OpenSprinkler API for firmware versions 2.1.3 and up.
24 * @author Chris Graham - Initial contribution
26 class OpenSprinklerHttpApiV213 extends OpenSprinklerHttpApiV210 {
28 * Constructor for the OpenSprinkler API class to create a connection to the OpenSprinkler
29 * device for control and obtaining status info.
31 * @param hostname Hostname or IP address as a String of the OpenSprinkler device.
32 * @param port The port number the OpenSprinkler API is listening on.
33 * @param password Admin password for the OpenSprinkler device.
34 * @param basicUsername only needed if basic auth is required
35 * @param basicPassword only needed if basic auth is required
38 OpenSprinklerHttpApiV213(final HttpClient httpClient, final OpenSprinklerHttpInterfaceConfig config)
39 throws GeneralApiException {
40 super(httpClient, withHashedPassword(config));
43 private static OpenSprinklerHttpInterfaceConfig withHashedPassword(final OpenSprinklerHttpInterfaceConfig config) {
44 config.password = Hash.getMD5Hash(config.password);