]> git.basschouten.com Git - openhab-addons.git/blob
1ec0ccd960bad41029cd873fcfe944b9ad661ec6
[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.lifx.internal;
14
15 import static org.openhab.binding.lifx.internal.LifxBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.library.CoreItemFactory;
19 import org.openhab.core.thing.Channel;
20 import org.openhab.core.thing.ChannelUID;
21 import org.openhab.core.thing.DefaultSystemChannelTypeProvider;
22 import org.openhab.core.thing.ThingUID;
23 import org.openhab.core.thing.binding.builder.ChannelBuilder;
24 import org.osgi.service.component.annotations.Component;
25
26 /**
27  * The {@link LifxChannelFactoryImpl} creates dynamic LIFX channels.
28  *
29  * @author Wouter Born - Initial contribution
30  */
31 @NonNullByDefault
32 @Component(service = LifxChannelFactory.class)
33 public class LifxChannelFactoryImpl implements LifxChannelFactory {
34
35     @Override
36     public Channel createAbsTemperatureZoneChannel(ThingUID thingUID, int index) {
37         return ChannelBuilder
38                 .create(new ChannelUID(thingUID, CHANNEL_ABS_TEMPERATURE_ZONE + index), CoreItemFactory.NUMBER)
39                 .withType(DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR_TEMPERATURE_ABS).build();
40     }
41
42     @Override
43     public Channel createColorZoneChannel(ThingUID thingUID, int index) {
44         return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_COLOR_ZONE + index), CoreItemFactory.COLOR)
45                 .withType(DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR).build();
46     }
47
48     @Override
49     public Channel createTemperatureZoneChannel(ThingUID thingUID, int index) {
50         return ChannelBuilder.create(new ChannelUID(thingUID, CHANNEL_TEMPERATURE_ZONE + index), CoreItemFactory.DIMMER)
51                 .withType(DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_TYPE_UID_COLOR_TEMPERATURE).build();
52     }
53 }