]> git.basschouten.com Git - openhab-addons.git/blob
de0d308643849222c62f896422af72f0f8fb0cef
[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.cloud.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.cloud.rest.HttpSalusApi;
22 import org.openhab.binding.salus.internal.handler.AbstractBridgeHandler;
23 import org.openhab.binding.salus.internal.handler.CloudApi;
24 import org.openhab.binding.salus.internal.rest.GsonMapper;
25 import org.openhab.binding.salus.internal.rest.RestClient;
26 import org.openhab.core.io.net.http.HttpClientFactory;
27 import org.openhab.core.thing.Bridge;
28
29 /**
30  * @author Martin GrzeĊ›lowski - Initial contribution
31  */
32 @NonNullByDefault
33 public final class CloudBridgeHandler extends AbstractBridgeHandler<CloudBridgeConfig> implements CloudApi {
34
35     public CloudBridgeHandler(Bridge bridge, HttpClientFactory httpClientFactory) {
36         super(bridge, httpClientFactory, CloudBridgeConfig.class);
37     }
38
39     @Override
40     protected SalusApi newSalusApi(CloudBridgeConfig config, RestClient httpClient, GsonMapper gsonMapper) {
41         return new HttpSalusApi(config.getUsername(), config.getPassword().getBytes(UTF_8), config.getUrl(), httpClient,
42                 gsonMapper);
43     }
44
45     @Override
46     public Set<String> it600RequiredChannels() {
47         return Set.of("ep_9:sIT600TH:LocalTemperature_x100", "ep_9:sIT600TH:HeatingSetpoint_x100",
48                 "ep_9:sIT600TH:SetHeatingSetpoint_x100", "ep_9:sIT600TH:HoldType", "ep_9:sIT600TH:SetHoldType");
49     }
50
51     @Override
52     public boolean isReadOnly() {
53         return false;
54     }
55
56     @Override
57     public String channelPrefix() {
58         return "ep_9";
59     }
60 }