Search in sources :

Example 1 with TriggerProfile

use of org.eclipse.smarthome.core.thing.profiles.TriggerProfile in project smarthome by eclipse.

the class CommunicationManager method receiveTrigger.

private void receiveTrigger(ChannelTriggeredEvent channelTriggeredEvent) {
    final ChannelUID channelUID = channelTriggeredEvent.getChannel();
    final String event = channelTriggeredEvent.getEvent();
    final Thing thing = getThing(channelUID.getThingUID());
    handleCallFromHandler(channelUID, thing, profile -> {
        if (profile instanceof TriggerProfile) {
            ((TriggerProfile) profile).onTriggerFromHandler(event);
        }
    });
}
Also used : ChannelUID(org.eclipse.smarthome.core.thing.ChannelUID) TriggerProfile(org.eclipse.smarthome.core.thing.profiles.TriggerProfile) Thing(org.eclipse.smarthome.core.thing.Thing)

Example 2 with TriggerProfile

use of org.eclipse.smarthome.core.thing.profiles.TriggerProfile in project smarthome by eclipse.

the class RawButtonToggleSwitchProfileTest method testSwitchItem.

@Test
public void testSwitchItem() {
    TriggerProfile profile = new RawButtonToggleSwitchProfile(mockCallback);
    verifyAction(profile, UnDefType.NULL, OnOffType.ON);
    verifyAction(profile, OnOffType.ON, OnOffType.OFF);
    verifyAction(profile, OnOffType.OFF, OnOffType.ON);
}
Also used : TriggerProfile(org.eclipse.smarthome.core.thing.profiles.TriggerProfile) Test(org.junit.Test)

Example 3 with TriggerProfile

use of org.eclipse.smarthome.core.thing.profiles.TriggerProfile in project smarthome by eclipse.

the class RawButtonToggleSwitchProfileTest method testColorItem.

@Test
public void testColorItem() {
    TriggerProfile profile = new RawButtonToggleSwitchProfile(mockCallback);
    verifyAction(profile, UnDefType.NULL, OnOffType.ON);
    verifyAction(profile, HSBType.WHITE, OnOffType.OFF);
    verifyAction(profile, HSBType.BLACK, OnOffType.ON);
}
Also used : TriggerProfile(org.eclipse.smarthome.core.thing.profiles.TriggerProfile) Test(org.junit.Test)

Aggregations

TriggerProfile (org.eclipse.smarthome.core.thing.profiles.TriggerProfile)3 Test (org.junit.Test)2 ChannelUID (org.eclipse.smarthome.core.thing.ChannelUID)1 Thing (org.eclipse.smarthome.core.thing.Thing)1