Tutorial: switching a relay over LoRaWAN via the NKE In’O and the thingsHub platform
Wiring your NKE In’O with your industrial systems
The IN'O sensor incorporates 10 digital inputs, and 4 optocoupled outputs. It also includes an external antenna.
The level or a counter can be transferred to the different inputs. It is also possible to get the voltage of the power supply, and to switch ON, OFF or toggle the outputs.
The cable clamps terminals "Outputs" must be used for wiring with the industrial equipment.
For the wiring of the device please have a look at the following help page of the device manufacturer:
https://support.nke-watteco.com/ino-2/#InstallationAndUse
Configure your NKE In’O device with thingsHub
When you use the device in the factory state for the first time, it behaves according to the following default configuration (see Default Configuration NKE Support Page):
The device reports each day the counter value associated to input 1+/1- (EndPoint 0 / Cluster Binary Input / Attribute Count).
The device reports the state of input 2+/2- at each variation with a hysteresis of 2 hours (Endpoint 1 / Cluster Binary Input /Attribute Present Value).
Since it can be assumed that this configuration often does not match your device cabling, all settings must be deleted in the first step.
Assign the latest thingsHub device driver
To use the functionalities shown here, you should assign the latest thingsHub device driver to your device.
To do this, update the available device drivers of your thingsHub instance (Devices > Device Driver > click on "Download latest drivers from Drivers Database").
You can then assign the driver “smartmakers/nke-ino“ using the Floating Tag “3 (Recommended Version)” to the device.
Turn on device and reset all device settings (remove default reports)
To start up the device, a magnet must be placed next to the sensor for one second (to the left of the cable gland). The red LED blinks quickly during this step. After one second, the red LED stops blinking and the green LED blinks slowly until the association is done.
After switching on, the device sends ten messages over ten minutes to be configured. If the device has already been switched on, this mode can be reactivated by the magnet. Please refer to the manufacturer's documentation.
Please send the following downlink via port 125 using the "Send Downlink" function on the device detail page in thingsHub:
115000500203
The “Send Downlink” button an be found within the “Network” tab.
After the downlink have been successfully schedule with your LoRaWAN network server the network table will show the downlink as the first entry:
Configure Output 1 from your NKE In’O device in thingsHub
Enter the following JSON configuration into the text field “Desired Configuration” which can be found under the tab "Configuration":
{
"on_off": {
"0": {
"on": {
"standard_config": {
"maximum_reporting_interval": "60s",
"minimum_reporting_interval": "5s",
"reportable_change": true
},
"value": true
}
}
}
}
What does this configuration do in detail?
“on_off”: It does configure the “Output 1+/1” which is endpoint “0” from the “On/Off Clusters”. See screenshot from the NKE documentation on the right.
Via the "standard_config" you tell the device to send the current On/Off state from Output 1 at least every sixty seconds ("maximum_reporting_interval": "60s"). Or simply put, that device will send the respective status of the Output 1 state at regular intervals of sixty seconds.
Via the property “reportable_change”: true it was also set that the device reports a external change of the state at least after five seconds ("minimum_reporting_interval": "5s").
“value”: true switches the connected relay to the "Off" switching state.
Several downlinks will be generated which have to be sent to the device.
Depending on the device configuration this can take up some time.
Verify that the configuration has been fully applied to the device
Via the "Known State & Configuration" you can see whether all configurations have been successfully applied by the device.
Before a device configuration has been applied, the "Known State" shows a "{}". This means that no information has yet been received from the device regarding its configuration. Or in even simpler words: the device configuration is unknown or not set.
After the device has applied all configuration messages, the “Known State & Configuration” looks like this:
If a configuration is missing even after a long wait: Simply click the "Save Configuration" button again to resend the downlinks of the configuration aspects that are still missing to the device.
Switching the connected relay to “On” or “Off”
By changing the device configuration, the switching state of the connected relay can now be changed very easily. To do this, you only have to set the "value"attribute to true or false.
Switch Relay on Output 1 to the “OFF” State
Change the “value” property to true:
{
"on_off": {
"0": {
"on": {
"standard_config": {
"maximum_reporting_interval": "60s",
"minimum_reporting_interval": "5s",
"reportable_change": true
},
"value": true
}
}
}
}
Switch Relay on Output 1 to the “ON” State
Change the “value” property to false:
{
"on_off": {
"0": {
"on": {
"standard_config": {
"maximum_reporting_interval": "60s",
"minimum_reporting_interval": "5s",
"reportable_change": true
},
"value": false
}
}
}
}
Use thingsHub Action button to switch the relay
With thingsHub 4.7 so-called "actions" will further simplify the interaction with the device. The outputs of the NKE IN´o can be switched even more easily via “On” and "Off" buttons per Output in the user interface. See the wireframe below: