KNX / MQTT Client Gateway
To access HSYCO Manager open a browser and type the URL:
https://192.168.1.50/hsycoserver/manager
The IP address and the URLKey written above are the default ones
Add a KNX I/O Server
Follow these steps of this tutorial:
Check the connection status
1. Let’s now check the connection status of the KNX I/O server we just added. Go back to the Manager splash screen and click on Status Browser.
2. Click the "Filter" field to search for the connection datapoint.
3. Click on the settings icon.
4. If the datapoint ‘knx.connection’ is equal to ‘online,’ this means that the KNX I/O servers is successfully connected to HSYCO.
MQTT CLient I/O Server declaration
1. Go back to the Manager splash screen, click on Settings then I/O Servers
2. Click on + to add a new I/O server.
3. Click the type input field.
4. Type "mqttc"
5. Select MQTTCLIENT.
6. Assign ad unique name to the I/O server.
7. For example type: "mqttc"
8. Specify the IP address of the MQTT broker.
9. For example: "192.168.1.45"
10. Specify the TCP port of the MQTT broker.
11. Type "1883"
12. Click on the user input field
13. Assign the username for authentication with MQTT broker, for example: "test"
14. Click the password field.
15. Assign the password for authentication with MQTT broker, for example: "test"
16. Click "Confirm"
17. Click "Apply & restart"
EVENTS scripting
1. From the Manager splash screen select Code Editor.
2. Click "New Events File"
3. Give a name to your script, for example: "gateway.txt"
4. Click "New File"
5. Now it's time to write some lines of code.
For further information about the logic of EVENTS programming, read EVENTS programming quickstart
Let's start with some simple functions:
#when KNX group 1/2/3 changes its value to 1 publish a topic
io knx.1/2/3 = 1 : io mqttc.publish./my-topic/output1/val = 1
#when KNX group 4/5/6 changes its value publish a topic passing the same value as argument
io knx.4/5/6 : io mqttc.publish./my-topic/output2/val = io knx.4/5/6
#when the mqtt client receive a message set the KNX group 7/8/9 to 1
io mqttc.received./my-topic/output1/val = on : io knx.7/8/9 = 1
Click ‘Save’ in the upper right corner to activate this script.
The complete list of all the datapoints generated by an I/O Server is available in the Integrations section.
You can use Javascript as well:
function IOEvent(name, value) : {
//copy the status of KNX groups to a mqtt topic
if (name.startsWith("knx.")){
//knx.x/y/z = <val>
var knxgroup = name.split(".")[1];
ioSet("mqttc.publish./my-topic/"+knxgroup, value);
}
}