Sample Scene Node - Supergiovane/node-red-contrib-knx-ultimate GitHub Wiki

SCENE CONTROLLER NODE SAMPLES

The scene controller works like a real KNX scene controller.
It can Recall a pre-defined scene, either via a value received from a KNX Bus, or via message flow.
It can Save a scene as well, by reading the values of KNX devices and saving it to a file. The "Save scene" can be triggered either via a value received from a KNX Bus, or via message flow.

Use of stand alone scene controller

Remember: You should normally use the datapoint 18.001 to handle scenes (for example using payload: {save_recall:0, scenenumber:1} to recall scene number 1 and {save_recall:1, scenenumber:1} to save scene number 1). But you can trigger a scene with any datapoint. For example to trigger a scene or save a scene via a DIM command, put in the scene recall or scene save trigger value, the correct object for dimming ({decr_incr:1,data:5} for dim increase, {decr_incr:0,data:5} for dim decrease)
The scene node saves the updated values of all actuators belonging to the scene.


Copy this code and paste it into your flow

[{"id":"ed211117.1dfac","type":"knxUltimateSceneController","z":"9bb22276bd7cda31","server":"67308f4f.15f4e8","name":"Recall: Gira pushbutton 1/Save: MDT tastsensor 2","outputtopic":"","topic":"0/0/7","dpt":"18.001","topicTrigger":"{save_recall:0, scenenumber:1}","topicSave":"0/0/8","dptSave":"18.001","topicSaveTrigger":"{save_recall:1, scenenumber:1}","propertyType":{},"rules":[{"topic":"0/1/1","devicename":"Table licht","dpt":"1.001","send":"true"},{"topic":"wait","devicename":"Wait 10 seconds. (s=second, m=minute, h=hour)","dpt":"1.001","send":"5s"},{"topic":"0/1/22","devicename":"Licht Kuche brightness value","dpt":"5.001","send":"70"}],"x":270,"y":260,"wires":[["7e65bfe1.c34ac8"]]},{"id":"7e65bfe1.c34ac8","type":"debug","z":"9bb22276bd7cda31","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":530,"y":260,"wires":[]},{"id":"aeea8d70.9331a","type":"comment","z":"9bb22276bd7cda31","name":"Stand alone scene controller, fully working.","info":"","x":240,"y":220,"wires":[]},{"id":"67308f4f.15f4e8","type":"knxUltimate-config","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","hostProtocol":"Multicast","suppressACKRequest":false,"csv":"\"Group name\"\t\"Address\"\t\"Central\"\t\"Unfiltered\"\t\"Description\"\t\"DatapointType\"\t\"Security\"\n\"Attuatori luci\"\t\"0/-/-\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"Auto\"\n\"Luci primo piano\"\t\"0/0/-\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"Auto\"\n\"Luce camera da letto\"\t\"0/0/1\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-8\"\t\"Auto\"\n\"Luce loggia camera da letto\"\t\"0/0/2\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce camera armadi\"\t\"0/0/3\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce bagno grande\"\t\"0/0/4\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce loggia bagno grande\"\t\"0/0/5\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce specchio bagno grande (switch)\"\t\"0/0/6\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce lavanderia\"\t\"0/0/7\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce specchio lavanderia (switch)\"\t\"0/0/8\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce studio\"\t\"0/0/9\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false,"stopETSImportIfNoDatapoint":"skip","loglevel":"error","name":"Multicast Gateway","localEchoInTunneling":true,"delaybetweentelegrams":"50","delaybetweentelegramsfurtherdelayREAD":"1","ignoreTelegramsWithRepeatedFlag":false,"keyringFileXML":"","autoReconnect":"yes"}]

Stand alone scene controller, plus control via message flow and manually store an actuator's value

Remember: You should normally use the datapoint 18.001 to handle scenes (for example using payload: {save_recall:0, scenenumber:1} to recall scene number 1 and {save_recall:1, scenenumber:1} to save scene number 1). But you can trigger a scene with any datapoint. For example to trigger a scene or save a scene via a DIM command, put in the scene recall or scene save trigger value, the correct object for dimming ({decr_incr:1,data:5} for dim increase, {decr_incr:0,data:5} for dim decrease)

The scene node already saves the updated values of all actuators belonging to the scene. Sometimes it is useful to be able to save the current value of a group address that is different from the one entered in the scene, as the real value of the scene actuator. For example, a shutter actuator usually has a command group address and a status one. The node saves the scene by taking command group address values, which may not be aligned with the true state value. However, you can work around this by manually updating the command group address value, taking it from the status group address. Think this: if you have a blind actuator, having a group address for move, a group address for step, a group address for absolute height etc... the only group address knowing the exact position of the blind, is the absolute height value status group address.
With this status group address, you can update the command group addresses of the blind actuators belonging to the scene.


Copy this code and paste it into your flow

[{"id":"ed211117.1dfac","type":"knxUltimateSceneController","z":"b5c421076be75f7f","server":"67308f4f.15f4e8","name":"Recall: Gira pushbutton 1/Save: MDT tastsensor 2","outputtopic":"","topic":"0/0/7","dpt":"18.001","topicTrigger":"{save_recall:0, scenenumber:1}","topicSave":"0/0/8","dptSave":"18.001","topicSaveTrigger":"{save_recall:1, scenenumber:1}","propertyType":{},"rules":[{"topic":"0/1/1","devicename":"Table licht","dpt":null,"send":"true"},{"topic":"wait","devicename":"Waits 4 minutes (s=seconds, m=minute, h=hour)","dpt":null,"send":"4m"},{"topic":"0/1/22","devicename":"Licht Kuche brightness value","dpt":null,"send":"70"}],"x":610,"y":260,"wires":[["7e65bfe1.c34ac8"]]},{"id":"7e65bfe1.c34ac8","type":"debug","z":"b5c421076be75f7f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":870,"y":260,"wires":[]},{"id":"1545cdc3.fb4baa","type":"inject","z":"b5c421076be75f7f","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":240,"wires":[["a530b939.63497"]]},{"id":"a530b939.63497","type":"function","z":"b5c421076be75f7f","name":"Recall","func":"msg.recallscene=true;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":240,"wires":[["ed211117.1dfac"]]},{"id":"adc44bc0.d07bd8","type":"function","z":"b5c421076be75f7f","name":"Save","func":"msg.savescene=true;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":280,"wires":[["ed211117.1dfac"]]},{"id":"7cc52443.c559c4","type":"inject","z":"b5c421076be75f7f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":80,"y":280,"wires":[["adc44bc0.d07bd8"]]},{"id":"aeea8d70.9331a","type":"comment","z":"b5c421076be75f7f","name":"Other than KNX Bus Telegram trigger, you can also trigger the Recall and Save by a flow message.","info":"","x":340,"y":200,"wires":[]},{"id":"af84c3d3.aca22","type":"function","z":"b5c421076be75f7f","name":"Store actuator's value","func":"// This is optional. Values are updated automatically, but\n// if you wish to manually change a value, you can use this msg\nmsg.savevalue = true; \nmsg.topic = \"0/0/22\";\nmsg.payload = 30;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":380,"wires":[["ed211117.1dfac"]]},{"id":"84621f6f.4b30e8","type":"inject","z":"b5c421076be75f7f","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":380,"wires":[["af84c3d3.aca22"]]},{"id":"fde7141597eb5dd3","type":"comment","z":"b5c421076be75f7f","name":"This is optional, because the values in the scene actuators are updated automatically.","info":"","x":300,"y":340,"wires":[]},{"id":"67308f4f.15f4e8","type":"knxUltimate-config","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","hostProtocol":"Multicast","suppressACKRequest":false,"csv":"\"Group name\"\t\"Address\"\t\"Central\"\t\"Unfiltered\"\t\"Description\"\t\"DatapointType\"\t\"Security\"\n\"Attuatori luci\"\t\"0/-/-\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"Auto\"\n\"Luci primo piano\"\t\"0/0/-\"\t\"\"\t\"\"\t\"\"\t\"\"\t\"Auto\"\n\"Luce camera da letto\"\t\"0/0/1\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-8\"\t\"Auto\"\n\"Luce loggia camera da letto\"\t\"0/0/2\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce camera armadi\"\t\"0/0/3\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce bagno grande\"\t\"0/0/4\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce loggia bagno grande\"\t\"0/0/5\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce specchio bagno grande (switch)\"\t\"0/0/6\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce lavanderia\"\t\"0/0/7\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce specchio lavanderia (switch)\"\t\"0/0/8\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"\n\"Luce studio\"\t\"0/0/9\"\t\"\"\t\"\"\t\"\"\t\"DPST-1-1\"\t\"Auto\"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false,"stopETSImportIfNoDatapoint":"skip","loglevel":"error","name":"Multicast Gateway","localEchoInTunneling":true,"delaybetweentelegrams":"50","delaybetweentelegramsfurtherdelayREAD":"1","ignoreTelegramsWithRepeatedFlag":false,"keyringFileXML":"","autoReconnect":"yes"}]
⚠️ **GitHub.com Fallback** ⚠️