diff --git a/milesight-iot-em310-tilt/CHANGELOG.md b/milesight-iot-em310-tilt/CHANGELOG.md new file mode 100644 index 000000000..57140b7b5 --- /dev/null +++ b/milesight-iot-em310-tilt/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 - 2026-04-16 + +- First version of plugin \ No newline at end of file diff --git a/milesight-iot-em310-tilt/LICENSE.md b/milesight-iot-em310-tilt/LICENSE.md new file mode 100644 index 000000000..bffeef341 --- /dev/null +++ b/milesight-iot-em310-tilt/LICENSE.md @@ -0,0 +1,7 @@ +Copyright 2026 Thinger.io + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/milesight-iot-em310-tilt/README.md b/milesight-iot-em310-tilt/README.md new file mode 100644 index 000000000..269ba0d00 --- /dev/null +++ b/milesight-iot-em310-tilt/README.md @@ -0,0 +1,58 @@ +# EM310 - Tilt Sensor + +The Milesight EM310-TILT is a LoRaWAN® tilt sensor that accurately monitors object status in real time through 3-axis angle measurement. Featuring a built-in accelerometer, the device detects tilt angles along X, Y, and Z axes, requiring only the configuration of a relative initial surface and angle threshold for straightforward and effortless operation. + +## Features + +- **3-Axis Accelerometer**: Built-in sensor for precise tilt angle monitoring across X, Y, and Z axes +- **LoRaWAN® Connectivity**: Long-range wireless communication with low power consumption +- **IP67 Protection**: Waterproof and salt spray resistant enclosure suitable for outdoor deployments +- **Compact Design**: Dimensions of 62 x 111 x 33 mm for versatile installation +- **Wide Operating Range**: Functions in temperatures from -20°C to 60°C +- **Battery Powered**: Long-lasting operation for remote monitoring applications + +## Use Cases + +- Tree monitoring and forest management +- Pole lean detection for utility infrastructure +- Landslide monitoring and geological surveying +- Asset movement detection and security +- Structural health monitoring +- Equipment and machinery orientation tracking + +## Thinger.io Integration + +The EM310-TILT integrates seamlessly with Thinger.io through LoRaWAN network servers, enabling real-time monitoring, data visualization, and alerting based on tilt angle measurements. + +## Requirements + +A LoRaWAN server is required to communicate the Milesight EM310-TILT into Thinger.io, some options are: + +- [The Things Stack](https://www.thethingsindustries.com/stack/) +- [LORIOT](https://loriot.io/) +- [ChirpStack](https://www.chirpstack.io/) + +Alongside, the corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. + +## Get Started + +### Installation + +Look for the plugin in the [Thinger.io Plugin Store](https://marketplace.thinger.io/) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. + +### Configuration + +The Product is already preconfigured, check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your desire. + +### Usage + +Start sending uplinks for autoprovisioning devices and buckets. +This product also provides a predefined dashboard and downlinks. + +## Additional Resources + +Milesight resources can be found at: + +- [EM310-TILT Product Page](https://www.milesight.com/iot/product/lorawan-sensor/em310-tilt) +- [EM310-TILT Datasheet](https://resource.milesight.com/milesight/iot/document/em310-tilt-datasheet-en.pdf) +- [Thinger.io Documentation](https://docs.thinger.io) \ No newline at end of file diff --git a/milesight-iot-em310-tilt/assets/em310-tilt.png b/milesight-iot-em310-tilt/assets/em310-tilt.png new file mode 100644 index 000000000..810c52701 Binary files /dev/null and b/milesight-iot-em310-tilt/assets/em310-tilt.png differ diff --git a/milesight-iot-em310-tilt/plugin.json b/milesight-iot-em310-tilt/plugin.json new file mode 100644 index 000000000..3cf2d9d12 --- /dev/null +++ b/milesight-iot-em310-tilt/plugin.json @@ -0,0 +1,713 @@ +{ + "name": "milesight_iot_em310_tilt", + "version": "1.0.0", + "description": "Milesight EM310 LoRaWAN® tilt sensor makes only the settings of a relative initial surface and angle threshold are needed, and the X, Y, Z tilt angles can be leveraged to know object status accurately in real time, straightforward and effortless.", + "author": "Thinger.io", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/thinger-io/plugins.git", + "directory": "milesight-iot-em310-tilt" + }, + "metadata": { + "name": "Milesight-Iot EM310-TILT", + "description": "Milesight EM310 LoRaWAN® tilt sensor makes only the settings of a relative initial surface and angle threshold are needed, and the X, Y, Z tilt angles can be leveraged to know object status accurately in real time, straightforward and effortless.", + "image": "assets/em310-tilt.png", + "category": "devices", + "vendor": "milesight-iot" + }, + "resources": { + "products": [ + { + "description": "Milesight EM310 LoRaWAN® tilt sensor makes only the settings of a relative initial surface and angle threshold are needed, and the X, Y, Z tilt angles can be leveraged to know object status accurately in real time, straightforward and effortless.", + "enabled": true, + "name": "Milesight-Iot EM310-TILT", + "product": "milesight_iot_em310_tilt", + "profile": { + "api": { + "downlink": { + "enabled": true, + "handle_connectivity": false, + "request": { + "data": { + "path": "/downlink", + "payload": "{\r\n \"data\" : \"{{payload.data=\"\"}}\",\r\n \"port\" : {{payload.port=2}},\r\n \"priority\": {{payload.priority=3}},\r\n \"confirmed\" : {{payload.confirmed=false}},\r\n \"uplink\" : {{property.uplink}} \r\n}", + "payload_function": "", + "payload_type": "", + "plugin": "{{property.uplink.source}}", + "target": "plugin_endpoint" + } + } + }, + "uplink": { + "enabled": true, + "handle_connectivity": true, + "request": { + "data": { + "payload": "{{payload}}", + "payload_function": "", + "payload_type": "source_payload", + "resource_stream": "uplink", + "target": "resource_stream" + } + } + } + }, + "autoprovisions": { + "device_autoprovisioning": { + "config": { + "mode": "pattern", + "pattern": "em310_tilt_.*" + }, + "enabled": true + } + }, + "buckets": { + "milesight_em310_tilt_data": { + "backend": "mongodb", + "data": { + "payload": "{{payload}}", + "payload_function": "", + "payload_type": "source_payload", + "resource_stream": "uplink_decoded", + "source": "resource_stream" + }, + "enabled": true, + "retention": { + "period": 3, + "unit": "months" + }, + "tags": [] + } + }, + "code": { + "code": "function decodeThingerUplink(thingerData) {\n // 0. If data has already been decoded, we will return it\n if (thingerData.decodedPayload) return thingerData.decodedPayload;\n \n // 1. Extract and Validate Input\n // We need 'payload' (hex string) and 'fPort' (integer)\n const hexPayload = thingerData.payload || \"\";\n const port = thingerData.fPort || 1;\n\n // 2. Convert Hex String to Byte Array\n const bytes = [];\n for (let i = 0; i < hexPayload.length; i += 2) {\n bytes.push(parseInt(hexPayload.substr(i, 2), 16));\n }\n\n // 3. Dynamic Function Detection and Execution\n \n // CASE A: (The Things Stack v3)\n if (typeof decodeUplink === 'function') {\n try {\n const input = {\n bytes: bytes,\n fPort: port\n };\n var result = decodeUplink(input);\n \n if (result.data) return result.data;\n\n return result; \n } catch (e) {\n console.error(\"Error inside decodeUplink:\", e);\n throw e;\n }\n }\n\n // CASE B: Legacy TTN (v2)\n else if (typeof Decoder === 'function') {\n try {\n return Decoder(bytes, port);\n } catch (e) {\n console.error(\"Error inside Decoder:\", e);\n throw e;\n }\n }\n\n // CASE C: No decoder found\n else {\n throw new Error(\"No compatible TTN decoder function (decodeUplink or Decoder) found in scope.\");\n }\n}\n\n\n// TTN decoder\n/**\n * Payload Decoder\n *\n * Copyright 2025 Milesight IoT\n *\n * @product EM310-TILT\n */\nvar RAW_VALUE = 0x00;\n\n/* eslint no-redeclare: \"off\" */\n/* eslint-disable */\n// Chirpstack v4\nfunction decodeUplink(input) {\n var decoded = milesightDeviceDecode(input.bytes);\n return { data: decoded };\n}\n\n// Chirpstack v3\nfunction Decode(fPort, bytes) {\n return milesightDeviceDecode(bytes);\n}\n\n// The Things Network\nfunction Decoder(bytes, port) {\n return milesightDeviceDecode(bytes);\n}\n/* eslint-enable */\n\nfunction milesightDeviceDecode(bytes) {\n var decoded = {};\n\n for (var i = 0; i < bytes.length; ) {\n var channel_id = bytes[i++];\n var channel_type = bytes[i++];\n\n // IPSO VERSION\n if (channel_id === 0xff && channel_type === 0x01) {\n decoded.ipso_version = readProtocolVersion(bytes[i]);\n i += 1;\n }\n // HARDWARE VERSION\n else if (channel_id === 0xff && channel_type === 0x09) {\n decoded.hardware_version = readHardwareVersion(bytes.slice(i, i + 2));\n i += 2;\n }\n // FIRMWARE VERSION\n else if (channel_id === 0xff && channel_type === 0x0a) {\n decoded.firmware_version = readFirmwareVersion(bytes.slice(i, i + 2));\n i += 2;\n }\n // TSL VERSION\n else if (channel_id === 0xff && channel_type === 0xff) {\n decoded.tsl_version = readTslVersion(bytes.slice(i, i + 2));\n i += 2;\n }\n // SERIAL NUMBER\n else if (channel_id === 0xff && channel_type === 0x16) {\n decoded.sn = readSerialNumber(bytes.slice(i, i + 8));\n i += 8;\n }\n // LORAWAN CLASS TYPE\n else if (channel_id === 0xff && channel_type === 0x0f) {\n decoded.lorawan_class = readLoRaWANClass(bytes[i]);\n i += 1;\n }\n // RESET EVENT\n else if (channel_id === 0xff && channel_type === 0xfe) {\n decoded.reset_event = readResetEvent(1);\n i += 1;\n }\n // DEVICE STATUS\n else if (channel_id === 0xff && channel_type === 0x0b) {\n decoded.device_status = readDeviceStatus(1);\n i += 1;\n }\n\n // BATTERY\n else if (channel_id === 0x01 && channel_type === 0x75) {\n decoded.battery = readUInt8(bytes[i]);\n i += 1;\n }\n // ANGLE\n else if (channel_id === 0x03 && channel_type === 0xcf) {\n decoded.angle_x = readInt16LE(bytes.slice(i, i + 2)) / 100;\n decoded.angle_y = readInt16LE(bytes.slice(i + 2, i + 4)) / 100;\n decoded.angle_z = readInt16LE(bytes.slice(i + 4, i + 6)) / 100;\n var threshold_value = readUInt8(bytes[i + 6]);\n decoded.threshold_x = readAngleStatus((threshold_value >>> 0) & 0x01);\n decoded.threshold_y = readAngleStatus((threshold_value >>> 1) & 0x01);\n decoded.threshold_z = readAngleStatus((threshold_value >>> 2) & 0x01);\n i += 7;\n }\n // DOWNLINK RESPONSE\n else if (channel_id === 0xfe || channel_id === 0xff) {\n var result = handle_downlink_response(channel_type, bytes, i);\n decoded = Object.assign(decoded, result.data);\n i = result.offset;\n } else {\n break;\n }\n }\n\n return decoded;\n}\n\nfunction handle_downlink_response(channel_type, bytes, offset) {\n var decoded = {};\n\n switch (channel_type) {\n case 0x03:\n decoded.report_interval = readUInt16LE(bytes.slice(offset, offset + 2));\n offset += 2;\n break;\n case 0x06:\n var value = readUInt8(bytes[offset]);\n var condition_type = (value >>> 0) & 0x07;\n var alarm_type = (value >>> 3) & 0x07;\n var config = {};\n config.condition = readMathConditionType(condition_type);\n config.threshold_min = readInt16LE(bytes.slice(offset + 1, offset + 3)) / 100;\n config.threshold_max = readInt16LE(bytes.slice(offset + 3, offset + 5)) / 100;\n config.lock_time = readUInt16LE(bytes.slice(offset + 5, offset + 7));\n config.continue_time = readUInt16LE(bytes.slice(offset + 7, offset + 9));\n offset += 9;\n if (alarm_type === 0x01) {\n decoded.angle_x_alarm_config = config;\n } else if (alarm_type === 0x02) {\n decoded.angle_y_alarm_config = config;\n } else if (alarm_type === 0x03) {\n decoded.angle_z_alarm_config = config;\n }\n break;\n case 0x10:\n decoded.reboot = readYesNoStatus(1);\n offset += 1;\n break;\n case 0x28:\n decoded.query_device_status = readYesNoStatus(1);\n offset += 1;\n break;\n case 0x4a:\n decoded.sync_time = readYesNoStatus(1);\n offset += 1;\n break;\n case 0x62:\n decoded.initial_surface = readInitialSurfaceType(bytes[offset]);\n offset += 1;\n break;\n case 0x63:\n decoded.angle_alarm_condition = readUtf8(bytes.slice(offset, offset + 8));\n offset += 8;\n break;\n default:\n throw new Error(\"unknown downlink response\");\n }\n\n return { data: decoded, offset: offset };\n}\n\nfunction readProtocolVersion(bytes) {\n var major = (bytes & 0xf0) >> 4;\n var minor = bytes & 0x0f;\n return \"v\" + major + \".\" + minor;\n}\n\nfunction readHardwareVersion(bytes) {\n var major = (bytes[0] & 0xff).toString(16);\n var minor = (bytes[1] & 0xff) >> 4;\n return \"v\" + major + \".\" + minor;\n}\n\nfunction readFirmwareVersion(bytes) {\n var major = (bytes[0] & 0xff).toString(16);\n var minor = (bytes[1] & 0xff).toString(16);\n return \"v\" + major + \".\" + minor;\n}\n\nfunction readTslVersion(bytes) {\n var major = bytes[0] & 0xff;\n var minor = bytes[1] & 0xff;\n return \"v\" + major + \".\" + minor;\n}\n\nfunction readSerialNumber(bytes) {\n var temp = [];\n for (var idx = 0; idx < bytes.length; idx++) {\n temp.push((\"0\" + (bytes[idx] & 0xff).toString(16)).slice(-2));\n }\n return temp.join(\"\");\n}\n\nfunction readLoRaWANClass(type) {\n var class_map = {\n 0: \"Class A\",\n 1: \"Class B\",\n 2: \"Class C\",\n 3: \"Class CtoB\",\n };\n return getValue(class_map, type);\n}\n\nfunction readResetEvent(status) {\n var status_map = { 0: \"normal\", 1: \"reset\" };\n return getValue(status_map, status);\n}\n\nfunction readDeviceStatus(status) {\n var status_map = { 0: \"off\", 1: \"on\" };\n return getValue(status_map, status);\n}\n\nfunction readAngleStatus(status) {\n var status_map = { 0: \"normal\", 1: \"trigger\" };\n return getValue(status_map, status);\n}\n\nfunction readMathConditionType(type) {\n var type_map = { 0: \"disable\", 1: \"below\", 2: \"above\", 3: \"between\", 4: \"outside\", 5: \"mutation\" };\n return getValue(type_map, type);\n}\n\nfunction readYesNoStatus(status) {\n var status_map = { 0: \"no\", 1: \"yes\" };\n return getValue(status_map, status);\n}\n\nfunction readInitialSurfaceType(type) {\n var type_map = { 255: \"current_plane\", 254: \"reset_zero_reference_point\", 253: \"set_zero_calibration\", 252: \"clear_zero_calibration\" };\n return getValue(type_map, type);\n}\n\n/* eslint-disable */\nfunction readUInt8(bytes) {\n return bytes & 0xff;\n}\n\nfunction readInt8(bytes) {\n var ref = readUInt8(bytes);\n return ref > 0x7f ? ref - 0x100 : ref;\n}\n\nfunction readUInt16LE(bytes) {\n var value = (bytes[1] << 8) + bytes[0];\n return value & 0xffff;\n}\n\nfunction readInt16LE(bytes) {\n var ref = readUInt16LE(bytes);\n return ref > 0x7fff ? ref - 0x10000 : ref;\n}\n\nfunction readUInt32LE(bytes) {\n var value = (bytes[3] << 24) + (bytes[2] << 16) + (bytes[1] << 8) + bytes[0];\n return value & 0xffffffff;\n}\n\nfunction readUtf8(bytes) {\n var str = \"\";\n var i = 0;\n var byte1, byte2, byte3, byte4;\n while (i < bytes.length) {\n byte1 = bytes[i++];\n if (byte1 === 0x00) {\n break;\n }\n if (byte1 <= 0x7f) {\n str += String.fromCharCode(byte1);\n } else if (byte1 <= 0xdf) {\n byte2 = bytes[i++];\n str += String.fromCharCode(((byte1 & 0x1f) << 6) | (byte2 & 0x3f));\n } else if (byte1 <= 0xef) {\n byte2 = bytes[i++];\n byte3 = bytes[i++];\n str += String.fromCharCode(((byte1 & 0x0f) << 12) | ((byte2 & 0x3f) << 6) | (byte3 & 0x3f));\n } else if (byte1 <= 0xf7) {\n byte2 = bytes[i++];\n byte3 = bytes[i++];\n byte4 = bytes[i++];\n var codepoint = ((byte1 & 0x07) << 18) | ((byte2 & 0x3f) << 12) | ((byte3 & 0x3f) << 6) | (byte4 & 0x3f);\n codepoint -= 0x10000;\n str += String.fromCharCode((codepoint >> 10) + 0xd800);\n str += String.fromCharCode((codepoint & 0x3ff) + 0xdc00);\n }\n }\n return str;\n}\n\nfunction getValue(map, key) {\n if (RAW_VALUE) return key;\n\n var value = map[key];\n if (!value) value = \"unknown\";\n return value;\n}\n\n//if (!Object.assign) {\n Object.defineProperty(Object, \"assign\", {\n enumerable: false,\n configurable: true,\n writable: true,\n value: function (target) {\n \"use strict\";\n if (target == null) {\n throw new TypeError(\"Cannot convert first argument to object\");\n }\n\n var to = Object(target);\n for (var i = 1; i < arguments.length; i++) {\n var nextSource = arguments[i];\n if (nextSource == null) {\n continue;\n }\n nextSource = Object(nextSource);\n\n var keysArray = Object.keys(Object(nextSource));\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n // concat array\n if (Array.isArray(to[nextKey]) && Array.isArray(nextSource[nextKey])) {\n to[nextKey] = to[nextKey].concat(nextSource[nextKey]);\n } else {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n return to;\n },\n });\n//}", + "environment": "javascript", + "storage": "", + "version": "1.0" + }, + "flows": { + "milesight_em310_tilt_decoder": { + "data": { + "payload": "{{payload}}", + "payload_function": "decodeThingerUplink", + "payload_type": "source_payload", + "resource": "uplink", + "source": "resource", + "update": "events" + }, + "enabled": true, + "sink": { + "payload": "{{payload}}", + "payload_function": "", + "payload_type": "source_payload", + "resource_stream": "uplink_decoded", + "target": "resource_stream" + }, + "split_data": false + } + }, + "properties": { + "uplink": { + "data": { + "payload": "{{payload}}", + "payload_function": "", + "payload_type": "source_payload", + "resource": "uplink", + "source": "resource", + "update": "events" + }, + "default": { + "source": "value" + }, + "enabled": true + } + } + }, + "_resources": { + "properties": [ + { + "property": "dashboard", + "value": { + "tabs": [ + { + "name": "Dashboard", + "widgets": [ + { + "layout": { + "col": 0, + "row": 0, + "sizeX": 2, + "sizeY": 5 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Angle X" + }, + "properties": { + "decimalPlaces": 2, + "enableExtraTextColor": false, + "enableIconColor": false, + "enableIconSize": false, + "extraText": "", + "extraTextColor": "#1E313E", + "extraTextColorConditions": [], + "extraTextConditions": [], + "extraTextPosition": "above-value", + "extraTextSize": "20px", + "extraTextWeight": "font-light", + "icon": "", + "iconColor": "#1E313E", + "iconColorConditions": [], + "iconConditions": [], + "iconGap": "8px", + "iconPosition": "before-value", + "iconSize": "75px", + "iconVerticalOffset": "0px", + "link": "", + "textAlign": "center", + "textColor": "#1E313E", + "textColorConditions": [], + "textSize": "75px", + "textWeight": "font-light", + "unit": "°", + "unitSize": "20px" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "angle_x", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Angle X", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "text" + }, + { + "layout": { + "col": 0, + "row": 5, + "sizeX": 2, + "sizeY": 5 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Angle Y" + }, + "properties": { + "decimalPlaces": 2, + "enableExtraTextColor": false, + "enableIconColor": false, + "enableIconSize": false, + "extraText": "", + "extraTextColor": "#1E313E", + "extraTextColorConditions": [], + "extraTextConditions": [], + "extraTextPosition": "above-value", + "extraTextSize": "20px", + "extraTextWeight": "font-light", + "icon": "", + "iconColor": "#1E313E", + "iconColorConditions": [], + "iconConditions": [], + "iconGap": "8px", + "iconPosition": "before-value", + "iconSize": "75px", + "iconVerticalOffset": "0px", + "link": "", + "textAlign": "center", + "textColor": "#1E313E", + "textColorConditions": [], + "textSize": "75px", + "textWeight": "font-light", + "unit": "°", + "unitSize": "20px" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "angle_y", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Angle Y", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "text" + }, + { + "layout": { + "col": 0, + "row": 10, + "sizeX": 2, + "sizeY": 5 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Angle Z" + }, + "properties": { + "decimalPlaces": 2, + "enableExtraTextColor": false, + "enableIconColor": false, + "enableIconSize": false, + "extraText": "", + "extraTextColor": "#1E313E", + "extraTextColorConditions": [], + "extraTextConditions": [], + "extraTextPosition": "above-value", + "extraTextSize": "20px", + "extraTextWeight": "font-light", + "icon": "", + "iconColor": "#1E313E", + "iconColorConditions": [], + "iconConditions": [], + "iconGap": "8px", + "iconPosition": "before-value", + "iconSize": "75px", + "iconVerticalOffset": "0px", + "link": "", + "textAlign": "center", + "textColor": "#1E313E", + "textColorConditions": [], + "textSize": "75px", + "textWeight": "font-light", + "unit": "°", + "unitSize": "20px" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "angle_z", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Angle Z", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "text" + }, + { + "layout": { + "col": 2, + "row": 0, + "sizeX": 4, + "sizeY": 10 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Tilt Angles (24h)" + }, + "properties": { + "alignTimeSeries": false, + "dataAppend": false, + "options": "var options = {\n chart: {\n type: 'line'\n },\n dataLabels: {\n enabled: false\n },\n stroke: {\n curve: 'smooth',\n width: 2\n },\n xaxis: {\n type: 'datetime',\n labels: {\n datetimeUTC: false\n },\n tooltip: {\n enabled: false\n }\n },\n yaxis: {\n title: {\n text: 'Angle (degrees)'\n },\n labels: {\n formatter: function (val) {\n if (val !== null && typeof val !== 'undefined')\n return val.toFixed(2);\n }\n }\n },\n tooltip: {\n x: {\n format: 'dd/MM/yyyy HH:mm:ss'\n }\n },\n legend: {\n position: 'top'\n }\n};\n", + "realTimeUpdate": true + }, + "sources": [ + { + "aggregation": {}, + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "angle_x", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#d1311f", + "name": "Angle X", + "source": "bucket", + "timespan": { + "magnitude": "hour", + "mode": "relative", + "period": "latest", + "value": 24 + } + }, + { + "aggregation": {}, + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "angle_y", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#329fcd", + "name": "Angle Y", + "source": "bucket", + "timespan": { + "magnitude": "hour", + "mode": "relative", + "period": "latest", + "value": 24 + } + }, + { + "aggregation": {}, + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "angle_z", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#2ebd59", + "name": "Angle Z", + "source": "bucket", + "timespan": { + "magnitude": "hour", + "mode": "relative", + "period": "latest", + "value": 24 + } + } + ], + "type": "apex_charts" + }, + { + "layout": { + "col": 0, + "row": 15, + "sizeX": 2, + "sizeY": 5 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Battery" + }, + "properties": { + "color": "#2ebd59", + "gradient": false, + "max": 100, + "min": 0, + "unit": "%" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "battery", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Battery", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "gauge" + }, + { + "layout": { + "col": 2, + "row": 10, + "sizeX": 4, + "sizeY": 5 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Battery (24h)" + }, + "properties": { + "alignTimeSeries": false, + "dataAppend": false, + "options": "var options = {\n chart: {\n type: 'area'\n },\n dataLabels: {\n enabled: false\n },\n stroke: {\n curve: 'smooth'\n },\n xaxis: {\n type: 'datetime',\n labels: {\n datetimeUTC: false\n },\n tooltip: {\n enabled: false\n }\n },\n yaxis: {\n min: 0,\n max: 100,\n title: {\n text: 'Battery (%)'\n }\n },\n tooltip: {\n x: {\n format: 'dd/MM/yyyy HH:mm:ss'\n }\n },\n fill: {\n type: 'gradient',\n gradient: {\n shadeIntensity: 1,\n opacityFrom: 0.7,\n opacityTo: 0.3\n }\n }\n};\n", + "realTimeUpdate": true + }, + "sources": [ + { + "aggregation": {}, + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "battery", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#2ebd59", + "name": "Battery", + "source": "bucket", + "timespan": { + "magnitude": "hour", + "mode": "relative", + "period": "latest", + "value": 24 + } + } + ], + "type": "apex_charts" + }, + { + "layout": { + "col": 0, + "row": 20, + "sizeX": 2, + "sizeY": 3 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Threshold Status X" + }, + "properties": { + "decimalPlaces": 0, + "enableExtraTextColor": false, + "enableIconColor": false, + "enableIconSize": false, + "extraText": "", + "extraTextColor": "#1E313E", + "extraTextColorConditions": [], + "extraTextConditions": [], + "extraTextPosition": "above-value", + "extraTextSize": "20px", + "extraTextWeight": "font-light", + "icon": "", + "iconColor": "#1E313E", + "iconColorConditions": [], + "iconConditions": [], + "iconGap": "8px", + "iconPosition": "before-value", + "iconSize": "75px", + "iconVerticalOffset": "0px", + "link": "", + "textAlign": "center", + "textColor": "#1E313E", + "textColorConditions": [], + "textSize": "40px", + "textWeight": "font-light", + "unit": "", + "unitSize": "20px" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "threshold_x", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Threshold X", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "text" + }, + { + "layout": { + "col": 2, + "row": 20, + "sizeX": 2, + "sizeY": 3 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Threshold Status Y" + }, + "properties": { + "decimalPlaces": 0, + "enableExtraTextColor": false, + "enableIconColor": false, + "enableIconSize": false, + "extraText": "", + "extraTextColor": "#1E313E", + "extraTextColorConditions": [], + "extraTextConditions": [], + "extraTextPosition": "above-value", + "extraTextSize": "20px", + "extraTextWeight": "font-light", + "icon": "", + "iconColor": "#1E313E", + "iconColorConditions": [], + "iconConditions": [], + "iconGap": "8px", + "iconPosition": "before-value", + "iconSize": "75px", + "iconVerticalOffset": "0px", + "link": "", + "textAlign": "center", + "textColor": "#1E313E", + "textColorConditions": [], + "textSize": "40px", + "textWeight": "font-light", + "unit": "", + "unitSize": "20px" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "threshold_y", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Threshold Y", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "text" + }, + { + "layout": { + "col": 4, + "row": 20, + "sizeX": 2, + "sizeY": 3 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Threshold Status Z" + }, + "properties": { + "decimalPlaces": 0, + "enableExtraTextColor": false, + "enableIconColor": false, + "enableIconSize": false, + "extraText": "", + "extraTextColor": "#1E313E", + "extraTextColorConditions": [], + "extraTextConditions": [], + "extraTextPosition": "above-value", + "extraTextSize": "20px", + "extraTextWeight": "font-light", + "icon": "", + "iconColor": "#1E313E", + "iconColorConditions": [], + "iconConditions": [], + "iconGap": "8px", + "iconPosition": "before-value", + "iconSize": "75px", + "iconVerticalOffset": "0px", + "link": "", + "textAlign": "center", + "textColor": "#1E313E", + "textColorConditions": [], + "textSize": "40px", + "textWeight": "font-light", + "unit": "", + "unitSize": "20px" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "milesight_em310_tilt_data", + "mapping": "threshold_z", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "Threshold Z", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "text" + } + ] + } + ] + } + } + ] + } + } + ] + } +} \ No newline at end of file