83 lines
2.0 KiB
Plaintext
83 lines
2.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import thingsboardAPI\n",
|
|
"from datetime import datetime as dt"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"tb = thingsboardAPI(\"nmelone@henry-pump.com\", \"gzU6$26v42mU%3jDzTJf\", \"hp.henrypump.cloud\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#tb"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"customers = tb.getCustomers()\n",
|
|
"devices = tb.getDevices(customers=customers, target_customer=\"Amerus Safety Solutions\")\n",
|
|
"eType, did, keys = tb.getDeviceKeys(devices=devices, target_device=\"Camera Trailer 106\")\n",
|
|
"telemetry = tb.getTelemetry(startTs=tb.convertDateTimeToMS(\"26 May 2022, 13:57:00\"), endTs=int(dt.now().timestamp() * 1000), keys=\",\".join(keys), eType=eType, did=did)\n",
|
|
"#telemetry"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import base64\n",
|
|
"for snap in telemetry[\"snapshot\"]:\n",
|
|
" with open('/Users/nico/Documents/tbTimelapse/'+ str(snap[\"ts\"]) + \".jpg\", 'wb') as img:\n",
|
|
" img.write(base64.b64decode(snap[\"value\"]))"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"interpreter": {
|
|
"hash": "22238595996e71d7b27448e64f75d285aa95d1182295fdd30f75905446cf0091"
|
|
},
|
|
"kernelspec": {
|
|
"display_name": "Python 3.9.12 ('webkit')",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.12"
|
|
},
|
|
"orig_nbformat": 4
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|