[ { "id": "5bdf7c5b0c22afc8", "type": "tab", "label": "Mircobit accelerometer", "disabled": false, "info": "", "env": [] }, { "id": "c03f56cb.e04df8", "type": "Generic BLE in", "z": "5bdf7c5b0c22afc8", "name": "micro:bit", "genericBle": "3e619048beee388e", "useString": false, "notification": true, "x": 480, "y": 80, "wires": [ [ "8ab2721d13ac6de7" ] ] }, { "id": "4018a3ae.3483ec", "type": "inject", "z": "5bdf7c5b0c22afc8", "name": "Start", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "1", "crontab": "", "once": true, "onceDelay": 0.1, "topic": "e95dca4b251d470aa062fa1922dfa9a8", "payload": "", "payloadType": "date", "x": 90, "y": 80, "wires": [ [ "02abfb88d974299a" ] ] }, { "id": "8ab2721d13ac6de7", "type": "function", "z": "5bdf7c5b0c22afc8", "name": "Convert Hex to Decimal X-axis", "func": "const buffer = new Buffer(msg.payload.characteristics.e95dca4b251d470aa062fa1922dfa9a8);\nlet data = '';\nfor(let x of buffer){\n data += x.toString(16).padStart(2, '0');\n}\n\nconst x = data.substring(0,4);\nconst convertedX = parseInt('0x'+x.match(/../g).reverse().join(''));\n\nmsg.payload = convertedX;\nreturn msg", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 510, "y": 220, "wires": [ [ "d82c8d23fbd452b1" ] ] }, { "id": "2b82bcb7973c8e58", "type": "debug", "z": "5bdf7c5b0c22afc8", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 990, "y": 140, "wires": [] }, { "id": "d82c8d23fbd452b1", "type": "switch", "z": "5bdf7c5b0c22afc8", "name": "Has accelarated?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lte", "v": "500", "vt": "num" }, { "t": "gt", "v": "500", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 770, "y": 220, "wires": [ [ "2b82bcb7973c8e58", "c14f4b5c921590c5" ], [ "8f013509fd556a5e" ] ] }, { "id": "391785ac0f522b92", "type": "Generic BLE in", "z": "5bdf7c5b0c22afc8", "name": "", "useString": false, "notification": true, "x": 550, "y": 1060, "wires": [ [] ] }, { "id": "ee442bbd79ef724d", "type": "function", "z": "5bdf7c5b0c22afc8", "name": "Create Message", "func": " msg.payload = JSON.parse(`{\n \"chatId\": xxxxxx,\n \"type\": \"message\",\n \"content\": \"The door has been opened\"\n}`);\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 980, "y": 420, "wires": [ [ "57661e60e7f13662" ] ] }, { "id": "57661e60e7f13662", "type": "telegram sender", "z": "5bdf7c5b0c22afc8", "name": "", "bot": "bd029d64.0546a", "haserroroutput": false, "outputs": 1, "x": 990, "y": 500, "wires": [ [ "2820323ad17e7021" ] ] }, { "id": "02abfb88d974299a", "type": "switch", "z": "5bdf7c5b0c22afc8", "name": "Is it night?", "property": "$number($now(\"[H#01]\", \"+0100\"))", "propertyType": "jsonata", "rules": [ { "t": "btwn", "v": "0", "vt": "num", "v2": "7", "v2t": "num" }, { "t": "btwn", "v": "20", "vt": "num", "v2": "23", "v2t": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 290, "y": 80, "wires": [ [ "c03f56cb.e04df8" ], [ "c03f56cb.e04df8" ] ] }, { "id": "2820323ad17e7021", "type": "change", "z": "5bdf7c5b0c22afc8", "name": "is_send = true", "rules": [ { "t": "set", "p": "is_send", "pt": "flow", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 980, "y": 580, "wires": [ [] ] }, { "id": "c14f4b5c921590c5", "type": "change", "z": "5bdf7c5b0c22afc8", "name": "is_send = false", "rules": [ { "t": "set", "p": "is_send", "pt": "flow", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1000, "y": 180, "wires": [ [] ] }, { "id": "8f013509fd556a5e", "type": "switch", "z": "5bdf7c5b0c22afc8", "name": "Not already send?", "property": "is_send", "propertyType": "flow", "rules": [ { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 970, "y": 320, "wires": [ [ "ee442bbd79ef724d" ] ] }, { "id": "3e619048beee388e", "type": "Generic BLE", "localName": "BBC micro:bit [putig]", "address": "da:8c:79:93:01:03", "uuid": "da8c79930103", "characteristics": [ { "uuid": "2a05", "name": "Service Changed", "type": "org.bluetooth.characteristic.gatt.service_changed", "notifiable": false, "readable": false, "writable": false, "writeWithoutResponse": false }, { "uuid": "2a26", "name": "Firmware Revision String", "type": "org.bluetooth.characteristic.firmware_revision_string", "notifiable": false, "readable": true, "writable": false, "writeWithoutResponse": false }, { "uuid": "2a25", "name": "Serial Number String", "type": "org.bluetooth.characteristic.serial_number_string", "notifiable": false, "readable": true, "writable": false, "writeWithoutResponse": false }, { "uuid": "2a24", "name": "Model Number String", "type": "org.bluetooth.characteristic.model_number_string", "notifiable": false, "readable": true, "writable": false, "writeWithoutResponse": false }, { "uuid": "8ec90004f3154f609fb8838830daea50", "name": "", "type": "(Custom Type)", "notifiable": false, "readable": false, "writable": true, "writeWithoutResponse": false }, { "uuid": "e95dfb24251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": false, "readable": true, "writable": true, "writeWithoutResponse": false }, { "uuid": "e95dca4b251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": true, "readable": true, "writable": false, "writeWithoutResponse": false }, { "uuid": "e95db84c251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": true, "readable": true, "writable": false, "writeWithoutResponse": false }, { "uuid": "e95d23c4251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": false, "readable": false, "writable": true, "writeWithoutResponse": false }, { "uuid": "e95d5404251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": false, "readable": false, "writable": true, "writeWithoutResponse": false }, { "uuid": "e95d9775251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": true, "readable": true, "writable": false, "writeWithoutResponse": false }, { "uuid": "e97d3b10251d470aa062fa1922dfa9a8", "name": "", "type": "(Custom Type)", "notifiable": true, "readable": false, "writable": false, "writeWithoutResponse": false } ] }, { "id": "bd029d64.0546a", "type": "telegram bot", "botname": "Microbot", "usernames": "", "chatids": "", "baseapiurl": "", "pollinterval": "300", "usesocks": false, "sockshost": "", "socksport": "", "socksusername": "", "sockspassword": "", "bothost": "", "botpath": "", "localbotport": "", "publicbotport": "", "privatekey": "", "certificate": "", "useselfsignedcertificate": false, "sslterminated": false, "verboselogging": false } ]