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.loxone.internal.controls;
15 import static org.openhab.binding.loxone.internal.LxBindingConstants.*;
17 import org.openhab.binding.loxone.internal.types.LxUuid;
18 import org.openhab.core.library.types.OnOffType;
19 import org.openhab.core.thing.type.ChannelTypeUID;
20 import org.openhab.core.types.State;
21 import org.openhab.core.types.UnDefType;
24 * An InfoOnlyDigital type of control on Loxone Miniserver.
26 * According to Loxone API documentation, this control covers digital virtual states only. This control does not send
27 * any commands to the Miniserver. It can be used to read a formatted representation of a digital virtual state.
29 * @author Pawel Pieczul - initial contribution
32 class LxControlInfoOnlyDigital extends LxControl {
34 static class Factory extends LxControlInstance {
36 LxControl create(LxUuid uuid) {
37 return new LxControlInfoOnlyDigital(uuid);
42 return "infoonlydigital";
47 * InfoOnlyDigital has one state that can be on/off
49 private static final String STATE_ACTIVE = "active";
51 private LxControlInfoOnlyDigital(LxUuid uuid) {
56 public void initialize(LxControlConfig config) {
57 super.initialize(config);
58 addChannel("Switch", new ChannelTypeUID(BINDING_ID, MINISERVER_CHANNEL_TYPE_RO_SWITCH), defaultChannelLabel,
59 "Digital virtual state", tags, null, this::getChannelState);
62 private State getChannelState() {
63 Double value = getStateDoubleValue(STATE_ACTIVE);
67 } else if (value == 1.0) {
70 return UnDefType.UNDEF;