Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": "2b6b5ed9516fb9c3",
- "type": "group",
- "z": "af8d5ef0f61db63b",
- "name": "Zigbee device low battery detection",
- "style": {
- "label": true
- },
- "nodes": [
- "9efd4b51adad95ee",
- "4e660536152e06be",
- "1a8c47c287afba4d",
- "b2b12ef0aac414d4",
- "7e3396f573f44cb7"
- ],
- "x": 34,
- "y": 4659,
- "w": 1032,
- "h": 82
- },
- {
- "id": "9efd4b51adad95ee",
- "type": "api-call-service",
- "z": "af8d5ef0f61db63b",
- "g": "2b6b5ed9516fb9c3",
- "name": "",
- "server": "4f2312d6.a0c58c",
- "version": 5,
- "debugenabled": false,
- "domain": "notify",
- "service": "mobile_app_iphone_14",
- "areaId": [],
- "deviceId": [],
- "entityId": [],
- "data": "{\"title\":\"Low battery alert\",\"message\":\"{{{payload}}}\"}",
- "dataType": "json",
- "mergeContext": "",
- "mustacheAltTags": false,
- "outputProperties": [],
- "queue": "none",
- "x": 920,
- "y": 4700,
- "wires": [
- []
- ]
- },
- {
- "id": "4e660536152e06be",
- "type": "delay",
- "z": "af8d5ef0f61db63b",
- "g": "2b6b5ed9516fb9c3",
- "name": "",
- "pauseType": "rate",
- "timeout": "5",
- "timeoutUnits": "seconds",
- "rate": "1",
- "nbRateUnits": "1",
- "rateUnits": "hour",
- "randomFirst": "1",
- "randomLast": "5",
- "randomUnits": "seconds",
- "drop": true,
- "allowrate": false,
- "outputs": 1,
- "x": 710,
- "y": 4700,
- "wires": [
- [
- "9efd4b51adad95ee"
- ]
- ]
- },
- {
- "id": "1a8c47c287afba4d",
- "type": "time-range-switch",
- "z": "af8d5ef0f61db63b",
- "g": "2b6b5ed9516fb9c3",
- "name": "",
- "lat": "",
- "lon": "",
- "startTime": "07:00",
- "endTime": "21:00",
- "startOffset": 0,
- "endOffset": 0,
- "x": 550,
- "y": 4700,
- "wires": [
- [
- "4e660536152e06be"
- ],
- []
- ]
- },
- {
- "id": "b2b12ef0aac414d4",
- "type": "function",
- "z": "af8d5ef0f61db63b",
- "g": "2b6b5ed9516fb9c3",
- "name": "Detect low battery levels",
- "func": "var device_name = msg.topic.replace(\"zigbee2mqtt/\", \"\")\nvar device_battery = parseInt(msg.payload.battery);\nvar alert_percent = 10;\n\nif (device_battery < alert_percent) {\n msg.payload = \"Alert: \" + device_name + \" battery level is \" + device_battery + \"%\";\n return msg;\n}\n\nreturn 0;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 350,
- "y": 4700,
- "wires": [
- [
- "1a8c47c287afba4d"
- ]
- ]
- },
- {
- "id": "7e3396f573f44cb7",
- "type": "mqtt in",
- "z": "af8d5ef0f61db63b",
- "g": "2b6b5ed9516fb9c3",
- "name": "",
- "topic": "zigbee2mqtt/+",
- "qos": "2",
- "datatype": "auto-detect",
- "broker": "edc56f1f21cdfb66",
- "nl": false,
- "rap": true,
- "rh": 0,
- "inputs": 0,
- "x": 140,
- "y": 4700,
- "wires": [
- [
- "b2b12ef0aac414d4"
- ]
- ]
- },
- {
- "id": "4f2312d6.a0c58c",
- "type": "server",
- "name": "Home Assistant",
- "version": 5,
- "rejectUnauthorizedCerts": true,
- "ha_boolean": "y|yes|true|on|home|open",
- "connectionDelay": true,
- "cacheJson": true,
- "heartbeat": false,
- "heartbeatInterval": 30,
- "areaSelector": "friendlyName",
- "deviceSelector": "friendlyName",
- "entitySelector": "friendlyName",
- "statusSeparator": "at: ",
- "statusYear": "hidden",
- "statusMonth": "short",
- "statusDay": "numeric",
- "statusHourCycle": "h23",
- "statusTimeFormat": "h:m",
- "enableGlobalContextStore": true
- },
- {
- "id": "edc56f1f21cdfb66",
- "type": "mqtt-broker",
- "name": "",
- "broker": "10.239.3.2",
- "port": "1883",
- "clientid": "",
- "autoConnect": true,
- "usetls": false,
- "protocolVersion": "4",
- "keepalive": "60",
- "cleansession": true,
- "birthTopic": "",
- "birthQos": "0",
- "birthRetain": "false",
- "birthPayload": "",
- "birthMsg": {},
- "closeTopic": "",
- "closeQos": "0",
- "closeRetain": "false",
- "closePayload": "",
- "closeMsg": {},
- "willTopic": "",
- "willQos": "0",
- "willRetain": "false",
- "willPayload": "",
- "willMsg": {},
- "userProps": "",
- "sessionExpiry": ""
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment