2 * Copyright (c) 2010-2022 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.onewire.internal.owserver;
15 import java.math.BigDecimal;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ChannelUID;
22 * The {@link OwfsDirectChannelConfig} defines config for owfsdirect channels
24 * @author Jan N. Klug - Initial contribution
27 public class OwfsDirectChannelConfig {
28 public String path = "";
29 public BigDecimal refresh = new BigDecimal(300);
31 public long lastRefresh = 0;
32 public int refreshCycle = 300;
34 public @Nullable ChannelUID channelUID;
35 public String acceptedItemType = "";
37 public boolean initialize(ChannelUID channelUID, @Nullable String acceptedItemType) {
38 this.channelUID = channelUID;
39 this.acceptedItemType = acceptedItemType != null ? acceptedItemType : "";
40 refreshCycle = refresh.intValue() * 1000;
42 return !path.isEmpty();