Hue Switch to Node Red

Hi I am looking at the new Hue switch integrations and how these can be incorporated into my NodeRed flows.

Creating an integration from the UI gives me:

- id: '1587301575266'
  alias: Living Room Lights off
  description: ''
  trigger:
  - device_id: 37773551a2534e0ebaf49b7d488a9252
    domain: hue
    platform: device
    subtype: turn_off
    type: remote_button_short_release
  condition: []
  action:
  - data: {}
    entity_id: switch.living_room_smart_plug_switch
    service: switch.turn_off

I dont see how I can translate this to node red?

Install Hue-Magic (node-red-contrib-huemagic)

hue-dimmer

Node red example:

[{"id":"fea8be82.95c39","type":"hue-switch","z":"1261a8fc.1b3db7","name":"Hue dimmer switch 1","bridge":"9a0eee70.7f2ee","sensorid":"35","skipevents":false,"x":140,"y":180,"wires":[["1bdad97e.cf0107"]]},{"id":"1bdad97e.cf0107","type":"switch","z":"1261a8fc.1b3db7","name":"Button","property":"payload.button","propertyType":"msg","rules":[{"t":"regex","v":"100\\d","vt":"str","case":false},{"t":"regex","v":"200\\d","vt":"str","case":false},{"t":"regex","v":"300\\d","vt":"str","case":false},{"t":"regex","v":"400\\d","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":4,"x":330,"y":180,"wires":[["c089f40a.b854c8"],["ad8812f6.6de71"],["f3aa1b26.54dee8"],["ac5b29e5.45c308"]]},{"id":"c089f40a.b854c8","type":"switch","z":"1261a8fc.1b3db7","name":"B1 -  action","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"},{"t":"eq","v":"holded","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":530,"y":100,"wires":[[],[],[]]},{"id":"ad8812f6.6de71","type":"switch","z":"1261a8fc.1b3db7","name":"B2 - action","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"},{"t":"eq","v":"holded","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":530,"y":160,"wires":[[],[],[]]},{"id":"f3aa1b26.54dee8","type":"switch","z":"1261a8fc.1b3db7","name":"B3 - action","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"},{"t":"eq","v":"holded","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":530,"y":220,"wires":[[],[],[]]},{"id":"ac5b29e5.45c308","type":"switch","z":"1261a8fc.1b3db7","name":"B4 - action","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"},{"t":"eq","v":"holded","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":530,"y":280,"wires":[[],[],[]]},{"id":"9a0eee70.7f2ee","type":"hue-bridge","z":"","name":"Philips hue","bridge":"192.168.86.46","key":"gEOTCeAVSzZnj2jTSsn5Qw3QMhi6PDaeCiTtz570","interval":"2000","disableupdates":false}]

Thats worked perfectly. I have integrated the hue switch into my lighting state machine flows.

1 Like

I realised the button name is returned, so you can update the first switch to “== On, == Off… etc.” instead of using regex as I did.