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.lifx.internal;
15 import java.net.InetSocketAddress;
16 import java.time.Duration;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.lifx.internal.fields.MACAddress;
23 * Configuration class for LIFX lights.
25 * @author Wouter Born - Initial contribution
28 public class LifxLightConfig {
30 private @Nullable String deviceId;
31 private @Nullable String host;
32 private long fadetime = 300; // milliseconds
34 public @Nullable MACAddress getMACAddress() {
35 String localDeviceId = deviceId;
36 return localDeviceId == null ? null : new MACAddress(localDeviceId);
39 public @Nullable InetSocketAddress getHost() {
40 return host == null ? null : new InetSocketAddress(host, LifxBindingConstants.UNICAST_PORT);
43 public Duration getFadeTime() {
44 return Duration.ofMillis(fadetime);