IKEA Symfonisk & Gauges using Deconz-Zigbee

What this Flow Does

This flow shows how to use an IKEA Symfonisk device for user-input within Node-Red.

  • The flow includes 2 different UI-gauges which you can adjust using the Symfonisk dial.
  • You can select which gauge the Symfonisk dial adjusts by single-pressing or double-pressing the top surface of the Symfonisk dial (which acts as a button).
  • You can clear both gauges by triple-pressing the button.
  • You can adjust two program variables in order to fine-tune how quickly the gauges respond to the dial versus how accurately you want to set the gauges.

image

What You Need

Configuring the Flow

image Before you can run the flow, you will need to connect the flow to your Zigbee Adapter and also customize the flow to detect your specific Symfonisk device. To do so:

  • Click on the Zigbee Events node and set up the connections to your Zigbee device. For details, see the Deconz Contrib Node documentation.
  • Use the Log All Events node to find the uniqueid for your Symfonisk device.
  • Rotate the dial, or press the button to trigger an event.
  • In the debug pane, copy the uniqueid value and paste it in the Filter Symfonisk node.

Background on the Symfonisk

The Deconz event node provides 4 types of rotation messages for this device corresponding to start-rotation and stop-rotation events:

  • start-clockwise (3001)
  • stop-clockwise (3003)
  • start-counterclockwise (2001)
  • stop-counterclockwise (2003)

It also provides 3 types of button-press messages corresponding to:

  • single-click (1002)
  • double-click (1004)
  • triple click (1005)

Algorithm Notes

In order to conserve the Symfonisk battery, the device does not provide updates between start-rotation and stop-rotation messages. (Doing so would require repetitive realtime radio messaging.) Consequently, it is up to the message-handling software (in Node-Red) to simulate incremental messages between the start and stop messages. The Master Clock node controls the rate at which these simulated updates occur.

Dial Response/Sensitivity Tradeoffs

Various factors affect how proportionally the UI-Gauge reacts to rotation of the Symfonisk dial. Depending on the performance of your host computer or final use case, you may want to adjust the following parameters.

Minimum Gauge Increment

The min_increment setting is found within the Update Counters node.

  • Set to 1 will enable you to change the gauge slowly, but accurately.
  • Set to 5 (default) will adjust the gauge faster, but by 5 units at a time, so you lose some fine-tuning.

Master Clock Setting

This setting (within a Node-Red interval timer) defaults to sending one message every 100 ms. If you want to adjust the dial by single units (min_increment=1), I use 150ms.

  • In general, if you shorten the master clock time period, the gauge will respond faster, but it will be harder to set single-digit increments on the gauge.
  • If you make the clock setting larger, it will take longer for the gauge to adjust.
[{"id":"effb562c.406f88","type":"function","z":"f910fa30.e6b178","name":"Filter Symfonisk","func":"// Use the \"Log All Events\" node to find the\n// uniqueid for your Symfonisk device and replace\n// the value in the next line.\nif (msg.payload.uniqueid === 'EnterUniqueIdHere' &&  \n    msg.payload.hasOwnProperty('state') )\n// note we are also filtering by 'state' to \n// avoid status messages (battery level, etc)\n{\n    msg.payload = msg.payload.state.buttonevent\n    return msg\n}","outputs":1,"noerr":0,"x":220,"y":400,"wires":[["659f1f5e.da84","11d984eb.75904b"]]},{"id":"a503f154.b1556","type":"comment","z":"f910fa30.e6b178","name":"Symfonisk Demo","info":"","x":220,"y":80,"wires":[]},{"id":"562f4432.2b986c","type":"deconz-event","z":"f910fa30.e6b178","name":"ZigBee Events","server":"fcb95c72.77386","device_name":null,"x":220,"y":200,"wires":[["effb562c.406f88","e83a9b47.f093a8"]]},{"id":"e83a9b47.f093a8","type":"debug","z":"f910fa30.e6b178","name":"Log All Events","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":480,"y":200,"wires":[]},{"id":"11d984eb.75904b","type":"debug","z":"f910fa30.e6b178","name":"Log Symf Events","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":230,"y":440,"wires":[]},{"id":"25443db7.a7dc72","type":"interval","z":"f910fa30.e6b178","name":"Master Clock","interval":"100","onstart":false,"msg":"ping","showstatus":false,"unit":"milliseconds","statusformat":"YYYY-MM-D HH:mm:ss","x":210,"y":620,"wires":[["605deb0f.af1024"]]},{"id":"659f1f5e.da84","type":"switch","z":"f910fa30.e6b178","name":"Route Symf Events","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"3001","vt":"num"},{"t":"eq","v":"3003","vt":"num"},{"t":"eq","v":"2001","vt":"num"},{"t":"eq","v":"2003","vt":"num"},{"t":"eq","v":"1002","vt":"num"},{"t":"eq","v":"1004","vt":"num"},{"t":"eq","v":"1005","vt":"num"}],"checkall":"true","repair":false,"outputs":7,"x":490,"y":400,"wires":[["922707a6.65e368"],["12d45d73.b85cd3"],["3996979d.245298"],["12d45d73.b85cd3"],["70689387.593b4c"],["3820742.72e908c"],["e1c48524.7a8b98"]],"outputLabels":["Start CW","End CW","Start CCW","End CCW","Single-Click","Double-Click","Triple-Click"]},{"id":"922707a6.65e368","type":"function","z":"f910fa30.e6b178","name":"Count Direction = UP","func":"msg.payload = 'UP'\nflow.set('countDir',msg.payload)\nreturn msg","outputs":1,"noerr":0,"x":820,"y":291,"wires":[["85a61f0.09bf6e"]]},{"id":"3996979d.245298","type":"function","z":"f910fa30.e6b178","name":"Count Direction = DOWN","func":"msg.payload = 'DOWN'\nflow.set('countDir',msg.payload)\nreturn msg","outputs":1,"noerr":0,"x":830,"y":331,"wires":[["85a61f0.09bf6e"]]},{"id":"12d45d73.b85cd3","type":"function","z":"f910fa30.e6b178","name":"Count Direction = OFF","func":"msg.payload = 'OFF'\nflow.set('countDir',msg.payload)\nreturn msg","outputs":1,"noerr":0,"x":820,"y":371,"wires":[[]]},{"id":"311f2a35.8acbc6","type":"debug","z":"f910fa30.e6b178","name":"log count","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":460,"y":660,"wires":[]},{"id":"d6c505ea.460178","type":"ui_gauge","z":"f910fa30.e6b178","name":"Symfonisk Gauge A (Donut)","group":"e4c4abb4.f6eb28","order":5,"width":0,"height":0,"gtype":"donut","title":"Symfonisk Gauge A","label":"","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1160,"y":491,"wires":[]},{"id":"605deb0f.af1024","type":"function","z":"f910fa30.e6b178","name":"Update Counters","func":"/*\nMIN_INCREMENT of 1 will allow you to select individual numbers by rotating the dial.\nThis assumes the main timer is sending messages every 150 ms\nYou can raise the MIN_INCREMENT to move the dial faster.\nYou can also shorten the main timer value, but it will be harder to get single-digit increments.\n*/\n\nlet MIN_INCREMENT = 5\nlet selectedCounter = flow.get('selectedCounter') || 'counterA'\n\nlet localCount = flow.get(selectedCounter) || 0\nlet newCount = localCount\nlet localCountDir = flow.get('countDir')\n\nif (localCountDir !== 'OFF') {\n    if (localCountDir === 'UP') {   \n        newCount = localCount + MIN_INCREMENT\n        if (newCount > 100) newCount = 100\n    }\n    else {  // must be DOWN\n        newCount = localCount - MIN_INCREMENT  \n        if (newCount < 0) newCount = 0\n    }\n    flow.set(selectedCounter, newCount )\n    msg.toGauge = selectedCounter\n    msg.payload = newCount\n    node.send(msg)\n}\n\n\n// Note that we are not doing anything with the flow actionState == 'COUNT_OFF' case.\n// This will block incoming messages that don't move the gauge and thus\n// minimize CPU load at the gauge node.\n","outputs":1,"noerr":0,"x":490,"y":620,"wires":[["311f2a35.8acbc6","63b21c9.f56a3e4"]]},{"id":"d351f0cb.bf39","type":"ui_gauge","z":"f910fa30.e6b178","name":"Symfonisk Gauge B (Compass)","group":"e4c4abb4.f6eb28","order":6,"width":0,"height":0,"gtype":"compass","title":"Symfonisk Gauge B","label":"","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1170,"y":626,"wires":[]},{"id":"70689387.593b4c","type":"function","z":"f910fa30.e6b178","name":"1-Click: Use Counter A","func":"flow.set('selectedCounter','counterA')\nmsg.payload = 'A'\nreturn msg","outputs":1,"noerr":0,"x":830,"y":411,"wires":[["71680849.4f1918"]]},{"id":"3820742.72e908c","type":"function","z":"f910fa30.e6b178","name":"2-Clicks: Use Counter B","func":"flow.set('selectedCounter','counterB')\nmsg.payload = 'B'\nreturn msg","outputs":1,"noerr":0,"x":830,"y":451,"wires":[["71680849.4f1918"]]},{"id":"e1c48524.7a8b98","type":"function","z":"f910fa30.e6b178","name":"3-Clicks: Clear Counters","func":"flow.set('counterA',0)\nflow.set('counterB',0)\nmsg.payload = 0\nreturn msg","outputs":1,"noerr":0,"x":830,"y":491,"wires":[["d6c505ea.460178","d351f0cb.bf39"]]},{"id":"63b21c9.f56a3e4","type":"switch","z":"f910fa30.e6b178","name":"Route Counts","property":"toGauge","propertyType":"msg","rules":[{"t":"eq","v":"counterA","vt":"str"},{"t":"eq","v":"counterB","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":620,"wires":[["d6c505ea.460178"],["d351f0cb.bf39"]]},{"id":"7a01cd3c.823284","type":"comment","z":"f910fa30.e6b178","name":"Send Messages","info":"","x":220,"y":660,"wires":[]},{"id":"85d2dff4.4a472","type":"comment","z":"f910fa30.e6b178","name":"count --> flow var & payload","info":"","x":519,"y":580,"wires":[]},{"id":"85a61f0.09bf6e","type":"ui_text","z":"f910fa30.e6b178","group":"e4c4abb4.f6eb28","order":3,"width":0,"height":0,"name":"Show Count Direction","label":"Count:","format":"{{msg.payload}}","layout":"row-center","x":1140,"y":331,"wires":[]},{"id":"5d5203a2.58a4ec","type":"comment","z":"f910fa30.e6b178","name":"Read Me","info":"To get started:\n\n Click on the **Zigbee Events** node and set \n up the connections to your Zigbee device.\n\n Use the **Log All Events** node to find the \n **uniqueid** for your Symfonisk device.   Rotate \n the dial, or press the button to trigger an event.\n In the debug pane, copy the **uniqueid** value \n and paste it in the **Filter Symfonisk** node.\n","x":380,"y":80,"wires":[]},{"id":"71680849.4f1918","type":"ui_text","z":"f910fa30.e6b178","group":"e4c4abb4.f6eb28","order":2,"width":0,"height":0,"name":"Show Active Gauge","label":"Active Gauge:","format":"{{msg.payload}}","layout":"row-center","x":1130,"y":411,"wires":[]},{"id":"af939d07.a36e3","type":"comment","z":"f910fa30.e6b178","name":"Every 100 ms","info":"","x":210,"y":700,"wires":[]},{"id":"e340fa2.91b7608","type":"comment","z":"f910fa30.e6b178","name":"Outputs to Dashboard","info":"","x":1140,"y":200,"wires":[]},{"id":"1f47ab7e.a18a65","type":"comment","z":"f910fa30.e6b178","name":"Set Flow Variables","info":"","x":808.0086669921875,"y":200.00173950195312,"wires":[]},{"id":"fcb95c72.77386","type":"deconz-server","z":"","name":"Phoscon-GW","ip":"EnterIpAddrHere","port":"80","apikey":"EnterApiKeyHere","ws_port":"8088","secure":false,"polling":"5"},{"id":"e4c4abb4.f6eb28","type":"ui_group","z":"","name":"Symfonisk Demo","tab":"ebec71e7.3727d","order":1,"disp":true,"width":"10","collapse":false},{"id":"ebec71e7.3727d","type":"ui_tab","z":"","name":"Symfonisk","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

Flow Info

Created 5 years, 7 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x7)
  • debug (x3)
  • function (x8)
  • switch (x2)
Other

Tags

  • IKEA
  • Symfonisk
  • Zigbee
  • Deconz
  • Conbee
  • Tradfri
  • Gauge
  • Button
  • Dial
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option