Hue, Multiple Bulbs, Multiple Switches

We have a Vera system (which we are about to change to OH) which currently operates grouped Hue bulbs with 2-way and 3-way switches (ex., a group of lights in the kitchen is controlled but the switch at the hall door OR the switch at the living room door).

The typical problem with these “smart lights” is that the hubby turns the light on with the Hue app, the wife turns the light off with the wall switch, the Hue app then doesn’t work because the power to the bulb is off, the hubby tells the wife she can’t use the switch, the wife tells the hubby his smart stuff is stupid…

Our way of dealing with this was to wire the lights directly from the house so there is always power at the bulb and install smart switches with power to the switch but no power out. So if you push the switch to ON or some dimmer level the switch tells Vera to set the bulb to ON or to the same dimmer level as the switch. I didn’t think of this at the time but I guess a better way of handling it would be to wire the smart switch normally and have the system just set the light level to 0 without cutting the power, when it’s turned off.

In the case of the 2-way & 3-way switches we have a rule to set the light level indicated after any of the switches changes and then change the value of the other switches to the first switch. This is so you can turn the lights on with one switch and then go turn them off with another.

I assume that this will take some scripting, as it did with Vera (through the excellent Reactor plugin).

I am hoping that someone has already cracked this nut and has somewhere at least for me to start?

I found that this is pretty simple using Blockly except that I think I need a timer for a delay before setting the levels of the other switch(es) which Blockly doesn’t yet support. It’s easy enough just to have a rule for each switch though so that works for now.

Here is the rule code for anyone it may help:

  - id: "1"
      itemName: Dimmer1
    type: core.ItemStateChangeTrigger
conditions: []
  - inputs: {}
    id: "2"
      blockSource: >-
        <xml xmlns=""><block
        type="oh_event" id="G:(MN$]~wi95iJ],!S}/" x="124" y="245"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="Qd1wvFb^gA6%`BVCjzlH"><field
        name="TEXT">value</field></shadow><block type="oh_getitem_state"
        id="w6mMdk7--V^0EqdLUkqa"><value name="itemName"><shadow type="oh_item"
        name="itemName"><shadow type="oh_item" id="!ax%zbKn{HMrDO8d7}!?"><field
        type="oh_event" id="h$Bre*L.m#pCX$=v]t}P"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="?5RFVA39xXTCc[`Yucgl"><field name="TEXT">
                    </field></shadow><block type="oh_getitem_state" id="K2./Q-kG6n%Da+aj?X~e"><value name="itemName"><shadow type="oh_item" id="V@#iBEd96[SRP6qr#8YJ"><field name="itemName">Dimmer1</field></shadow></value></block></value><value name="itemName"><shadow type="oh_item" id="i5C+N3;8FUraisJ70w1e"><field name="itemName">Dimmer2</field></shadow></value></block></next></block></xml>
      type: application/javascript
      script: >

        events.sendCommand('Dimmer2', itemRegistry.getItem('Dimmer1').getState());
    type: script.ScriptAction