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 java.time.Duration;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.plugwise.internal.protocol.field.MACAddress;
21 * The {@link PlugwiseSwitchConfig} class represents the configuration for a Plugwise Switch.
23 * @author Wouter Born - Initial contribution
26 public class PlugwiseSwitchConfig {
28 private String macAddress = "";
29 private int wakeupInterval = 1440; // minutes (1 day)
30 private int wakeupDuration = 10; // seconds
31 private boolean updateConfiguration = true;
33 public MACAddress getMACAddress() {
34 return new MACAddress(macAddress);
37 public Duration getWakeupInterval() {
38 return Duration.ofMinutes(wakeupInterval);
41 public Duration getWakeupDuration() {
42 return Duration.ofSeconds(wakeupDuration);
45 public boolean isUpdateConfiguration() {
46 return updateConfiguration;
49 public boolean equalSleepParameters(PlugwiseSwitchConfig other) {
50 return this.wakeupInterval == other.wakeupInterval && this.wakeupDuration == other.wakeupDuration;
54 public String toString() {
55 return "PlugwiseSwitchConfig [macAddress=" + macAddress + ", wakeupInterval=" + wakeupInterval
56 + ", wakeupDuration=" + wakeupDuration + ", updateConfiguration=" + updateConfiguration + "]";