IOLincOnOffCommandHandler(DeviceFeature f) { super(f); }
@Override
public void handleCommand(InsteonPLMBindingConfig conf, Command cmd, InsteonDevice dev) {
try {
if (cmd == OnOffType.ON) {
Msg m = dev.makeStandardMessage((byte) 0x0f, (byte) 0x11, (byte) 0xff);
dev.enqueueMessage(m, m_feature);
logger.info("IOLincOnOffCommandHandler: sent msg to switch {} on", dev.getAddress());
} else if (cmd == OnOffType.OFF) {
Msg m = dev.makeStandardMessage((byte) 0x0f, (byte) 0x13, (byte) 0x00);
dev.enqueueMessage(m, m_feature);
logger.info("IOLincOnOffCommandHandler: sent msg to switch {} off", dev.getAddress());
}
// This used to be configurable, but was made static to make
// the architecture of the binding cleaner.
int delay = 2000;
delay = Math.max(1000, delay);
delay = Math.min(10000, delay);
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Msg m = m_feature.makePollMsg();
InsteonDevice dev = m_feature.getDevice();
if (m != null) dev.enqueueMessage(m, m_feature);
}
}, delay);
} catch (IOException e) {