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