]> git.basschouten.com Git - openhab-addons.git/blob
d543f361db0518b8472d5ce24469bd3bdbcb19d8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.loxone.internal.controls;
14
15 import static org.openhab.binding.loxone.internal.LxBindingConstants.*;
16
17 import org.openhab.binding.loxone.internal.types.LxUuid;
18 import org.openhab.core.thing.ChannelUID;
19 import org.openhab.core.thing.type.ChannelTypeUID;
20 import org.openhab.core.types.StateDescriptionFragmentBuilder;
21
22 /**
23  * A Tracker type of control on Loxone Miniserver.
24  * <p>
25  * According to Loxone API documentation, a Tracker control represents a Tracker functional block on the Miniserver
26  *
27  * @author Pawel Pieczul - initial contribution
28  *
29  */
30 class LxControlTracker extends LxControl {
31
32     static class Factory extends LxControlInstance {
33         @Override
34         LxControl create(LxUuid uuid) {
35             return new LxControlTracker(uuid);
36         }
37
38         @Override
39         String getType() {
40             return "tracker";
41         }
42     }
43
44     /**
45      * A state which will receive an update of possible Text State values)
46      */
47     private static final String STATE_ENTRIES = "entries";
48
49     private LxControlTracker(LxUuid uuid) {
50         super(uuid);
51     }
52
53     @Override
54     public void initialize(LxControlConfig config) {
55         super.initialize(config);
56         ChannelUID id = addChannel("String", new ChannelTypeUID(BINDING_ID, MINISERVER_CHANNEL_TYPE_RO_TEXT),
57                 defaultChannelLabel, "Tracker", tags, null, () -> getStateStringValue(STATE_ENTRIES));
58         addChannelStateDescriptionFragment(id, StateDescriptionFragmentBuilder.create().withReadOnly(true).build());
59     }
60 }