Search in sources :

Example 1 with OMaticChannel

use of org.openhab.binding.omatic.internal.OMaticChannel in project omatic by seaside1.

the class OMaticMachineThingHandler method handleCommand.

@Override
public void handleCommand(ChannelUID channelUID, Command command) {
    logDebug("Handling command = {} for channel = {}", command.getClass(), channelUID);
    String channelId = channelUID.getIdWithoutGroup();
    OMaticChannel channel = OMaticChannel.fromString(channelId);
    if (command instanceof RefreshType) {
        refreshChannel(channel, channelId);
        return;
    }
    if (command instanceof OnOffType) {
        updateOnOffChannel(channel, channelId, (OnOffType) command);
        return;
    }
}
Also used : OnOffType(org.openhab.core.library.types.OnOffType) RefreshType(org.openhab.core.types.RefreshType) OMaticChannel(org.openhab.binding.omatic.internal.OMaticChannel)

Example 2 with OMaticChannel

use of org.openhab.binding.omatic.internal.OMaticChannel in project omatic by seaside1.

the class OMaticMachineThingHandler method refreshChannels.

private void refreshChannels() {
    if (getThing().getStatus() == ONLINE) {
        for (Channel channel : getThing().getChannels()) {
            ChannelUID channelUID = channel.getUID();
            String channelId = channelUID.getIdWithoutGroup();
            OMaticChannel omaticChannel = OMaticChannel.fromString(channelId);
            refreshChannel(omaticChannel, channelId);
        }
    }
}
Also used : ChannelUID(org.openhab.core.thing.ChannelUID) Channel(org.openhab.core.thing.Channel) OMaticChannel(org.openhab.binding.omatic.internal.OMaticChannel) OMaticChannel(org.openhab.binding.omatic.internal.OMaticChannel)

Aggregations

OMaticChannel (org.openhab.binding.omatic.internal.OMaticChannel)2 OnOffType (org.openhab.core.library.types.OnOffType)1 Channel (org.openhab.core.thing.Channel)1 ChannelUID (org.openhab.core.thing.ChannelUID)1 RefreshType (org.openhab.core.types.RefreshType)1