Hue lamp & Xiaomi wall switch

I have a hue lamp which I can manage via alexa or the app and added recently a xiaomi wall switch. The wall switch obviously controls if there is even power available for the hue lamps.

Problem: I want to be able to control the hue lamp on/off state both via alexa as well as pressing the switch (as well as hue?).

Example 1: wall switch is on but hue lamp is off. I can enable the hue lamp via hue app or alexa but not by pressing the switch button.
Example 2: wall switch if off. I can´t use either alexa nor hue app since there is no power. If I press button, power might be on but hue lamp might be still off.

Solution?

  • an alexa command which powers on both switch (if in off state) as well as hue lamp (if in off state)
  • pressing the wall switch button enables power and enables hue lamp (if in off state)

Not sure if this only works via node-red but assume so :slight_smile: How can I get this solved?

I did something similar with smart switches and hue bulbs.

Basically, you’ll probably want to wire the switch up where the power is always on at the bulbs, and control them via Alexa and node-red with the switch.

Here’s how it looks in Node-RED

[{"id":"507ed1dd.265ca","type":"subflow","name":"Grab all zwave commands","info":"","category":"","in":[],"out":[{"x":380,"y":80,"wires":[{"id":"3d43fece.2dd8b2","port":0}]},{"x":360,"y":140,"wires":[{"id":"affc1cce.70b5e","port":0}]}],"env":[]},{"id":"3d43fece.2dd8b2","type":"server-events","z":"507ed1dd.265ca","name":"zwave.scene_activated","server":"26956a45.92d866","event_type":"zwave.scene_activated","x":200,"y":80,"wires":[[]]},{"id":"affc1cce.70b5e","type":"server-events","z":"507ed1dd.265ca","name":"zwave.node_event","server":"26956a45.92d866","event_type":"zwave.node_event","x":190,"y":140,"wires":[[]]},{"id":"236d81db.36d09e","type":"subflow","name":"Kitchen Lights on/off","info":"","category":"","in":[{"x":40,"y":40,"wires":[{"id":"6752b41a.4af2dc"}]}],"out":[],"env":[]},{"id":"6752b41a.4af2dc","type":"switch","z":"236d81db.36d09e","name":"Kitchen Light Switch 1 & 2","property":"payload.event.basic_level","propertyType":"msg","rules":[{"t":"eq","v":"255","vt":"num"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":190,"y":40,"wires":[["a1af3be1.e090f8"],["397964cf.9f009c"]]},{"id":"a1af3be1.e090f8","type":"api-call-service","z":"236d81db.36d09e","name":"Kitchen Lights On","server":"26956a45.92d866","version":1,"service_domain":"light","service":"turn_on","entityId":"group.kitchen_lights","data":"{\"transition\":2,\"brightness_pct\":100,\"rgb_color\":[255,207,120]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":430,"y":20,"wires":[[]]},{"id":"397964cf.9f009c","type":"api-call-service","z":"236d81db.36d09e","name":"Kitchen Lights Off","server":"26956a45.92d866","version":1,"service_domain":"light","service":"turn_off","entityId":"group.kitchen_lights","data":"{\"transition\":3}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":430,"y":80,"wires":[[]]},{"id":"26956a45.92d866","type":"server","z":"","name":"Hass.io","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true},{"id":"56c85dcd.98de44","type":"switch","z":"bccd1f73.5eca","name":"which button?","property":"msg.payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"zwave.switch_kitchen_light_1","vt":"str"},{"t":"eq","v":"zwave.switch_kitchen_light_2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":60,"wires":[["9502d0a0.09b23"],["9502d0a0.09b23"]]},{"id":"9502d0a0.09b23","type":"subflow:236d81db.36d09e","z":"bccd1f73.5eca","name":"Kitchen Lights On / Off","env":[],"x":600,"y":60,"wires":[]},{"id":"d5566ac9.a40488","type":"subflow:507ed1dd.265ca","z":"bccd1f73.5eca","name":"Grab all zwave commands","env":[],"x":150,"y":60,"wires":[["56c85dcd.98de44"],["56c85dcd.98de44"]]},{"id":"8b31a6e0.86ebb8","type":"comment","z":"bccd1f73.5eca","name":"Grab all zwave commands","info":"","x":150,"y":20,"wires":[]}]

I think with some update to the Hue App you now can also save the state with which the lights will turn on if they come back to power. You could use this technique as well.

1 Like

Yep, it’s the power on state. What they do when they get power after an outage. OP needs to set them up to power on at their last state if they go with my suggestion.

Without having to change wires, isn´t is more simple to control everything via the smart switch and leave out Hue commands?

So basically either pressing switch OR telling alexa to turn on or off the xiaomi switch? Instead of alexa doing the command towards Hue?

Just not sure how you can use “turn off lights” towards the switch instead of Hue.