]> git.basschouten.com Git - openhab-addons.git/blob
e9abf3d3c84d98c5961a61f8e76ca9ab05607885
[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.opensprinkler.internal.api;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jetty.client.HttpClient;
17 import org.openhab.binding.opensprinkler.internal.api.exception.CommunicationApiException;
18 import org.openhab.binding.opensprinkler.internal.api.exception.GeneralApiException;
19 import org.openhab.binding.opensprinkler.internal.config.OpenSprinklerHttpInterfaceConfig;
20 import org.openhab.binding.opensprinkler.internal.util.Hash;
21
22 /**
23  * The {@link OpenSprinklerHttpApiV213} class is used for communicating with
24  * the OpenSprinkler API for firmware versions 2.1.3 and up.
25  *
26  * @author Chris Graham - Initial contribution
27  */
28 @NonNullByDefault
29 class OpenSprinklerHttpApiV213 extends OpenSprinklerHttpApiV210 {
30     /**
31      * Constructor for the OpenSprinkler API class to create a connection to the OpenSprinkler
32      * device for control and obtaining status info.
33      *
34      * @param hostname Hostname or IP address as a String of the OpenSprinkler device.
35      * @param port The port number the OpenSprinkler API is listening on.
36      * @param password Admin password for the OpenSprinkler device.
37      * @param basicUsername only needed if basic auth is required
38      * @param basicPassword only needed if basic auth is required
39      * @throws CommunicationApiException
40      * @throws Exception
41      */
42     OpenSprinklerHttpApiV213(final HttpClient httpClient, final OpenSprinklerHttpInterfaceConfig config)
43             throws GeneralApiException, CommunicationApiException {
44         super(httpClient, config);
45         password = Hash.getMD5Hash(password);
46         getProgramData();
47         getStationNames();
48     }
49 }