]> git.basschouten.com Git - openhab-addons.git/blob
0c43588aae0880cf4ba2550a815da0ff908a1f28
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.salus.internal.aws.handler;
14
15 import static java.nio.charset.StandardCharsets.UTF_8;
16
17 import java.util.Set;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.salus.internal.SalusApi;
21 import org.openhab.binding.salus.internal.aws.http.AwsSalusApi;
22 import org.openhab.binding.salus.internal.handler.AbstractBridgeHandler;
23 import org.openhab.binding.salus.internal.rest.GsonMapper;
24 import org.openhab.binding.salus.internal.rest.RestClient;
25 import org.openhab.core.io.net.http.HttpClientFactory;
26 import org.openhab.core.thing.Bridge;
27
28 /**
29  * @author Martin GrzeĊ›lowski - Initial contribution
30  */
31 @NonNullByDefault
32 public final class AwsCloudBridgeHandler extends AbstractBridgeHandler<AwsCloudBridgeConfig> {
33     private final HttpClientFactory httpClientFactory;
34
35     public AwsCloudBridgeHandler(Bridge bridge, HttpClientFactory httpClientFactory) {
36         super(bridge, httpClientFactory, AwsCloudBridgeConfig.class);
37         this.httpClientFactory = httpClientFactory;
38     }
39
40     @Override
41     protected SalusApi newSalusApi(AwsCloudBridgeConfig config, RestClient httpClient, GsonMapper gsonMapper) {
42         return new AwsSalusApi(httpClientFactory, config.getUsername(), config.getPassword().getBytes(UTF_8),
43                 config.getUrl(), httpClient, gsonMapper, config.getUserPoolId(), config.getIdentityPoolId(),
44                 config.getClientId(), config.getRegion(), config.getCompanyCode(), config.getAwsService());
45     }
46
47     @Override
48     public Set<String> it600RequiredChannels() {
49         return Set.of("ep9:sIT600TH:LocalTemperature_x100", "ep9:sIT600TH:HeatingSetpoint_x100",
50                 "ep9:sIT600TH:HoldType");
51     }
52
53     @Override
54     public boolean isReadOnly() {
55         return true;
56     }
57
58     @Override
59     public String channelPrefix() {
60         return "ep9";
61     }
62 }