Search in sources :

Example 21 with Bridge

use of org.eclipse.smarthome.core.thing.Bridge in project smarthome by eclipse.

the class TunableWhiteThingHandler method dispose.

@Override
public void dispose() {
    if (channels.size() != 0) {
        channels.get(0).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_CW));
        channels.get(1).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_WW));
    }
    Bridge bridge = getBridge();
    if (bridge != null) {
        DmxBridgeHandler bridgeHandler = (DmxBridgeHandler) bridge.getHandler();
        if (bridgeHandler != null) {
            bridgeHandler.unregisterDmxChannels(this.thing);
            logger.debug("removing {} channels from {}", channels.size(), this.thing.getUID());
        }
    }
    channels.clear();
    currentValues.clear();
}
Also used : ChannelUID(org.eclipse.smarthome.core.thing.ChannelUID) DmxBridgeHandler(org.eclipse.smarthome.binding.dmx.internal.DmxBridgeHandler) Bridge(org.eclipse.smarthome.core.thing.Bridge)

Example 22 with Bridge

use of org.eclipse.smarthome.core.thing.Bridge in project smarthome by eclipse.

the class ChaserThingHandlerTest method initialize.

private void initialize() {
    chaserThing = ThingBuilder.create(THING_TYPE_CHASER, "testchaser").withLabel("Chaser Thing").withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).withChannel(ChannelBuilder.create(CHANNEL_UID_SWITCH, "Switch").withType(SWITCH_CHANNEL_TYPEUID).build()).build();
    chaserThingHandler = new ChaserThingHandler(chaserThing) {

        @Override
        @Nullable
        protected Bridge getBridge() {
            return bridge;
        }
    };
    initializeHandler(chaserThingHandler);
}
Also used : Configuration(org.eclipse.smarthome.config.core.Configuration) ChaserThingHandler(org.eclipse.smarthome.binding.dmx.handler.ChaserThingHandler) Nullable(org.eclipse.jdt.annotation.Nullable) Bridge(org.eclipse.smarthome.core.thing.Bridge)

Example 23 with Bridge

use of org.eclipse.smarthome.core.thing.Bridge in project smarthome by eclipse.

the class ColorThingHandlerTest method setUp.

@Before
public void setUp() {
    super.setup();
    thingProperties = new HashMap<>();
    thingProperties.put(CONFIG_DMX_ID, TEST_CHANNEL_CONFIG);
    thingProperties.put(CONFIG_DIMMER_FADE_TIME, TEST_FADE_TIME);
    thingProperties.put(CONFIG_DIMMER_TURNONVALUE, "255,128,0");
    dimmerThing = ThingBuilder.create(THING_TYPE_COLOR, "testdimmer").withLabel("Dimmer Thing").withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_R, "Brightness R").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_G, "Brightness G").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_B, "Brightness B").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_COLOR, "Color").withType(COLOR_CHANNEL_TYPEUID).build()).build();
    dimmerThingHandler = new ColorThingHandler(dimmerThing) {

        @Override
        @Nullable
        protected Bridge getBridge() {
            return bridge;
        }
    };
    initializeHandler(dimmerThingHandler);
}
Also used : ColorThingHandler(org.eclipse.smarthome.binding.dmx.handler.ColorThingHandler) Configuration(org.eclipse.smarthome.config.core.Configuration) Nullable(org.eclipse.jdt.annotation.Nullable) Bridge(org.eclipse.smarthome.core.thing.Bridge) Before(org.junit.Before)

Example 24 with Bridge

use of org.eclipse.smarthome.core.thing.Bridge in project smarthome by eclipse.

the class TunableWhiteThingHandlerTest method setUp.

@Before
public void setUp() {
    super.setup();
    thingProperties = new HashMap<>();
    thingProperties.put(CONFIG_DMX_ID, TEST_CHANNEL_CONFIG);
    thingProperties.put(CONFIG_DIMMER_FADE_TIME, TEST_FADE_TIME);
    thingProperties.put(CONFIG_DIMMER_TURNONVALUE, "127,127");
    dimmerThing = ThingBuilder.create(THING_TYPE_TUNABLEWHITE, "testdimmer").withLabel("Dimmer Thing").withBridge(bridge.getUID()).withConfiguration(new Configuration(thingProperties)).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS, "Brightness").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_CW, "Brightness CW").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_BRIGHTNESS_WW, "Brightness WW").withType(BRIGHTNESS_CHANNEL_TYPEUID).build()).withChannel(ChannelBuilder.create(CHANNEL_UID_COLOR_TEMP, "Color temperature").withType(COLOR_TEMPERATURE_CHANNEL_TYPEUID).build()).build();
    dimmerThingHandler = new TunableWhiteThingHandler(dimmerThing) {

        @Override
        @Nullable
        protected Bridge getBridge() {
            return bridge;
        }
    };
    initializeHandler(dimmerThingHandler);
}
Also used : TunableWhiteThingHandler(org.eclipse.smarthome.binding.dmx.handler.TunableWhiteThingHandler) Configuration(org.eclipse.smarthome.config.core.Configuration) Nullable(org.eclipse.jdt.annotation.Nullable) Bridge(org.eclipse.smarthome.core.thing.Bridge) Before(org.junit.Before)

Example 25 with Bridge

use of org.eclipse.smarthome.core.thing.Bridge in project smarthome by eclipse.

the class HueLightHandler method initialize.

@Override
public void initialize() {
    logger.debug("Initializing hue light handler.");
    Bridge bridge = getBridge();
    initializeThing((bridge == null) ? null : bridge.getStatus());
}
Also used : HueBridge(org.eclipse.smarthome.binding.hue.internal.HueBridge) Bridge(org.eclipse.smarthome.core.thing.Bridge)

Aggregations

Bridge (org.eclipse.smarthome.core.thing.Bridge)26 Configuration (org.eclipse.smarthome.config.core.Configuration)9 ChannelUID (org.eclipse.smarthome.core.thing.ChannelUID)9 BaseThingHandler (org.eclipse.smarthome.core.thing.binding.BaseThingHandler)9 ThingHandler (org.eclipse.smarthome.core.thing.binding.ThingHandler)9 DmxBridgeHandler (org.eclipse.smarthome.binding.dmx.internal.DmxBridgeHandler)7 Nullable (org.eclipse.jdt.annotation.Nullable)6 Thing (org.eclipse.smarthome.core.thing.Thing)6 BaseDmxChannel (org.eclipse.smarthome.binding.dmx.internal.multiverse.BaseDmxChannel)5 Semaphore (java.util.concurrent.Semaphore)3 ValueSet (org.eclipse.smarthome.binding.dmx.internal.ValueSet)3 BaseBridgeHandler (org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler)3 Command (org.eclipse.smarthome.core.types.Command)3 JavaOSGiTest (org.eclipse.smarthome.test.java.JavaOSGiTest)3 Before (org.junit.Before)3 Test (org.junit.Test)3 HueBridge (org.eclipse.smarthome.binding.hue.internal.HueBridge)2 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1