Guest User

Untitled

a guest
Aug 30th, 2019
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "id": "124e80d5.d5d04f",
  4.         "type": "function",
  5.         "z": "bfb890c.05fc67",
  6.         "name": "Check status",
  7.         "func": "\nvar soc1=global.get('shuntsoc1') || 0;\nvar soc2=global.get('shuntsoc2') || 0;\nvar soc =  (soc1*20 + soc2*80)/100;\n\nvar house=global.get('power3sum') || 0;\nvar garage=global.get('power4sum') || 0;\nvar total = house - garage;  // Due to error in my meter... I have to retract\n\nvar s1=global.get('shuntwatt1') || 0;\nvar s2=global.get('shuntwatt2') || 0;\nvar sw =  s1 + s2;\n\n\n\nmsg.soc = soc;\nmsg.house = house;\nmsg.garage = garage;\nmsg.total = total;\nmsg.battery = sw;\n\nif (soc > 96 && total > -1000 )\n{\n    msg.payload = 1;\n} else if (soc < 94 || total < -2000 )\n{\n    msg.payload = 0;\n} else return null;\n\nreturn msg;\n",
  8.         "outputs": 1,
  9.         "noerr": 0,
  10.         "x": 390,
  11.         "y": 280,
  12.         "wires": [
  13.             [
  14.                 "281e2e12.35e392",
  15.                 "9fa1a542.1ccc38"
  16.             ]
  17.         ]
  18.     },
  19.     {
  20.         "id": "9fa1a542.1ccc38",
  21.         "type": "mqtt out",
  22.         "z": "bfb890c.05fc67",
  23.         "name": "Power",
  24.         "topic": "cmnd/heater1/POWER",
  25.         "qos": "0",
  26.         "retain": "false",
  27.         "broker": "8605b863.295d48",
  28.         "x": 610,
  29.         "y": 280,
  30.         "wires": []
  31.     },
  32.     {
  33.         "id": "a3c307bf.9a5ca8",
  34.         "type": "inject",
  35.         "z": "bfb890c.05fc67",
  36.         "name": "Every 5 seconds do",
  37.         "topic": "",
  38.         "payload": "",
  39.         "payloadType": "date",
  40.         "repeat": "5",
  41.         "crontab": "",
  42.         "once": true,
  43.         "onceDelay": 0.1,
  44.         "x": 140,
  45.         "y": 280,
  46.         "wires": [
  47.             [
  48.                 "124e80d5.d5d04f"
  49.             ]
  50.         ]
  51.     },
  52.     {
  53.         "id": "281e2e12.35e392",
  54.         "type": "debug",
  55.         "z": "bfb890c.05fc67",
  56.         "name": "",
  57.         "active": false,
  58.         "tosidebar": true,
  59.         "console": false,
  60.         "tostatus": false,
  61.         "complete": "true",
  62.         "x": 610,
  63.         "y": 220,
  64.         "wires": []
  65.     },
  66.     {
  67.         "id": "698fa5f2.a08e2c",
  68.         "type": "mqtt in",
  69.         "z": "bfb890c.05fc67",
  70.         "name": "",
  71.         "topic": "tele/+/SENSOR",
  72.         "qos": "0",
  73.         "broker": "8605b863.295d48",
  74.         "x": 100,
  75.         "y": 440,
  76.         "wires": [
  77.             [
  78.                 "18ae8321.070ccd"
  79.             ]
  80.         ]
  81.     },
  82.     {
  83.         "id": "18ae8321.070ccd",
  84.         "type": "json",
  85.         "z": "bfb890c.05fc67",
  86.         "name": "",
  87.         "property": "payload",
  88.         "action": "",
  89.         "pretty": false,
  90.         "x": 330,
  91.         "y": 440,
  92.         "wires": [
  93.             [
  94.                 "fce35a91.1b9cb8"
  95.             ]
  96.         ]
  97.     },
  98.     {
  99.         "id": "46ec5bc0.f2d304",
  100.         "type": "influxdb out",
  101.         "z": "bfb890c.05fc67",
  102.         "influxdb": "e809e7f6.256c48",
  103.         "name": "",
  104.         "measurement": "sensors",
  105.         "precision": "s",
  106.         "retentionPolicy": "",
  107.         "x": 910,
  108.         "y": 500,
  109.         "wires": []
  110.     },
  111.     {
  112.         "id": "fce35a91.1b9cb8",
  113.         "type": "function",
  114.         "z": "bfb890c.05fc67",
  115.         "name": "MQTT to InfluxDB",
  116.         "func": "var tokens = msg.topic.split(\"/\");\nvar dest = tokens[1];\n\n\nif ('ENERGY' in msg.payload)\n{ \n    value = parseFloat(msg.payload.ENERGY.Power)\n    type = \"watt\";\n    \n} else if ('DS18B20' in msg.payload)\n{\n    value = parseFloat(msg.payload.DS18B20.Temperature)\n    type = \"celcius\";\n} else\n{ return null;\n}\n\nmsg.payload = [{\n     value:value\n},{ \n   \n    device: dest ,\n    type: type\n}];\n\n\n\nreturn msg;",
  117.         "outputs": 1,
  118.         "noerr": 0,
  119.         "x": 570,
  120.         "y": 440,
  121.         "wires": [
  122.             [
  123.                 "a9d31a67.d03278",
  124.                 "46ec5bc0.f2d304"
  125.             ]
  126.         ]
  127.     },
  128.     {
  129.         "id": "cd8a72ef.3cd29",
  130.         "type": "function",
  131.         "z": "bfb890c.05fc67",
  132.         "name": "MQTT to InfluxDB",
  133.         "func": "var tokens = msg.topic.split(\"/\");\nvar dest = tokens[1];\n\nif (msg.payload.POWER == \"ON\")\n{ val = 1;\n\n} else \n{ val = 0; }\n\n\nmsg.payload = [{\n     value:parseFloat(val)\n    \n},{ \n   \n    device: dest,\n    type: \"bool\"\n}];\n\n\n\nreturn msg;",
  134.         "outputs": 1,
  135.         "noerr": 0,
  136.         "x": 570,
  137.         "y": 500,
  138.         "wires": [
  139.             [
  140.                 "46ec5bc0.f2d304"
  141.             ]
  142.         ]
  143.     },
  144.     {
  145.         "id": "18e12e53.f75c22",
  146.         "type": "mqtt in",
  147.         "z": "bfb890c.05fc67",
  148.         "name": "",
  149.         "topic": "tele/+/STATE",
  150.         "qos": "0",
  151.         "broker": "8605b863.295d48",
  152.         "x": 90,
  153.         "y": 500,
  154.         "wires": [
  155.             [
  156.                 "d681e007.ff2a3"
  157.             ]
  158.         ]
  159.     },
  160.     {
  161.         "id": "d681e007.ff2a3",
  162.         "type": "json",
  163.         "z": "bfb890c.05fc67",
  164.         "name": "",
  165.         "property": "payload",
  166.         "action": "",
  167.         "pretty": false,
  168.         "x": 330,
  169.         "y": 500,
  170.         "wires": [
  171.             [
  172.                 "cd8a72ef.3cd29"
  173.             ]
  174.         ]
  175.     },
  176.     {
  177.         "id": "a9d31a67.d03278",
  178.         "type": "debug",
  179.         "z": "bfb890c.05fc67",
  180.         "name": "",
  181.         "active": false,
  182.         "tosidebar": true,
  183.         "console": false,
  184.         "tostatus": false,
  185.         "complete": "true",
  186.         "x": 850,
  187.         "y": 440,
  188.         "wires": []
  189.     },
  190.     {
  191.         "id": "8605b863.295d48",
  192.         "type": "mqtt-broker",
  193.         "z": "",
  194.         "name": "localhost",
  195.         "broker": "localhost",
  196.         "port": "1883",
  197.         "clientid": "",
  198.         "usetls": false,
  199.         "compatmode": true,
  200.         "keepalive": "60",
  201.         "cleansession": true,
  202.         "birthTopic": "",
  203.         "birthQos": "0",
  204.         "birthPayload": "",
  205.         "closeTopic": "",
  206.         "closeQos": "0",
  207.         "closePayload": "",
  208.         "willTopic": "",
  209.         "willQos": "0",
  210.         "willPayload": ""
  211.     },
  212.     {
  213.         "id": "e809e7f6.256c48",
  214.         "type": "influxdb",
  215.         "z": "",
  216.         "hostname": "127.0.0.1",
  217.         "port": "8086",
  218.         "protocol": "http",
  219.         "database": "temps",
  220.         "name": "",
  221.         "usetls": false,
  222.         "tls": ""
  223.     }
  224. ]
Advertisement
Add Comment
Please, Sign In to add comment