BACnet/WS  and BACnet/IBM-Watson

Try it your self against a live DINGO setup in our laboratory

Release the power by simplicity

NODE-RED DASHBOARD VIA IBM-WATSON IOT PLATFORM

The DINGO BACnet stack includes an app called "BACnet to IBM Watson Gateway". This easy to configure gateway is used to enable MQTT publishing of BACnet properties to IBM Watson IoT Platform. It also enables commanding from Watson to BACnet devices. Last but not least important, this gateway enables BACnet Web Service requests (BACnet/WS) to be tunneled from Watson to BACnet devices.
 
For further details of how to configure and use this gateway, refer to our recipe at IBM-Watson web site here... 
 

BROWSE OUR BACNET NETWORK

Below is a link to a simple test WEB page. In this simple example you can browse a BACnet network at our laboratory, pick a particular object and subscribe to its COVs (Change Of Value). Try it for example for the temperatures. You can have this web page open at the same time as the dashboard example above and see how those interact with the same physical setup. 
This example explains how easy it is to make a web-page using our BACnet/WS implementation to subscribe to push-notifications from the BACnet network (no polling is used!)

http://labtest.go-iot.io/testclient.htm

If you are a java-script programmer, coding COV subscriptions is relatively easy. Right click somewhere in the test-page (testclient.htm)  and select "View Frame Source". Search for the function:
   CreateSubscribtion(device,object)
Study the code and you will soon find out how things are done.

LEARN BACNET/WS FROM YOUR BROWSER

BACnet/IoT implements the cutting edge BACnet/WS part of the BACnet standard. This is very important for extending BACnet to the world of IoT.

The BACnet/WS module is a free standing software module. It is only needed to be installed on one device (or computer) in the network of devices to be accessed from the LAN or WAN (the Internet). This module does not only enable BACnet/WS access to our DINGO and WINGO products, but also any other BACnet device on the network, from whatever vendor it is.

BACnet/WS is very easy to use. You can actually test it from your browser with URLs like this:
   http://labtest.go-iot.io/bacnetws/.blt?depth=1&alt=json
where ".blt" is a shortcut of ".bacnet/.local/.this" indicating the local device. Notice the ".local" means "the local network" that can be replaced for a network number in a more complex BACnet setup.

This would return this response:
   {"104000":{},"104301":{},"104302":{},"104801":{},"104802":{},"104803":{}}
This is the list of all devices on the local BACnet network.

Then dig deeper and investigate for example device with ID 104301:
Would return this response:
   {"analog-input,48":{},"analog-input,49":{},"device,104301":{},"analog-input,47":{}}
This is the list of all objects in device 104301.

Let us investigate the first object:
The result will be:
   {
      "object-identifier":"analog-input,48",
      "object-name":"blower-temp",
      "object-type":"analog-input",
      "present-value":"20.1875",
      "status-flags":"",
      "event-state":"normal",
      "out-of-service":"false",
      "units":"degrees-celsius",
      "reliability":"no-fault-detected",
      "max-pres-value":"125",
      "min-pres-value":"-55",
      "reliability-evaluation-inhibit":"false",
      "COV-increment":"0"
   }
Those are all the properties in analog-input with ID 48.

Now you can re-poll the temperature very easily:
This will result in the temperature as "plain" text:
   20.3125

ACCESS TREND LOGS USING BACNET/WS

Trend Logging is one of the most important feature in many IoT use-cases. We have specialized in Trend Logging for more than 20 years. Therefore we did not leave it out when it came to our BACnet implementation.
So let us try retrieving some Trend Logs via BACnet/WS. Note that this can also be done via the BACnet to Watson gateway discussed earlier, using the BACnet/WS tunnel.
By browsing the network similarly as shown above, you can soon find some trend log objects. For example there some in device with ID 104000 that log temperatures.
Let us investigate the one that logs the outside temperature, which is trend-log with ID 182:
You should get a list of all it's properties:
   {
      "object-identifier":"trend-log,182",
      "object-name":"tl-outside-temp",
      "object-type":"trend-log",
      "event-state":"normal",
      "status-flags":"",
      "buffer-size":"1000",
      "log-buffer":{},
      "stop-when-full":"false",
      "total-record-count":"171",
      "logging-type":"polled",
      "enable":"true",
      "record-count":"171",
      "description":"TrendLog for DinGo-C inner temperature (the inner 1-Wire sensor)",
      "cov-resubscription-interval":"86400",
      "log-device-object-property":{"object-identifier":"analog-input,49","property-identifier":"present-value","device-identifier":"device,104301"},
      "log-interval":"90000",
      "start-time":"",
      "stop-time":"",
      "align-intervals":"true",
      "interval-offset":"0",
      "trigger":"false"
   }
As you can see there is a lot of properties. Study those and compare to the standard as you like. It is not the intention of this short demo do go into any details here. But in short, this is a an TL object that logs the outside temperature every 15 minutes (at 00:00, 00:15 .... 23:45).
Now let us request for logged data from the log-buffer property. This is done with the BACnet Read Range service, where you can do simple-to-complex queries to retrieve logged time-series data.
The BACnet/WS query below retrieves the first 100 records after 16th Jan. 2017 00:00.
Or as we are dealing with the local device:
The response will be returned:
   {
      "1":{"timestamp":"2017-01-12T13:18:50Z","log-datum":{"log-status":"false,true,false"}},
      "2":{"timestamp":"2017-01-12T13:18:50Z","log-datum":{"log-status":"false,false,true"}},
      "3":{"timestamp":"2017-01-12T13:30:00Z","log-datum":{"real-value":"-6.874"},"status-flags":"false,false,false,false"},
      "4":{"timestamp":"2017-01-12T13:45:00Z","log-datum":{"real-value":"-7.24"},"status-flags":"false,false,false,false"},
      "5":{"timestamp":"2017-01-12T14:00:00Z","log-datum":{"real-value":"-7.4"},"status-flags":"false,false,false,false"},
      "6":{"timestamp":"2017-01-12T14:15:00Z","log-datum":{"real-value":"-7.624"},"status-flags":"false,false,false,false"},
      .....
      "98":{"timestamp":"2017-01-13T22:00:00Z","log-datum":{"real-value":"-13.4"},"status-flags":"false,false,false,false"},
      "99":{"timestamp":"2017-01-13T22:15:00Z","log-datum":{"real-value":"-12.24"},"status-flags":"false,false,false,false"}
   }

WRITING TO BACNET OBJECTS VIA BACNET/WS

As you can't do PUT request from your Web browser, you need tools like Fiddler or Postman app for Google Chrome, to test BACnet/WS write commands. Or you can code your own program.

A typical PUT request to switch a relay would be for example:
http://your-host-or-ip-address/bacnetws/.bacnet/.local/104302/binary-output,176/present-value?priority=8&alt=json

with this payload to switch it off:
   { "$base": "integer", "$value" : "0" }
or this for switching it on:
   { "$base": "integer", "$value" : "1" }
or this for setting at don't care at the given priority in the path (see for example "?priority=8" in the example path above).
   { "$base": "Null" }