]> git.basschouten.com Git - openhab-addons.git/blob
6bfe3ad98b2bbd2c837fa89bd8b35140d6bae03c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.mqtt.homeassistant.internal.component;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.mqtt.generic.values.ImageValue;
17 import org.openhab.binding.mqtt.homeassistant.internal.ComponentChannelType;
18 import org.openhab.binding.mqtt.homeassistant.internal.config.dto.AbstractChannelConfiguration;
19
20 /**
21  * A MQTT camera, following the https://www.home-assistant.io/components/camera.mqtt/ specification.
22  *
23  * At the moment this only notifies the user that this feature is not yet supported.
24  *
25  * @author David Graeff - Initial contribution
26  */
27 @NonNullByDefault
28 public class Camera extends AbstractComponent<Camera.ChannelConfiguration> {
29     public static final String CAMERA_CHANNEL_ID = "camera"; // Randomly chosen channel "ID"
30
31     /**
32      * Configuration class for MQTT component
33      */
34     static class ChannelConfiguration extends AbstractChannelConfiguration {
35         ChannelConfiguration() {
36             super("MQTT Camera");
37         }
38
39         protected String topic = "";
40     }
41
42     public Camera(ComponentFactory.ComponentConfiguration componentConfiguration, boolean newStyleChannels) {
43         super(componentConfiguration, ChannelConfiguration.class, newStyleChannels);
44
45         ImageValue value = new ImageValue();
46
47         buildChannel(CAMERA_CHANNEL_ID, ComponentChannelType.IMAGE, value, getName(),
48                 componentConfiguration.getUpdateListener()).stateTopic(channelConfiguration.topic).build();
49         finalizeChannels();
50     }
51 }