Insteon Keypad + Phillips Hue

This is not the same problem as the Manual Trigger detection solves, though clearly you can solve it with that DP.

The problem is that you need to synchronize the state of the keypad with the state of the bulb. You actually don’t care where the event came from in this case, just that the two Items are out of sync.

When one of the two Items changes state, all you need to do is check to see if the other one is already in the same state and send the command to it if it doesn’t. If they are already of the same state do nothing, which kills the loop.

rule "Keypad D changed"
when
    Item EntryKeypadD changed
then
    if(previousState == NULL) return; // don't do anything if the change was from NULL

    if(FrontTableLamp_Brightness.getStateAs(OnOffType) != EntryKeypadD.state) { // you can get the state of a Dimmer as if it were a Switch
        FrontTableLamp_Brightness.sendCommand(EntryKeypadD.state)  // you can send Switch commands to Dimmers
    }
end

rule "Front Table Lamp changed"
when
    Item FrontTableLamp_Brightness changed
then
    if(previousState == NULL) return;

    if(EntryKeypadD.state != FrontTableLamp_Brightness.state) {
        EntryKeypadD.sendCommand(FrontTableLamp_Brightness.getStateAs(OnOffType))
    }
end

Theory of operation:
If the keypad changes state and the new state doesn’t match the lamp’s state send the new state as a command to the lamp. If the keypad and lamp are already of the same state then do nothing.

If the lamp changes state and the new state doesn’t match the keypad’s state, send the new state as the command to the lamp. If the lamp and the keypad are already of the same state then do nothing.