配置网关
双击knx节点,然后界面如下图所示,点击笔,对knx网关进行配置,目前只支持knx-ip方式。建议使用IP-Router方式,更加稳定。
如第二图所示,直接添加即可。其他选项可自行看英文,一个是绑定端口(有线还是无线),一个是填写物理地址。
开关灯
首先,在左端节点窗口,拉出两个inject节点,然后将类型分别改为(布尔类型)true和false并且修改knx节点为其填写组地址以及DPT类型,将这两个的节点输出分别与knx节点的输入相连,然后界面右上角点击部署即可,点击ture节点旁边的按钮即可开灯,同理点击false即可关灯。如下图所示
案例,可复制下面的代码,然后点击界面右上角的菜单选择导入。
[{"id":"4c3af1c6.55c05","type":"tab","label":"流程2","disabled":false,"info":""},{"id":"c2597a0f.0b31c8","type":"knxUltimate","z":"4c3af1c6.55c05","server":"7521b5a9.475d8c","topic":"1/1/1","dpt":"1.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"客厅灯","outputtype":"write","outputRBE":true,"inputRBE":false,"x":590,"y":280,"wires":[[]]},{"id":"1e12e804.dde6e8","type":"inject","z":"4c3af1c6.55c05","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":300,"y":240,"wires":[["c2597a0f.0b31c8"]]},{"id":"e3c0c222.db961","type":"inject","z":"4c3af1c6.55c05","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":300,"y":320,"wires":[["c2597a0f.0b31c8"]]},{"id":"7521b5a9.475d8c","type":"knxUltimate-config","z":"","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false}]
监听总线消息
从左侧节点窗口,选中一个Debug节点然后放在KNX节点后面,链接起来。KNX节点配置方式如下图。
案例
[{"id":"4c3af1c6.55c05","type":"tab","label":"流程2","disabled":false,"info":""},{"id":"2cd32db0.c579a2","type":"knxUltimate","z":"4c3af1c6.55c05","server":"7521b5a9.475d8c","topic":"","dpt":"","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"","outputtype":"write","outputRBE":false,"inputRBE":false,"x":510,"y":380,"wires":[["746b8271.d0ef3c"]]},{"id":"746b8271.d0ef3c","type":"debug","z":"4c3af1c6.55c05","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":380,"wires":[]},{"id":"7521b5a9.475d8c","type":"knxUltimate-config","z":"","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false}]
这样就可以在调试窗口看到KNX总线上的消息。
读取组地址消息
经过前两个案例的操练,相信大家都会基本的编程了,所以接下来我只贴案例代码,就不说废话了。。。
案例:读取组地址
[{"id":"8b01792e.d96df8","type":"function","z":"4c3af1c6.55c05","name":"Read Request","func":"return ({\n readstatus: true,\n knx: {\n destination: \"0/0/1\"}\n });","outputs":1,"noerr":0,"x":480,"y":660,"wires":[["49eeedea.ed2e54"]]},{"id":"37f44414.2bd1cc","type":"inject","z":"4c3af1c6.55c05","name":"Trigger","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":660,"wires":[["8b01792e.d96df8"]]},{"id":"49eeedea.ed2e54","type":"knxUltimate","z":"4c3af1c6.55c05","server":"b544c131.fab4","topic":"","dpt":"1.001","initialread":false,"notifyreadrequest":true,"notifyresponse":true,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"","listenallga":true,"name":"All","outputtype":"write","outputRBE":false,"inputRBE":false,"x":640,"y":660,"wires":[["c96a5f6f.1828b"]]},{"id":"c96a5f6f.1828b","type":"debug","z":"4c3af1c6.55c05","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":660,"wires":[]},{"id":"b544c131.fab4","type":"knxUltimate-config","z":"","host":"224.0.23.12","port":"3671","physAddr":"1.1.2","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\"Attuatori luci\"\t\"\"\t\"Auto\"\n\"Luci primo piano\"\t\"0/0/-\"\t\"\"\t\"\"\t\"Luci primo piano\"\t\"\"\t\"Auto\"\n\"Camera da letto luce\"\t\"0/0/1\"\t\"\"\t\"\"\t\"Camera da letto luce\"\t\"DPST-1-8\"\t\"Auto\"\n\"Loggia camera da letto\"\t\"0/0/2\"\t\"\"\t\"\"\t\"Loggia camera da letto\"\t\"DPST-1-1\"\t\"Auto\"\n\"Camera armadi luce\"\t\"0/0/3\"\t\"\"\t\"\"\t\"Camera armadi luce\"\t\"DPST-1-1\"\t\"Auto\"\n\"Bagno grande luce\"\t\"0/0/4\"\t\"\"\t\"\"\t\"Bagno grande luce\"\t\"DPST-1-1\"\t\"Auto\"\n\"Loggia bagno grande\"\t\"0/0/5\"\t\"\"\t\"\"\t\"Loggia bagno grande\"\t\"DPST-1-1\"\t\"Auto\"\n\"Bagno grande specchio (switch)\"\t\"0/0/6\"\t\"\"\t\"\"\t\"Bagno grande specchio switch\"\t\"DPST-1-1\"\t\"Auto\"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":true}]
由于我这里没有设备,所以读出来的结果都是null
将日期发到KNX总线上
这里实现的是,每隔一分钟将当前日期发送到KNX总线上。
[{"id":"6438a82a.39d168","type":"knxUltimate","z":"4c3af1c6.55c05","server":"7521b5a9.475d8c","topic":"2/2/2","dpt":"11.001","initialread":false,"notifyreadrequest":false,"notifyresponse":true,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"日期","outputtype":"write","outputRBE":true,"inputRBE":false,"x":720,"y":660,"wires":[["dc21a7f8.cb75b8"]]},{"id":"7521b5a9.475d8c","type":"knxUltimate-config","z":"","host":"224.0.23.12","port":"3671","physAddr":"15.15.22","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false}]
将当前时间发送到总线上
这个跟上面的案例基本一样,只需要把DPT类型改为10.001即可。大家可以尝试自己做一下。
今天就到这里了,有问题的小伙伴可以评论留言哦(⊙o⊙)