]> git.basschouten.com Git - openhab-addons.git/blob
e8fafe09df64172825d84960b9ed873cfa703c79
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.onewire.internal.owserver;
14
15 import java.math.BigDecimal;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ChannelUID;
20
21 /**
22  * The {@link OwfsDirectChannelConfig} defines config for owfsdirect channels
23  *
24  * @author Jan N. Klug - Initial contribution
25  */
26 @NonNullByDefault
27 public class OwfsDirectChannelConfig {
28     public String path = "";
29     public BigDecimal refresh = new BigDecimal(300);
30
31     public long lastRefresh = 0;
32     public int refreshCycle = 300;
33
34     public @Nullable ChannelUID channelUID;
35     public String acceptedItemType = "";
36
37     public boolean initialize(ChannelUID channelUID, @Nullable String acceptedItemType) {
38         this.channelUID = channelUID;
39         this.acceptedItemType = acceptedItemType != null ? acceptedItemType : "";
40         refreshCycle = refresh.intValue() * 1000;
41
42         return !path.isEmpty();
43     }
44 }