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.sinope.internal.config;
16 * Holds Config for the Sinope Gateway
18 * @author Pascal Larin - Initial contribution
21 public class SinopeConfig {
23 * Hostname of the Sinope Gateway
25 public String hostname;
33 public String gatewayId;
35 * API Key returned by the Gateway
39 * The number of seconds between fetches from the sinope deivces
41 public Integer refresh;
44 * Convert Hex Config String to byte
46 public static byte[] convert(String value) {
50 String _value = value;
52 _value = _value.replace("-", "");
53 _value = _value.replace("0x", "");
54 _value = _value.replace(" ", "");
56 if (_value.length() == 0) {
60 if (_value.length() % 2 == 0 && _value.length() > 1) {
61 byte[] b = new byte[_value.length() / 2];
63 for (int i = 0; i < _value.length(); i = i + 2) {
64 b[i / 2] = (byte) Integer.parseInt(_value.substring(i, i + 2), 16);