Hello, very good.
Thanks
However, have another problem.
I want to use a Hue button. This sends on / off when pressed short and 7x when pressed long:
{"action": "brightness_step_down", "action_step_size":56, "action_transition_time":0.09, "battery":100, "linkquality":184, "update":{"state": "idle"}}
and then 7x:
{"action": "brightness_step_up", "action_step_size":56, "action_transition_time":0.09, "battery":100, "linkquality":176, "update":{"state": "idle"}}
I would now have to convert that to a number to use it in the range note.
can you help me?
this is my current flow:
[{"id":"a2bf2f3b856e78ce","type":"zigbee2mqtt-in","z":"9f99ca32053f4cbc","name":"","server":"d6cb6dc92f386f45","friendly_name":"Hue Button Eingang (8718699693985)","device_id":"0x001788010b9e79cd","state":"0","outputAtStartup":true,"filterChanges":false,"enableMultiple":false,"x":210,"y":580,"wires":[["7964a7baf35fe47d","0ad97dc951627dc9","8e16961b96f59bab","29758a7b242b91da","e6db9b14d30d0182","c5b68bbd5c0393d2","a34afd0535fa2e5e","5d74de45213046b7","a49969938d6fa737","82148a40083d5e14","cee28066583e072c"]]},{"id":"c1969e6d8543fc89","type":"debug","z":"9f99ca32053f4cbc","name":"debug1 Eingang","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1240,"y":560,"wires":[]},{"id":"ce5ff6b23ddbd4c2","type":"change","z":"9f99ca32053f4cbc","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":400,"wires":[["357897046eec06bf"]]},{"id":"a72784568d2591d9","type":"change","z":"9f99ca32053f4cbc","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":460,"wires":[["357897046eec06bf"]]},{"id":"0645040ae3e82553","type":"debug","z":"9f99ca32053f4cbc","name":"battery","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":760,"y":840,"wires":[]},{"id":"310b55c74de48dc3","type":"debug","z":"9f99ca32053f4cbc","name":"linkquality","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":760,"y":940,"wires":[]},{"id":"e3feae99b0ccaf18","type":"debug","z":"9f99ca32053f4cbc","name":"update.state","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":770,"y":1040,"wires":[]},{"id":"cee28066583e072c","type":"debug","z":"9f99ca32053f4cbc","name":"debug1 Eingang","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":200,"y":660,"wires":[]},{"id":"ca1f337c61f78d56","type":"debug","z":"9f99ca32053f4cbc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":660,"wires":[]},{"id":"85caf099dbc67c55","type":"debug","z":"9f99ca32053f4cbc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":720,"wires":[]},{"id":"6225976d81eeaa78","type":"debug","z":"9f99ca32053f4cbc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.action","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":780,"wires":[]},{"id":"7964a7baf35fe47d","type":"switch","z":"9f99ca32053f4cbc","name":"on","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":400,"wires":[["ce5ff6b23ddbd4c2"]]},{"id":"0ad97dc951627dc9","type":"switch","z":"9f99ca32053f4cbc","name":"off","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":460,"wires":[["a72784568d2591d9"]]},{"id":"29758a7b242b91da","type":"switch","z":"9f99ca32053f4cbc","name":"brightness_step_up","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"brightness_step_up","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":550,"y":600,"wires":[["c083d85267f2aab5"]]},{"id":"8e16961b96f59bab","type":"switch","z":"9f99ca32053f4cbc","name":"brightness_step_down","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"brightness_step_down","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":560,"y":520,"wires":[["87df7aea839d9b49"]]},{"id":"c5b68bbd5c0393d2","type":"switch","z":"9f99ca32053f4cbc","name":"release","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"release","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":520,"y":720,"wires":[["f130d463eef53457"]]},{"id":"e6db9b14d30d0182","type":"switch","z":"9f99ca32053f4cbc","name":"press","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"press","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":660,"wires":[["9fdd61a7cf140602"]]},{"id":"a34afd0535fa2e5e","type":"switch","z":"9f99ca32053f4cbc","name":"hold","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"hold","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":780,"wires":[["cf5cdd4d8fef0b42"]]},{"id":"9fdd61a7cf140602","type":"change","z":"9f99ca32053f4cbc","name":"press","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.action","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":660,"wires":[["ca1f337c61f78d56"]]},{"id":"f130d463eef53457","type":"change","z":"9f99ca32053f4cbc","name":"release","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.action","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":720,"wires":[["85caf099dbc67c55"]]},{"id":"cf5cdd4d8fef0b42","type":"change","z":"9f99ca32053f4cbc","name":"hold","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.action","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":780,"wires":[["6225976d81eeaa78"]]},{"id":"a49969938d6fa737","type":"change","z":"9f99ca32053f4cbc","name":"linkquality","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.linkquality","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":940,"wires":[["310b55c74de48dc3","f118a41a7e4942d8"]]},{"id":"82148a40083d5e14","type":"change","z":"9f99ca32053f4cbc","name":"update.state","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.update.state","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":1040,"wires":[["e3feae99b0ccaf18"]]},{"id":"5d74de45213046b7","type":"change","z":"9f99ca32053f4cbc","name":"battery","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.battery","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":840,"wires":[["0645040ae3e82553","5d008cc57fae3e99"]]},{"id":"87df7aea839d9b49","type":"function","z":"9f99ca32053f4cbc","name":"","func":"\n//msg.payload = \"step down \" + msg.payload*-1;\nlet step = msg.payload.action_step_size*-1;\nlet t =msg.payload.action_transition_time;\nmsg.payload = {\"brightness_step_onoff\":-36};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":760,"y":520,"wires":[["e21ebe14b9f39926"]]},{"id":"c083d85267f2aab5","type":"function","z":"9f99ca32053f4cbc","name":"","func":"//msg.payload = \"step down \" + msg.payload*-1;\nlet step = msg.payload.action_step_size;\nlet t = msg.payload.action_transition_time;\nmsg.payload = {\"brightness_step_onoff\":36};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":760,"y":600,"wires":[["e21ebe14b9f39926"]]},{"id":"e21ebe14b9f39926","type":"function","z":"9f99ca32053f4cbc","name":"Step","func":"return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":560,"wires":[["c1969e6d8543fc89"]]},{"id":"357897046eec06bf","type":"ui_switch","z":"9f99ca32053f4cbc","name":"Eingang On / Off","label":"Eingang ","tooltip":"","group":"b39a769e1a5ab2d0","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"ON","onvalueType":"str","onicon":"fa-2x fa-toggle-on","oncolor":"red","offvalue":"OFF","offvalueType":"str","officon":"fa-2x fa-toggle-off","offcolor":"green","animate":true,"className":"","x":990,"y":280,"wires":[["77a55f8e37d0061a"]]},{"id":"77a55f8e37d0061a","type":"function","z":"9f99ca32053f4cbc","name":"ON/OFF","func":"return{payload:{\"state\": msg.payload}};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1220,"y":280,"wires":[[]]},{"id":"46512a4130ee641d","type":"inject","z":"9f99ca32053f4cbc","name":"ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":710,"y":260,"wires":[["357897046eec06bf"]]},{"id":"e03ea086dc262180","type":"inject","z":"9f99ca32053f4cbc","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":710,"y":300,"wires":[["357897046eec06bf"]]},{"id":"f118a41a7e4942d8","type":"ui_text","z":"9f99ca32053f4cbc","group":"3463b2b4d95822f5","order":5,"width":0,"height":0,"name":"linkquality","label":"linkquality","format":"{{msg.payload}} unit","layout":"row-spread","className":"","x":760,"y":1000,"wires":[]},{"id":"5d008cc57fae3e99","type":"ui_text","z":"9f99ca32053f4cbc","group":"3463b2b4d95822f5","order":3,"width":0,"height":0,"name":"battery","label":"Battery","format":"{{msg.payload}} %","layout":"row-spread","className":"","x":760,"y":900,"wires":[]},{"id":"d6cb6dc92f386f45","type":"zigbee2mqtt-server","name":"","host":"localhost","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","mqtt_qos":"0","tls":"","usetls":false,"base_topic":"zigbee2mqtt"},{"id":"b39a769e1a5ab2d0","type":"ui_group","name":"Dimmer","tab":"c7e50f4d.33f09","order":4,"disp":true,"width":"6","collapse":false,"className":""},{"id":"3463b2b4d95822f5","type":"ui_group","name":"hue button entrance","tab":"b881d91c.f73d98","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"c7e50f4d.33f09","type":"ui_tab","name":"Switches","icon":"mi-toggle_on","order":2,"disabled":false,"hidden":false},{"id":"b881d91c.f73d98","type":"ui_tab","name":"Status","icon":"dashboard","order":4,"disabled":false,"hidden":false}]