Following on from Timβs post: π Automation usage report via API
I thought i would show it in action, with a quick Node-Red dashboard:
[
{
"id": "c7ce10626e5537ee",
"type": "http request",
"z": "78b72c8c92ed429f",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://api.tapeapp.com/v1/automation-usage-report?limit=60&interval_resolution=hourly",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Authorization",
"keyValue": "",
"valueType": "other",
"valueValue": "${tape_api}"
}
],
"x": 270,
"y": 160,
"wires": [
[
"069bb31918f8dfc6",
"fecfd311674defeb"
]
]
},
{
"id": "565711f82fb0a1dd",
"type": "debug",
"z": "78b72c8c92ed429f",
"name": "debug 2",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 140,
"wires": []
},
{
"id": "1b1c371548799418",
"type": "inject",
"z": "78b72c8c92ed429f",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "3600",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 90,
"y": 160,
"wires": [
[
"c7ce10626e5537ee"
]
]
},
{
"id": "5a5093580f73c27c",
"type": "change",
"z": "78b72c8c92ed429f",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.usage_reports.{\t \"time\": $toMillis($replace(from, \" \", \"T\")),\t \"actions\": num_consumed_actions\t}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 560,
"y": 260,
"wires": [
[
"565711f82fb0a1dd",
"a1bcd98d93842418"
]
]
},
{
"id": "069bb31918f8dfc6",
"type": "debug",
"z": "78b72c8c92ed429f",
"name": "debug 5",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 450,
"y": 100,
"wires": []
},
{
"id": "fecfd311674defeb",
"type": "json",
"z": "78b72c8c92ed429f",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 380,
"y": 260,
"wires": [
[
"5a5093580f73c27c"
]
]
},
{
"id": "a1bcd98d93842418",
"type": "ui-chart",
"z": "78b72c8c92ed429f",
"group": "70681439ce6137b1",
"name": "",
"label": "Actions",
"order": 9007199254740991,
"chartType": "line",
"category": "",
"categoryType": "none",
"xAxisLabel": "Hours",
"xAxisProperty": "time",
"xAxisPropertyType": "property",
"xAxisType": "time",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"xmin": "",
"xmax": "",
"yAxisLabel": "Actions",
"yAxisProperty": "actions",
"yAxisPropertyType": "property",
"ymin": "",
"ymax": "",
"bins": 10,
"action": "replace",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "604800",
"removeOlderPoints": "",
"colors": [
"#0095ff",
"#ff0000",
"#ff7f0e",
"#2ca02c",
"#a347e1",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true,
"width": "12",
"height": "9",
"className": "",
"interpolation": "linear",
"x": 760,
"y": 260,
"wires": [
[]
]
},
{
"id": "70681439ce6137b1",
"type": "ui-group",
"name": "Group Name",
"page": "a416c6322fcdd493",
"width": "12",
"height": "6",
"order": -1,
"showTitle": false,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "a416c6322fcdd493",
"type": "ui-page",
"name": "Tape",
"ui": "6093d8eebfe68f39",
"path": "/page5",
"icon": "chart",
"layout": "grid",
"theme": "369b2cb73f1da987",
"breakpoints": [
{
"name": "Default",
"px": "0",
"cols": "3"
},
{
"name": "Tablet",
"px": "576",
"cols": "6"
},
{
"name": "Small Desktop",
"px": "768",
"cols": "9"
},
{
"name": "Desktop",
"px": "1024",
"cols": "12"
}
],
"order": -1,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "6093d8eebfe68f39",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": [
"ui-notification",
"ui-control"
],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showReconnectNotification": true,
"notificationDisplayTime": 1,
"showDisconnectNotification": true,
"allowInstall": false
},
{
"id": "369b2cb73f1da987",
"type": "ui-theme",
"name": "Mine",
"colors": {
"surface": "#0f6e7a",
"primary": "#1e4359",
"bgPage": "#d4eaf3",
"groupBg": "#fffdfa",
"groupOutline": "#9c5312"
},
"sizes": {
"density": "default",
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px"
}
},
{
"id": "5914035cd68ff74e",
"type": "global-config",
"env": [],
"modules": {
"@flowfuse/node-red-dashboard": "1.30.2"
}
}
]

