Search in sources :

Example 1 with StateProfile

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

the class CommunicationManager method receiveCommand.

private void receiveCommand(ItemCommandEvent commandEvent) {
    final String itemName = commandEvent.getItemName();
    final Command command = commandEvent.getItemCommand();
    handleEvent(itemName, command, commandEvent.getSource(), s -> acceptedCommandTypeMap.get(s), (profile, thing, convertedCommand) -> {
        if (profile instanceof StateProfile) {
            // 
            safeCaller.create(((StateProfile) profile), StateProfile.class).withAsync().withIdentifier(// 
            thing).withTimeout(// 
            THINGHANDLER_EVENT_TIMEOUT).build().onCommandFromItem(convertedCommand);
        }
    });
}
Also used : Command(org.eclipse.smarthome.core.types.Command) StateProfile(org.eclipse.smarthome.core.thing.profiles.StateProfile)

Example 2 with StateProfile

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

the class CommunicationManager method postCommand.

public void postCommand(ChannelUID channelUID, Command command) {
    final Thing thing = getThing(channelUID.getThingUID());
    handleCallFromHandler(channelUID, thing, profile -> {
        if (profile instanceof StateProfile) {
            ((StateProfile) profile).onCommandFromHandler(command);
        }
    });
}
Also used : StateProfile(org.eclipse.smarthome.core.thing.profiles.StateProfile) Thing(org.eclipse.smarthome.core.thing.Thing)

Example 3 with StateProfile

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

the class CommunicationManager method stateUpdated.

public void stateUpdated(ChannelUID channelUID, State state) {
    final Thing thing = getThing(channelUID.getThingUID());
    handleCallFromHandler(channelUID, thing, profile -> {
        if (profile instanceof StateProfile) {
            ((StateProfile) profile).onStateUpdateFromHandler(state);
        }
    });
}
Also used : StateProfile(org.eclipse.smarthome.core.thing.profiles.StateProfile) Thing(org.eclipse.smarthome.core.thing.Thing)

Aggregations

StateProfile (org.eclipse.smarthome.core.thing.profiles.StateProfile)3 Thing (org.eclipse.smarthome.core.thing.Thing)2 Command (org.eclipse.smarthome.core.types.Command)1