Data mappings enable the integration of external data sources into Custom Overlays. By reading external files, such as JSON files, at regular intervals, the Custom Overlay can be automatically updated. Below is an example that illustrates how to integrate an external data point.
Code Example
{ "data-adapters": [ { "mappings": { "external_value": "external_value" }, "update-interval": 2, "name": "datamapping", "type": "json", "url": "file:\/\/\/datamapping.txt" } ], "components": [ { "insets": { "bottom": 0, "top": 0, "left": 0, "right": 0 }, "w": 250, "h": 50, "font": { "name": ".AppleSystemUIFont", "size": 40 }, "x": 25, "outline-width": -1, "y": 25, "draws-background": true, "hidden-when-empty": false, "metadata-value": { "prefix": "External: ", "accepts-number": true, "key": "external_value", "type": "number", "accepts-string": true, "retain-previous-on-empty": true, "minimum-integer-digits": 0, "maximum-integer-digits": 42, "minimum-fraction-digits": 0, "maximum-fraction-digits": 1 }, "background-colour": { "r": 0, "b": 0, "g": 0, "a": 0.5 }, "type": "text", "outline-colour": { "r": 0, "b": 0, "g": 0, "a": 1 }, "alpha": 1, "alignment": 1, "layer": 1, "hidden": false, "text-colour": { "r": 1, "b": 1, "g": 1, "a": 1 } } ], "async-data-updates": false }
External File (datamapping.txt)
{ "external_value": 17}
Result
Start:
{ "external_value": 17}
Value Change:
{ "external_value": 11}
Download
The example JSON code can be downloaded here.