Bulk update of BACnet property DeviceNumber
-
System: Mango Automation 2.8.8 running on Debian 4.9
We have a system logging around 1700 data points via BACnet. Recently the device numbers of the BACnet devices changed while the data points registered in Mango Automation retained the old numbers. This is not an ideal situation, but we can't change that. We do know how to map the old to the new numbers, but the question is how we could update it in bulk without manually editing each data point individually in the interface of MA.
We previously have done something similar to update templates of data points. What we did was to directly write in the database of MA, for example setting all occurences of a certain template to a new one. For this specifically we also had to apply the template to all linked data points in the interface by updating it. Now for updating the device numbers we thought to do something similar, but we can't figure out where the information for the BACnet module is stored.
In the table
dataPoint
there is a BLOB fielddata
and looking at the content in a hex editor does reveal some information on the BACnet properties of that data point. However this is not in a format where we could just run a SQLUPDATE
query to set all occurences of one device number to another one.Is there a way to bulk update data points in regards to the BACnet device number? We really would like to avoid editing each data point manually.
-
We have since figured out a way to do this: Turns out there is an API in the version we're using and with a bit of poking around we figured out how to use the API. So what we're doing is simply running a script once, that fetches all data points, maps the old to the new device number and writes back the changed data point information.
This is good because we can reuse the general structure of that script to perform other bulk updates, like the template update, and can avoid the interface, which is painful to use over a mobile connection.
-
@etienne-ott glad you got it sorted. The API can indeed be a very good way to do these sort of updates. For future reference, you can also export the data points as JSON, manipulate it, and reimport it.