Using Hue Dimmer to brighten and dim light with Node-Red (via Zigbee2mqtt)

Hi !
Just a quick message to thank you for the clear and awesome flows !
I’m just discovering node red, and having already incredible results with my new Philips Hue remote.
Thanks !

1 Like

I just started setting up my logic for the dimmer switch in NodeRED and this topic helps a lot!

I’ve got a question about the press count. I know that Hue recognizes double-click, but the dimmer switch seems to give out only the following states:

  • n_click
  • n_click_up
  • n_hold
  • n_hold_up

(n = button id)

Double-clicks are not recognized as a separate state and usually come in as one event (on rare occasions 2 pop up). Also, there is no msg.data.event.new_state.attributes.counter variable that I could find. Has this changed maybe?

I connected the remote via Zigbee2mqtt, and that had the count. Connecting via the Philips Hue Hub might not - I am not sure!

@MattTheBrofessor can you share the json for your flow? I am looking into the same topic right now and that would totally help me out :slight_smile:

1 Like

@flecmart
I used the example from MattTheBrofessor to build my own dimmerswitch.
On/Off set a fixed brightness and color_temp. With dim and long presses I can adjust brightness and color_temp.

[{"id":"9af1c19c.a6159","type":"mqtt in","z":"539a3525.6fc49c","name":"","topic":"zigbee2mqtt/slaapkamer_dimmer","qos":"2","datatype":"json","broker":"f9ecd49d.268f48","x":170,"y":700,"wires":[["99735d5c.eb1f1"]]},{"id":"99735d5c.eb1f1","type":"switch","z":"539a3525.6fc49c","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"},{"t":"eq","v":"on-press","vt":"str"},{"t":"eq","v":"off-press","vt":"str"},{"t":"eq","v":"on-hold","vt":"str"},{"t":"eq","v":"off-hold","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":370,"y":700,"wires":[["eadf4e3a.e42e7"],["45a5598b.4dbd48"],["f9e64995.fa6e68"],["5a0f97b6.4d8e98"],["563f21dc.55754"],["233a9a14.b18886"]]},{"id":"5a0f97b6.4d8e98","type":"change","z":"539a3525.6fc49c","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"OFF\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":740,"wires":[["6913edee.7943f4","c0dc12af.0ae03","f336c9e0.389948"]]},{"id":"6913edee.7943f4","type":"mqtt out","z":"539a3525.6fc49c","name":"","topic":"zigbee2mqtt/slaapkamer_spot3/set","qos":"","retain":"","broker":"f9ecd49d.268f48","x":1100,"y":800,"wires":[]},{"id":"f9e64995.fa6e68","type":"change","z":"539a3525.6fc49c","name":"on ","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"ON\",\"brightness\":133,\"color_temp\":400}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":700,"wires":[["6913edee.7943f4","f336c9e0.389948","c0dc12af.0ae03"]]},{"id":"c0dc12af.0ae03","type":"mqtt out","z":"539a3525.6fc49c","name":"","topic":"zigbee2mqtt/slaapkamer_spot2/set","qos":"","retain":"","broker":"f9ecd49d.268f48","x":1100,"y":720,"wires":[]},{"id":"f336c9e0.389948","type":"mqtt out","z":"539a3525.6fc49c","name":"","topic":"zigbee2mqtt/slaapkamer_spot1/set","qos":"","retain":"","broker":"f9ecd49d.268f48","x":1100,"y":640,"wires":[]},{"id":"eadf4e3a.e42e7","type":"api-current-state","z":"539a3525.6fc49c","name":"current slpkmr spot","server":"9476b506.f34b38","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x0017880102395e56_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":570,"y":580,"wires":[["6add284a.cea018"]]},{"id":"6add284a.cea018","type":"function","z":"539a3525.6fc49c","name":"+10","func":"newmsg = {};\n\n    brightness = msg.data.attributes.brightness + 10\n\n\nnewmsg.payload =  {\"state\":\"ON\",\"brightness\":brightness} ;\n\nreturn newmsg;","outputs":1,"noerr":0,"x":770,"y":580,"wires":[["6913edee.7943f4","f336c9e0.389948","c0dc12af.0ae03"]]},{"id":"45a5598b.4dbd48","type":"api-current-state","z":"539a3525.6fc49c","name":"current slpkmr spot","server":"9476b506.f34b38","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x0017880102395e56_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":570,"y":640,"wires":[["b939e4e7.d56a28"]]},{"id":"b939e4e7.d56a28","type":"function","z":"539a3525.6fc49c","name":"-10","func":"newmsg = {};\n\n    brightness = msg.data.attributes.brightness - 10\n\n\nnewmsg.payload =  {\"state\":\"ON\",\"brightness\":brightness} ;\n\nreturn newmsg;","outputs":1,"noerr":0,"x":770,"y":640,"wires":[["f336c9e0.389948","c0dc12af.0ae03","6913edee.7943f4"]]},{"id":"1a1ba.1d748e46e","type":"debug","z":"539a3525.6fc49c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":900,"wires":[]},{"id":"563f21dc.55754","type":"api-current-state","z":"539a3525.6fc49c","name":"current slpkmr spot","server":"9476b506.f34b38","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x0017880102395e56_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":570,"y":800,"wires":[["4602c143.30003"]]},{"id":"4602c143.30003","type":"function","z":"539a3525.6fc49c","name":"+50","func":"newmsg = {};\n\n    color_temp = msg.data.attributes.color_temp + 50\n\n\nnewmsg.payload = {\"state\":\"ON\",\"color_temp\":color_temp}\n\nreturn newmsg;","outputs":1,"noerr":0,"x":770,"y":800,"wires":[["1a1ba.1d748e46e","6913edee.7943f4","c0dc12af.0ae03","f336c9e0.389948"]]},{"id":"233a9a14.b18886","type":"api-current-state","z":"539a3525.6fc49c","name":"current slpkmr spot","server":"9476b506.f34b38","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x0017880102395e56_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":570,"y":860,"wires":[["16f149b6.e792a6"]]},{"id":"16f149b6.e792a6","type":"function","z":"539a3525.6fc49c","name":"-50","func":"newmsg = {};\n\n    color_temp = msg.data.attributes.color_temp - 50\n\n\nnewmsg.payload = {\"state\":\"ON\",\"color_temp\":color_temp}\n\nreturn newmsg;","outputs":1,"noerr":0,"x":770,"y":860,"wires":[["f336c9e0.389948","c0dc12af.0ae03","6913edee.7943f4"]]},{"id":"f9ecd49d.268f48","type":"mqtt-broker","z":"","name":"MQTT HA","broker":"172.16.1.123","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9476b506.f34b38","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
2 Likes

I thought i might share my dimmer setup. This turns bedside lifx bulbs on and off and dims them too

[{"id":"242c7d72.2c9cb2","type":"comment","z":"52e6d6ca.2d467","name":"James Bedside Light","info":"","x":320,"y":2140,"wires":[]},{"id":"33f5c29.b14eb3e","type":"api-call-service","z":"52e6d6ca.2d467","name":"James On","server":"9ee46d87.3f71d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.james_bedside_light","data":"{\"brightness_pct\":100,\"kelvin\":3200,\"transition\":0.5}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":950,"y":2060,"wires":[[]]},{"id":"6298a7ea.97d998","type":"api-call-service","z":"52e6d6ca.2d467","name":"James Off","server":"9ee46d87.3f71d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.james_bedside_light","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":950,"y":2300,"wires":[[]]},{"id":"ccba635a.6e964","type":"api-call-service","z":"52e6d6ca.2d467","name":"James On","server":"9ee46d87.3f71d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"{{payload.entity_id}}","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1370,"y":2200,"wires":[[]]},{"id":"deeceae1.be05f8","type":"api-current-state","z":"52e6d6ca.2d467","name":"James","server":"9ee46d87.3f71d","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.james_bedside_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":930,"y":2180,"wires":[["947e250c.bccd28"],[]]},{"id":"947e250c.bccd28","type":"function","z":"52e6d6ca.2d467","name":"increase brightness","func":"varBright = msg.data.attributes.brightness;\nvarEntity = msg.data.entity_id;\nif (varBright < 200) {varBrightness = varBright + 50}\nelse {varBrightness = 254}\nmsg.payload = {\"entity_id\":varEntity}\nmsg.payload.data = {\"brightness\":varBrightness}\nreturn msg;","outputs":1,"noerr":0,"x":1130,"y":2180,"wires":[["ccba635a.6e964"]]},{"id":"3f1d293.c27e4d6","type":"api-current-state","z":"52e6d6ca.2d467","name":"James","server":"9ee46d87.3f71d","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.james_bedside_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":930,"y":2220,"wires":[["78e34ddf.60ffb4"],[]]},{"id":"78e34ddf.60ffb4","type":"function","z":"52e6d6ca.2d467","name":"decrease brightness","func":"varBright = msg.data.attributes.brightness;\nvarEntity = msg.data.entity_id;\nif (varBright > 50) {varBrightness = varBright - 50}\nelse {varBrightness = 1}\nmsg.payload = {\"entity_id\":varEntity}\nmsg.payload.data = {\"brightness\":varBrightness}\nreturn msg;","outputs":1,"noerr":0,"x":1140,"y":2220,"wires":[["ccba635a.6e964"]]},{"id":"4e56a9.0e080958","type":"api-call-service","z":"52e6d6ca.2d467","name":"Cheryl On","server":"9ee46d87.3f71d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.cheryl_bedside_light","data":"{\"brightness_pct\":100,\"kelvin\":3200,\"transition\":0.5}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":940,"y":2100,"wires":[[]]},{"id":"223d2dce.cb5922","type":"api-call-service","z":"52e6d6ca.2d467","name":"Cheryl Off","server":"9ee46d87.3f71d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.cheryl_bedside_light","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":940,"y":2340,"wires":[[]]},{"id":"c36169c8.dd9e18","type":"hue-switch","z":"52e6d6ca.2d467","name":"James Dimmer Switch","bridge":"e81e9b.75df5168","sensorid":"159","skipevents":false,"x":320,"y":2180,"wires":[["1b809f9d.a10a8"]]},{"id":"1b809f9d.a10a8","type":"switch","z":"52e6d6ca.2d467","name":"button switch","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Dim Up","vt":"str"},{"t":"eq","v":"Dim Down","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":540,"y":2180,"wires":[["969eba87.d8024"],["266e6913.c176fe"],["3ea3eda7.f62cc2"],["d1b42a2f.dc11b"]]},{"id":"969eba87.d8024","type":"switch","z":"52e6d6ca.2d467","name":"push type","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"pressed","vt":"str"},{"t":"eq","v":"holded","vt":"str"},{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":740,"y":2100,"wires":[["33f5c29.b14eb3e"],[],["33f5c29.b14eb3e"],["4e56a9.0e080958"]]},{"id":"d1b42a2f.dc11b","type":"switch","z":"52e6d6ca.2d467","name":"push type","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"pressed","vt":"str"},{"t":"eq","v":"holded","vt":"str"},{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":740,"y":2280,"wires":[["6298a7ea.97d998"],[],["6298a7ea.97d998"],["223d2dce.cb5922"]]},{"id":"266e6913.c176fe","type":"switch","z":"52e6d6ca.2d467","name":"push type","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"pressed","vt":"str"},{"t":"eq","v":"holded","vt":"str"},{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":740,"y":2160,"wires":[[],[],["deeceae1.be05f8"],[]]},{"id":"3ea3eda7.f62cc2","type":"switch","z":"52e6d6ca.2d467","name":"push type","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"pressed","vt":"str"},{"t":"eq","v":"holded","vt":"str"},{"t":"eq","v":"short released","vt":"str"},{"t":"eq","v":"long released","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":740,"y":2220,"wires":[[],[],["3f1d293.c27e4d6"],[]]},{"id":"9ee46d87.3f71d","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"e81e9b.75df5168","type":"hue-bridge","z":"","name":"Philips hue","bridge":"192.168.1.5","key":"bzebqVHBEwYSOrxKTGL1Rk2rdHI3O3r3hsatCvJF","interval":"500","disableupdates":false}]
1 Like

Sorry for the late reply. This is the flow for the entire Hue Dimmer Switch

[{"id":"f5060296.38d55","type":"tab","label":"Slaapkamer redundant","disabled":false,"info":""},{"id":"feef0f5d.7aff5","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje aan","server":"ecc3b049.6889d","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.0x00158d0000cb52ce_light\",\"transition\":\"1.5\",\"brightness_pct\":\"5\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1040,"y":20,"wires":[[]]},{"id":"52610c14.659794","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje aan","server":"ecc3b049.6889d","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.0x00158d0000cb52ce_light\",\"transition\":\"1.5\"}","mergecontext":"","output_location":"","output_location_type":"none","x":460,"y":660,"wires":[[]]},{"id":"ff6878a7.ccf2f8","type":"function","z":"f5060296.38d55","name":"functie","func":"newmsg = {};\n\n    brightness = msg.data.attributes.brightness + 30;\n    if (brightness < 30)\n    { msg.payload = \"off\";}\n\n\nnewmsg.payload = { data: {\"brightness\":brightness} };\n\nreturn newmsg;","outputs":1,"noerr":0,"x":790,"y":120,"wires":[["a7bd50d6.1ea68"]]},{"id":"32367f3f.4c83e","type":"api-current-state","z":"f5060296.38d55","name":"","server":"ecc3b049.6889d","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x00158d0000cb52ce_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":120,"wires":[["ff6878a7.ccf2f8"]]},{"id":"a7bd50d6.1ea68","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje iets feller","server":"ecc3b049.6889d","version":"1","debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.0x00158d0000cb52ce_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1020,"y":120,"wires":[[]]},{"id":"88c7a23b.10c6d","type":"server-state-changed","z":"f5060296.38d55","name":"dimmer","server":"ecc3b049.6889d","entityidfilter":"sensor.0x0017880103c88525_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is_not","outputs":1,"output_only_on_state_change":true,"x":70,"y":120,"wires":[["de103be2.f7ace8"]]},{"id":"de103be2.f7ace8","type":"switch","z":"f5060296.38d55","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on-press","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"up-hold","vt":"str"},{"t":"eq","v":"down-press","vt":"str"},{"t":"eq","v":"down-hold","vt":"str"},{"t":"eq","v":"off-press","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":210,"y":120,"wires":[["62146de.a637b94","5b75ea0.566eb18"],["32367f3f.4c83e"],["b16ffc92.8a05f"],["f4c0afab.bad2a"],["2e15335e.745edc"],["52610c14.659794"]]},{"id":"ff074d53.a2f85","type":"function","z":"f5060296.38d55","name":"functie","func":"newmsg = {};\n\n    brightness = msg.data.attributes.brightness - 30;\n    if (brightness < 30)\n    { msg.payload = \"off\";}\n\n\nnewmsg.payload = { data: {\"brightness\":brightness} };\n\nreturn newmsg;","outputs":1,"noerr":0,"x":850,"y":560,"wires":[["872d8d1a.4da6e"]]},{"id":"f4c0afab.bad2a","type":"api-current-state","z":"f5060296.38d55","name":"","server":"ecc3b049.6889d","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x00158d0000cb52ce_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":560,"wires":[["ff074d53.a2f85"]]},{"id":"872d8d1a.4da6e","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje iets minder fel","server":"ecc3b049.6889d","version":"1","debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.0x00158d0000cb52ce_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1080,"y":560,"wires":[[]]},{"id":"7f845019.5312a","type":"function","z":"f5060296.38d55","name":"functie","func":"newmsg = {};\n\n    brightness = msg.data.attributes.brightness + 30;\n    if (brightness < 30)\n    { msg.payload = \"off\";}\n\n\nnewmsg.payload = { data: {\"transition\":\"0.5\",\"brightness\":brightness} };\n\nreturn newmsg;","outputs":1,"noerr":0,"x":810,"y":220,"wires":[["3d5d0710.302888"]]},{"id":"b16ffc92.8a05f","type":"api-current-state","z":"f5060296.38d55","name":"","server":"ecc3b049.6889d","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x00158d0000cb52ce_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":220,"wires":[["7f845019.5312a"]]},{"id":"3d5d0710.302888","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje feller","server":"ecc3b049.6889d","version":"1","debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.0x00158d0000cb52ce_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":220,"wires":[["310c6290.16a62e"]]},{"id":"4bf28790.348178","type":"api-current-state","z":"f5060296.38d55","name":"release","server":"ecc3b049.6889d","outputs":2,"halt_if":"up-hold","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"sensor.0x0017880103c88525_action","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":600,"y":300,"wires":[["b16ffc92.8a05f"],[]]},{"id":"310c6290.16a62e","type":"delay","z":"f5060296.38d55","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":810,"y":300,"wires":[["4bf28790.348178"]]},{"id":"b1c82b96.bc1f98","type":"function","z":"f5060296.38d55","name":"functie","func":"newmsg = {};\n\n    brightness = msg.data.attributes.brightness - 30\n\n\nnewmsg.payload = { data: {\"brightness\":brightness} };\n\nreturn newmsg;","outputs":1,"noerr":0,"x":850,"y":380,"wires":[["16e33313.65e53d"]]},{"id":"2e15335e.745edc","type":"api-current-state","z":"f5060296.38d55","name":"","server":"ecc3b049.6889d","outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x00158d0000cb52ce_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":380,"wires":[["b1c82b96.bc1f98"]]},{"id":"16e33313.65e53d","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje dimmen","server":"ecc3b049.6889d","version":"1","debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.0x00158d0000cb52ce_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1060,"y":380,"wires":[["6d4000ba.87468"]]},{"id":"27596840.378ea8","type":"api-current-state","z":"f5060296.38d55","name":"release","server":"ecc3b049.6889d","outputs":2,"halt_if":"down-hold","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"sensor.0x0017880103c88525_action","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":600,"y":460,"wires":[["2e15335e.745edc"],[]]},{"id":"6d4000ba.87468","type":"delay","z":"f5060296.38d55","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":810,"y":460,"wires":[["27596840.378ea8"]]},{"id":"5b75ea0.566eb18","type":"trigger-state","z":"f5060296.38d55","name":"count 1","server":"ecc3b049.6889d","entityid":"sensor.0x0017880103c88525_action","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"ppttm8q0bzc","targetType":"this_entity","targetValue":"","propertyType":"property","propertyValue":"new_state.attributes.counter","comparatorType":"is","comparatorValueDatatype":"num","comparatorValue":"1"},{"id":"08b8uci5d8s6","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on-press"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":560,"y":20,"wires":[["feef0f5d.7aff5"],[]]},{"id":"62146de.a637b94","type":"trigger-state","z":"f5060296.38d55","name":"count 2","server":"ecc3b049.6889d","entityid":"sensor.0x0017880103c88525_action","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"6v4salc10q4","targetType":"this_entity","targetValue":"","propertyType":"property","propertyValue":"new_state.attributes.counter","comparatorType":"is","comparatorValueDatatype":"num","comparatorValue":"2"},{"id":"hevp4ov57z4","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on-press"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":560,"y":80,"wires":[["6305acc1.c464e4"],[]]},{"id":"6305acc1.c464e4","type":"api-call-service","z":"f5060296.38d55","name":"nachtlampje aan","server":"ecc3b049.6889d","version":0,"service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.0x00158d0000cb52ce_light\",\"transition\":\"1.5\",\"brightness_pct\":\"90\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1040,"y":80,"wires":[[]]},{"id":"ecc3b049.6889d","type":"server","z":"","name":"Home Assistant"}]
1 Like

I have just installed Node Red and the Philips Dimmer. With the 4 buttons I turn 2 zones with lights on and off. So dim buttons turn the lights on and off. I would like to use the hold function to din or brighten the lights. So holding the on button will brighten and the off button will dim. I see the flows but no screenshot of how it looks inside the functions.

You can import the json that was posted into node red to get all the code.

If you’re interested I can share my solution to achieve your use case … I think I slightly modified the solutions posted here. I am not on my PC right now, though.

Woud be great!

I got the following up and running:

I implemented a naming convention so that when I name the switches like the lights that should be controlled by the switch it works automatically, e.g. the switch sensor.0x123..._action_gang controlls my light entity light.gang. The controls are “hue like” so on, off + hold to dim. For me it feels close to the vanilla hue experience.

The json is:

[{"id":"25f5502c.ea631","type":"api-call-service","z":"b43309c5.ca2ca8","name":"Turn On","server":"19b3c48b.589a6b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":720,"y":40,"wires":[[]]},{"id":"6b6e29fa.428e68","type":"api-call-service","z":"b43309c5.ca2ca8","name":"Turn Off","server":"19b3c48b.589a6b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":720,"y":120,"wires":[[]]},{"id":"a952d46c.72e408","type":"api-call-service","z":"b43309c5.ca2ca8","name":"Set brightness","server":"19b3c48b.589a6b","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":740,"y":180,"wires":[[]]},{"id":"b24dcc4f.acde","type":"switch","z":"b43309c5.ca2ca8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on-press","vt":"str"},{"t":"eq","v":"off-press","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"},{"t":"eq","v":"up-hold","vt":"str"},{"t":"eq","v":"down-hold","vt":"str"}],"checkall":"true","repair":true,"outputs":6,"x":290,"y":120,"wires":[["55c22b78.9657c4"],["cfe14fe6.923fa8"],["954bf5ab.cc2de8"],["954bf5ab.cc2de8"],["954bf5ab.cc2de8"],["954bf5ab.cc2de8"]]},{"id":"55c22b78.9657c4","type":"function","z":"b43309c5.ca2ca8","name":"Extract actor","func":"var regex = /sensor.*?_action_(.*)/;\nvar actor = msg.topic.match(regex)[1];\nnode.log(actor)\nmsg.payload = {\n data: { entity_id: 'light.' + actor }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":40,"wires":[["25f5502c.ea631"]]},{"id":"cfe14fe6.923fa8","type":"function","z":"b43309c5.ca2ca8","name":"Extract actor","func":"var regex = /sensor.*?_action_(.*)/;\nvar actor = msg.topic.match(regex)[1];\nnode.log(actor)\nmsg.payload = {\n data: { \n     entity_id: 'light.' + actor, \n     transition: 1\n }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":80,"wires":[["6b6e29fa.428e68"]]},{"id":"954bf5ab.cc2de8","type":"function","z":"b43309c5.ca2ca8","name":"Extract actor & brightness","func":"var regex = /sensor.*?_action_(.*)/;\nvar actor = msg.topic.match(regex)[1];\nmsg.payload = {\n data: { entity_id: 'light.' + actor, brightness: msg.data.new_state.attributes.brightness, transition: 4 }\n};\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":140,"wires":[["a952d46c.72e408"]]},{"id":"adf335f3.9f2f7","type":"server-state-changed","z":"b43309c5.ca2ca8","name":"Dimmer","server":"19b3c48b.589a6b","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.*_action_*","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":130,"y":120,"wires":[["b24dcc4f.acde"]]},{"id":"4ed9a5c6.c73fec","type":"comment","z":"b43309c5.ca2ca8","name":"sensor.*?_action_(.*)","info":"Regex to parse out actor for service calls\n\ne.g. sensor.0x123bla_actor_gang","x":130,"y":80,"wires":[]},{"id":"2178e3fe.25e93c","type":"comment","z":"b43309c5.ca2ca8","name":"Hue Dimmer","info":"Regex to parse out actor for service calls\n\ne.g. sensor.0x123bla_actor_gang","x":110,"y":40,"wires":[]},{"id":"19b3c48b.589a6b","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
2 Likes

Maybe a noob question. But I have 1 Switch with 4 buttons that control 2 area’s.
The on and off button of the switch control area 1 (light kitchen) and the up and down press (dim buttons) control area 2 (lights dining table) This works. Now I want the "hold"function of the buttons dim respectively up and down. So the on-press should brighten and down press should dim.

The switch block distinguishes the different input types:

So if you want to map sth to hold of dim down you would connect it to the last output. I am not sure right now if “on-hold” and “off-hold” are supported, but just try it.

There is no need to check the brightness state of the lights because there are mqtt commands for moving/stepping brightness and color temperature. With this flow I control a ceiling lamp 'Deckenlampe' (which is an mqtt group of 6 hue bulbs 'Deckenlampe [1-6]') with a dimmer switch 'Deckenlampe Dimmer':

[{"id":"9bfc8ef6.375c6","type":"function","z":"9bf7fb6e.7aac88","name":"on-press","func":"const startup_scene = {brightness: 254, color_temp: 370};\nconst additional_scenes = [\n    {brightness: 144, color: {x: 0.5119, y: 0.4147}}, // relax\n    {brightness: 219, color: {x: 0.5119, y: 0.4147}}, // concentrate\n    {brightness: 203, color: {x: 0.368, y: 0.3686}}, // energize\n    {brightness: 240, color: {x: 0.4448, y: 0.4066}} // reading\n] || []; // && to exclude, || to include additional scenes\n\nconst scenes = [\n    startup_scene\n    , ...additional_scenes\n];\n\nvar payload = {state: \"ON\", transition: 0.5};\nif (msg.count > -1) {\n    Object.assign(\n        payload,\n        scenes[msg.count % scenes.length] // round robin\n    );\n}\n\nreturn {payload: payload};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":820,"y":120,"wires":[["336a8b4d.d56504"]]}]

The only thing I need to query the state ('Deckenlampe 1' is the proxy for the group 'Deckenlampe') for is to make the on-press multifunctional. It uses a counter which counts on-press events and is reset to -2 whenever the bulb sends a {state: "OFF"}. This allows to use the first on-press (msg.count increases to -1) to send just {state: "ON"} and then (msg.count increases to 0 and above) does a round-robin over scenes msg.count % scenes.length with every other on-press.

1 Like

Hi @flecmart, thank you for sharing this. I am really new to Home Assistant and this has been really helpful. I had a couple of questions if that’s ok. Can I assume that the brightness is a variable being stored on the Hue dimmer itself? If I was to change the brightness using my Google Home or in Home Assistant, then shouldn’t shouldn’t the variable on the switch be updated to match?

Hi @Disco,

I’m happy to hear my shared code helped out someone! The switch entity in home assistant has a brightness attribute that changes when you hit the two middle buttons:

These attributes are passed in the msg.data.new_state object (you can see the message output with a debug node):

My code just extracts the brightness from msg.data.new_state.attributes.brightness and passes it directly as brightness data to the target bulb. This might not be obvious because when calling light.turn_on the brightness from the payloads data object is set implicitly.

I just tried if the attribute updates when you change the lights’ brightness via home assistant and it does not for me. It seems the switch entity persists its own state. If this is a problem for you, you could just extract the brightness attribute from the bulb and then add or sub a fixed delta to change the brightness (like in some other posts I think). Or you could update the attribute explicitly with another automation :smiley:

1 Like

Thank you @flecmart , I have added a state node which activates when the brightness changes and feeds it back to the dimmer attributes.brightness using the Home Assistant API. Possibly not the most elegant code but it does seem to work.

1 Like

@nikipore sorry to necro this, but would you be able to share the complete flow’s JSON?

Sure, although I thought I already had. The flow has changed somewhat in the meantime, because we moved to a new place, but the core logic remains the same.

[{"id":"7552153.4e951ec","type":"counter","z":"9bf7fb6e.7aac88","name":"Counter","init":"-2","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":600,"y":620,"wires":[["c7844871.e15cf8"]]},{"id":"d2b81a0c.fa4bd8","type":"switch","z":"9bf7fb6e.7aac88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on-press","vt":"str"},{"t":"eq","v":"off-press","vt":"str"},{"t":"regex","v":"(on|off)-hold.*","vt":"str","case":false},{"t":"regex","v":"(up|down)-.*","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":4,"x":530,"y":740,"wires":[["7552153.4e951ec","f6acd4d6f608e575"],["4513a2f6.285aec"],["d82fe7f7.84eb18"],["e956b082.c755c"]]},{"id":"e40533f0.26caf","type":"change","z":"9bf7fb6e.7aac88","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"-2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":620,"wires":[["7552153.4e951ec"]]},{"id":"c7844871.e15cf8","type":"switch","z":"9bf7fb6e.7aac88","name":"ON?","property":"count","propertyType":"msg","rules":[{"t":"gte","v":"-1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":620,"wires":[["ed1d1058.9f5aa"]]},{"id":"ce73a8c4.9f65a8","type":"mqtt in","z":"9bf7fb6e.7aac88","name":"schlafzimmer-dimmer-2","topic":"zigbee2mqtt/schlafzimmer-dimmer-2/action","qos":"2","datatype":"auto","broker":"8932bf10.56a6b","nl":false,"rap":false,"inputs":0,"x":300,"y":780,"wires":[["d2b81a0c.fa4bd8"]]},{"id":"e1275ee5.1664d","type":"mqtt in","z":"9bf7fb6e.7aac88","name":"schlafzimmer-dimmer-1","topic":"zigbee2mqtt/schlafzimmer-dimmer-1/action","qos":"2","datatype":"auto","broker":"8932bf10.56a6b","nl":false,"rap":false,"inputs":0,"x":300,"y":720,"wires":[["d2b81a0c.fa4bd8"]]},{"id":"f6acd4d6f608e575","type":"api-call-service","z":"9bf7fb6e.7aac88","name":"Lichtschalter Schlafzimmer","server":"a0992e23.0acf8","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.licht_schlafzimmer","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":760,"y":700,"wires":[[]]},{"id":"4513a2f6.285aec","type":"function","z":"9bf7fb6e.7aac88","name":"off-press","func":"return {payload: {state: \"OFF\", transition: 0.5}};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1000,"y":740,"wires":[["e91cbd9c.8a503"]]},{"id":"d82fe7f7.84eb18","type":"function","z":"9bf7fb6e.7aac88","name":"(on|off)-hold.*","func":"payload = {\n    \"on-hold\": {color_temp_move: 60},\n    \"off-hold\": {color_temp_move: -60},\n    \"on-hold-release\": {color_temp_move: \"stop\"},\n    \"off-hold-release\": {color_temp_move: \"stop\"}\n}[msg.payload];\n\nreturn {payload: payload};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020,"y":780,"wires":[["e91cbd9c.8a503"]]},{"id":"e956b082.c755c","type":"function","z":"9bf7fb6e.7aac88","name":"(up|down)-.*","func":"payload = {\n    \"up-press\": {brightness_step: 40, transition: 0.5},\n    \"down-press\": {brightness_step: -40, transition: 0.5},\n    \"up-hold\": {brightness_move: 80},\n    \"down-hold\": {brightness_move: -80},\n    \"up-hold-release\": {brightness_move: 0},\n    \"down-hold-release\": {brightness_move: 0}\n}[msg.payload];\n\nreturn {payload: payload};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":820,"wires":[["e91cbd9c.8a503"]]},{"id":"1b5574b7.ab40fb","type":"switch","z":"9bf7fb6e.7aac88","name":"OFF?","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":620,"wires":[["e40533f0.26caf"]]},{"id":"ed1d1058.9f5aa","type":"function","z":"9bf7fb6e.7aac88","name":"on-press","func":"const startup_scene = {brightness: 254, color_temp: 370};\nconst additional_scenes = [\n    {brightness: 254, color: {x: 0.314951744809611, y: 0.325010746064094}, color_temp: 346}, // activate\n    {brightness: 254, color: {x: 0.314951744809611, y: 0.325010746064094}, color_temp: 156}, // reading\n    {brightness: 213, color: {x:0.435684, y: 0.281409}, color_temp: 416}, // spring flowers\n    {brightness: 77, color :{x: 0.458227749642249, y: 0.410224893445347}, color_temp: 367} // dimmed\n] || []; // && to exclude, || to include additional scenes\n\nconst scenes = [\n    startup_scene\n    , ...additional_scenes\n];\n\nvar payload = {state: \"ON\", transition: 0.5};\nif (msg.count > -1) {\n    Object.assign(\n        payload,\n        scenes[msg.count % scenes.length] // round robin\n    );\n}\n\nreturn {payload: payload};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1000,"y":700,"wires":[["e91cbd9c.8a503"]]},{"id":"e91cbd9c.8a503","type":"mqtt out","z":"9bf7fb6e.7aac88","name":"group-schlafzimmer","topic":"zigbee2mqtt/group-schlafzimmer/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"8932bf10.56a6b","x":1300,"y":760,"wires":[]},{"id":"47633ec0.d10ce","type":"mqtt in","z":"9bf7fb6e.7aac88","name":"schlafzimmer-1","topic":"zigbee2mqtt/schlafzimmer-1","qos":"2","datatype":"json","broker":"8932bf10.56a6b","nl":false,"rap":false,"inputs":0,"x":120,"y":620,"wires":[["1b5574b7.ab40fb"]]},{"id":"8932bf10.56a6b","type":"mqtt-broker","name":"","broker":"core-mosquitto","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"a0992e23.0acf8","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

If you have bulbs which support move or step such as hue or tradfri and use mqtt you can call the function direct, this provides a smooth dimmer

https://www.zigbee2mqtt.io/devices/9290012573A.html#philips-9290012573a

The input sets the mqtt topic to the light or light group as required

Hue Button

[{"id":"3bd4aff4eb43e407","type":"server-state-changed","z":"57de1c107950bd0e","name":"Button","server":"c3ff098b2bd1c58b","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.hue_button_office_pendant_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"zigbee2mqtt/Office Pendant/set","valueType":"str"}],"x":250,"y":180,"wires":[["e0f31b9b6a063632"]]},{"id":"e0f31b9b6a063632","type":"switch","z":"57de1c107950bd0e","name":"Button Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"skip_forward","vt":"str"},{"t":"eq","v":"skip_backward","vt":"str"},{"t":"eq","v":"release","vt":"str"}],"checkall":"false","repair":false,"outputs":5,"x":450,"y":180,"wires":[["84b14356933b913b"],["84b14356933b913b"],["30bf8cc1d99b46c2"],["b0d185a3cc7a94c4"],["433aca65efe45f00","08e94fa2558cc7c2"]]},{"id":"84b14356933b913b","type":"mqtt out","z":"57de1c107950bd0e","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"217472f.ad9218e","x":910,"y":160,"wires":[]},{"id":"db676fc3e7dde401","type":"change","z":"57de1c107950bd0e","name":"move up","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": 40}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":220,"wires":[["84b14356933b913b"]]},{"id":"08e94fa2558cc7c2","type":"change","z":"57de1c107950bd0e","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": 0}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":300,"wires":[["84b14356933b913b"]]},{"id":"4ce90364f69e2bce","type":"change","z":"57de1c107950bd0e","name":"move down","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": -40}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":260,"wires":[["84b14356933b913b"]]},{"id":"30bf8cc1d99b46c2","type":"trigger","z":"57de1c107950bd0e","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":220,"wires":[["db676fc3e7dde401"]]},{"id":"b0d185a3cc7a94c4","type":"trigger","z":"57de1c107950bd0e","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":260,"wires":[["4ce90364f69e2bce"]]},{"id":"433aca65efe45f00","type":"change","z":"57de1c107950bd0e","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":280,"wires":[["b0d185a3cc7a94c4","30bf8cc1d99b46c2"]]},{"id":"c3ff098b2bd1c58b","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"},{"id":"217472f.ad9218e","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""}]

Hue Remote

[{"id":"e058bc594eb976be","type":"switch","z":"c9050df8947b405a","name":"Remote Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on-press","vt":"str"},{"t":"eq","v":"off-press","vt":"str"},{"t":"eq","v":"up-press","vt":"str"},{"t":"eq","v":"down-press","vt":"str"},{"t":"eq","v":"up-hold","vt":"str"},{"t":"eq","v":"down-hold","vt":"str"},{"t":"eq","v":"up-hold-release","vt":"str"},{"t":"eq","v":"down-hold-release","vt":"str"}],"checkall":"false","repair":false,"outputs":8,"x":460,"y":280,"wires":[["5cc4ffff1538ab4e"],["e5c30f49bb364323"],["eb9d1af1101236cb"],["a0759c55fd117fb1"],["7d84bc64cace07a9"],["134f64c4be152f86"],["a5796460c770bce2","5977b0de8e160f2f"],["a5796460c770bce2","5977b0de8e160f2f"]]},{"id":"a5796460c770bce2","type":"change","z":"c9050df8947b405a","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":380,"wires":[["134f64c4be152f86","7d84bc64cace07a9"]]},{"id":"e06b791a05bc0e74","type":"server-state-changed","z":"c9050df8947b405a","name":"Remote","server":"c3ff098b2bd1c58b","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.hue_remote_office_pendant_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"zigbee2mqtt/Office Pendant/set","valueType":"str"}],"x":250,"y":280,"wires":[["e058bc594eb976be"]]},{"id":"15a80f62e75be8c7","type":"mqtt out","z":"c9050df8947b405a","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"217472f.ad9218e","x":910,"y":120,"wires":[]},{"id":"7db05c462ac4c968","type":"change","z":"c9050df8947b405a","name":"move up","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": 40}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":260,"wires":[["15a80f62e75be8c7"]]},{"id":"5977b0de8e160f2f","type":"change","z":"c9050df8947b405a","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": 0}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":340,"wires":[["15a80f62e75be8c7"]]},{"id":"e9f63728cfea2b6b","type":"change","z":"c9050df8947b405a","name":"move down","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": -40}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":300,"wires":[["15a80f62e75be8c7"]]},{"id":"7d84bc64cace07a9","type":"trigger","z":"c9050df8947b405a","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":260,"wires":[["7db05c462ac4c968"]]},{"id":"134f64c4be152f86","type":"trigger","z":"c9050df8947b405a","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":300,"wires":[["e9f63728cfea2b6b"]]},{"id":"eb9d1af1101236cb","type":"change","z":"c9050df8947b405a","name":"step up","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_step\": 20}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":180,"wires":[["15a80f62e75be8c7"]]},{"id":"a0759c55fd117fb1","type":"change","z":"c9050df8947b405a","name":"step down","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_step\": -20}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":220,"wires":[["15a80f62e75be8c7"]]},{"id":"5cc4ffff1538ab4e","type":"change","z":"c9050df8947b405a","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"on\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":160,"wires":[["15a80f62e75be8c7"]]},{"id":"e5c30f49bb364323","type":"change","z":"c9050df8947b405a","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"off\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":200,"wires":[["15a80f62e75be8c7"]]},{"id":"c3ff098b2bd1c58b","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"},{"id":"217472f.ad9218e","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""}]

Ikea Remote - zigbee2mqtt group

[{"id":"7b8ac4f0fa238b69","type":"server-state-changed","z":"991971e7601e1b75","name":"Dimmer","server":"c3ff098b2bd1c58b","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.ikea_dimmer_lounge_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"zigbee2mqtt/lounge lights/set","valueType":"str"}],"x":250,"y":200,"wires":[["b78da51c60248898"]]},{"id":"b78da51c60248898","type":"switch","z":"991971e7601e1b75","name":"Dimmer Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"brightness_move_up","vt":"str"},{"t":"eq","v":"brightness_move_down","vt":"str"},{"t":"eq","v":"brightness_stop","vt":"str"}],"checkall":"false","repair":false,"outputs":5,"x":460,"y":200,"wires":[["0c989417c81f1acd"],["0c989417c81f1acd"],["a8891de998438ec5"],["14202a19345858fa"],["08c0ef04b48e83be","1a9944d4a36b0184"]]},{"id":"08c0ef04b48e83be","type":"change","z":"991971e7601e1b75","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":280,"wires":[["a8891de998438ec5","14202a19345858fa"]]},{"id":"0c989417c81f1acd","type":"mqtt out","z":"991971e7601e1b75","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"217472f.ad9218e","x":910,"y":160,"wires":[]},{"id":"fb25ba66a10e49a2","type":"change","z":"991971e7601e1b75","name":"move up","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": 40}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":220,"wires":[["0c989417c81f1acd"]]},{"id":"1a9944d4a36b0184","type":"change","z":"991971e7601e1b75","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": 0}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":300,"wires":[["0c989417c81f1acd"]]},{"id":"02d06e67ef957ec6","type":"change","z":"991971e7601e1b75","name":"move down","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"brightness_move\": -40}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":260,"wires":[["0c989417c81f1acd"]]},{"id":"a8891de998438ec5","type":"trigger","z":"991971e7601e1b75","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":220,"wires":[["fb25ba66a10e49a2"]]},{"id":"14202a19345858fa","type":"trigger","z":"991971e7601e1b75","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":740,"y":260,"wires":[["02d06e67ef957ec6"]]},{"id":"c3ff098b2bd1c58b","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"},{"id":"217472f.ad9218e","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""}]
3 Likes