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.StringType;
19 import org.openhab.core.thing.ChannelUID;
20 import org.openhab.core.thing.type.ChannelTypeUID;
21 import org.openhab.core.types.StateDescriptionFragment;
22 import org.openhab.core.types.StateDescriptionFragmentBuilder;
25 * A web page type of control on Loxone Miniserver.
27 * @author Pawel Pieczul - initial contribution
30 class LxControlWebPage extends LxControl {
31 static class Factory extends LxControlInstance {
33 LxControl create(LxUuid uuid) {
34 return new LxControlWebPage(uuid);
43 private StringType url;
44 private StringType urlHd;
46 private LxControlWebPage(LxUuid uuid) {
51 public void initialize(LxControlConfig config) {
52 super.initialize(config);
53 if (details != null) {
54 if (details.url != null) {
55 url = new StringType(details.url);
57 if (details.urlHd != null) {
58 urlHd = new StringType(details.urlHd);
61 StateDescriptionFragment fragment = StateDescriptionFragmentBuilder.create().withReadOnly(true).build();
62 ChannelUID c1 = addChannel("String", new ChannelTypeUID(BINDING_ID, MINISERVER_CHANNEL_TYPE_RO_TEXT),
63 defaultChannelLabel + " / URL", "Low resolution URL", tags, null, () -> url);
64 addChannelStateDescriptionFragment(c1, fragment);
66 ChannelUID c2 = addChannel("String", new ChannelTypeUID(BINDING_ID, MINISERVER_CHANNEL_TYPE_RO_TEXT),
67 defaultChannelLabel + " / URL HD", "High resolution URL", tags, null, () -> urlHd);
68 addChannelStateDescriptionFragment(c2, fragment);