Meta Information Management¶
Mortar.io uses reference nodes along with a structured schema to provide a consistent view of devices across disparate sensing systems.
The following is an example Modbus thermostat, describing a few of its transducers as well as their properties, necessary for Modbus communication.
<meta xmlns="http://jabber.org/protocol/mio" name="Wistat" info="Millenial Net Wistat, wireless thermostat." type="Modbus" name="Wistat" timestamp="2014-11-04T01:44:38.439479-0500"> <property name="Address" value="49" /> <transducer type="rssi 2.4Ghz" unit="rssi" name="RSSI"> <property value="204" name="Address"/> <property value="FE2" name="Register Type"/> <property value="8" name="Register Length"/> </transducer> <transducer type="pressure" unit="psi" name="Branch Line Pressure"><property value="58" name="Address"/> <property value="FE2" name="Register Type"/> <property value="8" name="Register Length"/> </transducer> </meta>
In the Mortar.io repository under mio/adapters/meta_tool/ there is a program to generate meta information. It uses the libMIO library to create the device node and populate the information associated with a device. It is relatively easy to add a new device type and there are examples of how to do this in mio/adapters/meta_tool/src/meta_tool.c
> uuid [uuid] > make > ./meta_tool -n [name] -type [type] -id [id] -u [user] -p [pass] -acm [access control] - name - type - [wistat, hue, enfuse_branch, firefly_plug, firefly_sensor, bosch_twist, [uuid]] - id - uuid of event node to create - user - jid of user - pass - password for user - acm - Whitelist or Blacklist
It is also possible to use this tool to copy meta data from one device to another. To do this use the example device uuid as the type. The Example Device view is useful for generating meta information without local configuration files.
To produce a view like this the command line tools found in mio/tools/cmd-line/c/ can be used. First it is necessary to create an event node. Then it is necessary to add the meta item to that event node. Then it is possible to add that event node to a location in the tree.
> mio_node_create -u [user] -event [uuid] -title [name] > mio_meta_add -u [user] -event [uuid] -name [name] -type location > mio_reference_child_add -u [user] -child [uuid] -parent [parent_uuid]