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.tapocontrol.internal.structures;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.config.core.Configuration;
17 import org.openhab.core.thing.Thing;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * The {@link TapoDeviceConfiguration} class contains fields mapping bridge configuration parameters.
24 * @author Christian Wild - Initial contribution
28 public final class TapoDeviceConfiguration {
29 private final Logger logger = LoggerFactory.getLogger(TapoDeviceConfiguration.class);
31 /* THING CONFIGUTATION PROPERTYS */
32 public static final String CONFIG_DEVICE_IP = "ipAddress";
33 public static final String CONFIG_UPDATE_INTERVAL = "pollingInterval";
35 /* thing configuration parameter. */
36 public String ipAddress = "";
37 public Integer pollingInterval = 30;
39 private final Thing device;
44 * @param thing BridgeThing
46 public TapoDeviceConfiguration(Thing thing) {
54 public void loadSettings() {
56 Configuration config = this.device.getConfiguration();
57 this.ipAddress = config.get(CONFIG_DEVICE_IP).toString();
58 this.pollingInterval = Integer.valueOf(config.get(CONFIG_UPDATE_INTERVAL).toString());
59 } catch (Exception e) {
60 logger.warn("{} error reading device-configuration: '{}'", device.getUID().toString(), e.getMessage());