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.plugwise.internal.config;
15 import static org.openhab.binding.plugwise.internal.PlugwiseUtils.*;
16 import static org.openhab.binding.plugwise.internal.config.PlugwiseRelayConfig.PowerStateChanging.COMMAND_SWITCHING;
18 import java.time.Duration;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.binding.plugwise.internal.protocol.field.MACAddress;
24 * The {@link PlugwiseRelayConfig} class represents the configuration for a Plugwise relay device (Circle, Circle+,
27 * @author Wouter Born - Initial contribution
30 public class PlugwiseRelayConfig {
32 public enum PowerStateChanging {
38 private String macAddress = "";
39 private String powerStateChanging = upperUnderscoreToLowerCamel(COMMAND_SWITCHING.name());
40 private boolean suppliesPower = false;
41 private int measurementInterval = 60; // minutes
42 private boolean temporarilyNotInNetwork = false;
43 private boolean updateConfiguration = true;
45 public MACAddress getMACAddress() {
46 return new MACAddress(macAddress);
49 public PowerStateChanging getPowerStateChanging() {
50 return PowerStateChanging.valueOf(lowerCamelToUpperUnderscore(powerStateChanging));
53 public boolean isSuppliesPower() {
57 public Duration getMeasurementInterval() {
58 return Duration.ofMinutes(measurementInterval);
61 public boolean isTemporarilyNotInNetwork() {
62 return temporarilyNotInNetwork;
65 public boolean isUpdateConfiguration() {
66 return updateConfiguration;
70 public String toString() {
71 return "PlugwiseRelayConfig [macAddress=" + macAddress + ", powerStateChanging=" + powerStateChanging
72 + ", suppliesPower=" + suppliesPower + ", measurementInterval=" + measurementInterval
73 + ", temporarilyNotInNetwork=" + temporarilyNotInNetwork + ", updateConfiguration="
74 + updateConfiguration + "]";