[ { "id": "50764001a8f2c3ef", "type": "inject", "z": "7984fdde731ce3dc", "name": "Fetch nextday at 18:00", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "00 18 * * *", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 190, "y": 340, "wires": [ [ "87da52954c692065" ] ] }, { "id": "87da52954c692065", "type": "nordpool-api-plus", "z": "7984fdde731ce3dc", "name": "Get tomorrow prices", "area": "FI", "currency": "EUR", "action": "dayAhead", "x": 440, "y": 340, "wires": [ [ "911421c46d769bf5" ] ] }, { "id": "b871ce3d6c14d3b8", "type": "nordpool-api-plus", "z": "7984fdde731ce3dc", "name": "Get today prices", "area": "FI", "currency": "EUR", "action": "todayOrOverride", "x": 660, "y": 140, "wires": [ [ "bb58663c0cb8b44f" ] ] }, { "id": "255816b014939584", "type": "debug", "z": "7984fdde731ce3dc", "name": "Debug prices", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 930, "y": 360, "wires": [] }, { "id": "0168cd0aedf3a8f5", "type": "debug", "z": "7984fdde731ce3dc", "name": "Debug prices", "active": true, "tosidebar": false, "console": true, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1180, "y": 140, "wires": [] }, { "id": "4659c63e7e3c9437", "type": "inject", "z": "7984fdde731ce3dc", "name": "Run once at startup", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "payload": "", "payloadType": "date", "x": 160, "y": 80, "wires": [ [ "4b94ef581283b76c" ] ] }, { "id": "4b94ef581283b76c", "type": "function", "z": "7984fdde731ce3dc", "name": "Set msg.date to yesterday", "func": "msg.date = new Date()\nmsg.date = msg.date.setDate(msg.date.getDate() -1)\nreturn msg;\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 410, "y": 80, "wires": [ [ "50175fb99f6cac41" ] ] }, { "id": "50175fb99f6cac41", "type": "nordpool-api-plus", "z": "7984fdde731ce3dc", "name": "Get yesterday prices", "area": "FI", "currency": "EUR", "action": "todayOrOverride", "x": 660, "y": 80, "wires": [ [ "b57e453c55352f82" ] ] }, { "id": "b57e453c55352f82", "type": "change", "z": "7984fdde731ce3dc", "name": "Set flow.lasthour", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload[-1]", "tot": "jsonata" }, { "t": "set", "p": "lasthour", "pt": "flow", "to": "payload[-1]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 880, "y": 80, "wires": [ [ "8076fb973142dbcb" ] ] }, { "id": "8076fb973142dbcb", "type": "debug", "z": "7984fdde731ce3dc", "name": "lasthour", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 1060, "y": 80, "wires": [] }, { "id": "bb58663c0cb8b44f", "type": "function", "z": "7984fdde731ce3dc", "name": "CET fix (prepend lasthour)", "func": "\nlasthour=flow.get('lasthour');\ntoday=msg.payload;\ntoday.unshift(lasthour)\n\nmsg.payload=today\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 920, "y": 140, "wires": [ [ "23f73c77b0045184", "0168cd0aedf3a8f5" ] ] }, { "id": "23f73c77b0045184", "type": "change", "z": "7984fdde731ce3dc", "name": "", "rules": [ { "t": "set", "p": "prices", "pt": "global", "to": "payload", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1180, "y": 180, "wires": [ [] ] }, { "id": "19a8bff8c84b6e6e", "type": "complete", "z": "7984fdde731ce3dc", "name": "Run after flow.lasthour set.", "scope": [ "b57e453c55352f82" ], "uncaught": false, "x": 130, "y": 140, "wires": [ [ "d26c9d9b69028a34" ] ] }, { "id": "911421c46d769bf5", "type": "function", "z": "7984fdde731ce3dc", "name": "Append nextday to prices.", "func": "\nvar currentprices=global.get('prices');\nvar tomorrowprices=msg.payload;\nvar mergeResult = currentprices.concat(tomorrowprices);\n\nmsg.payload=mergeResult\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 690, "y": 340, "wires": [ [ "255816b014939584", "416b7cc59da1e1fe" ] ] }, { "id": "416b7cc59da1e1fe", "type": "change", "z": "7984fdde731ce3dc", "name": "", "rules": [ { "t": "set", "p": "prices", "pt": "global", "to": "payload", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 940, "y": 320, "wires": [ [] ] }, { "id": "3fcb2c4247328f15", "type": "inject", "z": "7984fdde731ce3dc", "name": "Run at 23:55", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "55 23 * * *", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 440, "wires": [ [ "c09db060d076aab7", "2d85dfcda2a18802" ] ] }, { "id": "c09db060d076aab7", "type": "function", "z": "7984fdde731ce3dc", "name": "Remove 1 day from prices.", "func": "\nvar currentprices=global.get('prices');\n\n\nmsg.payload=currentprices.slice(24);\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 420, "y": 440, "wires": [ [ "2eab2b01c5cbbd80", "9eebdf852c94798a" ] ] }, { "id": "d26c9d9b69028a34", "type": "change", "z": "7984fdde731ce3dc", "name": "Clear", "rules": [ { "t": "delete", "p": "date", "pt": "msg" }, { "t": "delete", "p": "payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 310, "y": 140, "wires": [ [ "b871ce3d6c14d3b8" ] ] }, { "id": "9eebdf852c94798a", "type": "debug", "z": "7984fdde731ce3dc", "name": "Debug prices", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 690, "y": 460, "wires": [] }, { "id": "2eab2b01c5cbbd80", "type": "change", "z": "7984fdde731ce3dc", "name": "", "rules": [ { "t": "set", "p": "prices", "pt": "global", "to": "payload", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 700, "y": 420, "wires": [ [] ] }, { "id": "2165b32009f680e3", "type": "comment", "z": "7984fdde731ce3dc", "name": "Get last hour from yesterday & todays prices.", "info": "", "x": 210, "y": 40, "wires": [] }, { "id": "97eeca4e17dbc5ef", "type": "comment", "z": "7984fdde731ce3dc", "name": "Append next day to prices", "info": "", "x": 150, "y": 300, "wires": [] }, { "id": "d511b164debc2c19", "type": "comment", "z": "7984fdde731ce3dc", "name": "Remove day from prices.", "info": "", "x": 150, "y": 400, "wires": [] }, { "id": "82528e53f7593521", "type": "complete", "z": "7984fdde731ce3dc", "name": "Run after global.prices set", "scope": [ "23f73c77b0045184", "416b7cc59da1e1fe", "2eab2b01c5cbbd80" ], "uncaught": false, "x": 170, "y": 540, "wires": [ [ "a60f29eeea95d1da" ] ] }, { "id": "153258713f32953b", "type": "comment", "z": "7984fdde731ce3dc", "name": "Run when prices change", "info": "", "x": 170, "y": 500, "wires": [] }, { "id": "cd118c223e39d198", "type": "inject", "z": "7984fdde731ce3dc", "name": "Manual trigger chart update", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 180, "y": 580, "wires": [ [ "a60f29eeea95d1da" ] ] }, { "id": "7dc8959c.d709ec", "type": "function", "z": "7984fdde731ce3dc", "name": "chart data", "func": "var msg1 = {}\nfor (var i = 0; i $r.price}\t)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 210, "y": 660, "wires": [ [ "385d08960fa22ab9" ] ] }, { "id": "385d08960fa22ab9", "type": "change", "z": "7984fdde731ce3dc", "name": "Get cheapest hours.", "rules": [ { "t": "set", "p": "top", "pt": "flow", "to": "payload[[0]]", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "payload[[0]]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 400, "y": 660, "wires": [ [ "65480f8b261edb19" ] ] }, { "id": "65480f8b261edb19", "type": "debug", "z": "7984fdde731ce3dc", "name": "Debug prices", "active": true, "tosidebar": false, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 610, "y": 660, "wires": [] }, { "id": "2d85dfcda2a18802", "type": "change", "z": "7984fdde731ce3dc", "name": "Set empty payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "[]", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 410, "y": 480, "wires": [ [ "73db76b0.e5bdd8" ] ] }, { "id": "f3abb95c0a420d81", "type": "inject", "z": "7984fdde731ce3dc", "name": "Clear chart manually", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "[]", "payloadType": "json", "x": 910, "y": 460, "wires": [ [ "73db76b0.e5bdd8" ] ] }, { "id": "82ab22056ded267e", "type": "switch", "z": "7984fdde731ce3dc", "name": "", "property": "payload", "propertyType": "msg", "rules": [ { "t": "jsonata_exp", "v": "$count(payload)>1\t", "vt": "jsonata" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 570, "y": 540, "wires": [ [ "7dc8959c.d709ec" ], [ "3553d163306e7bb9" ] ] }, { "id": "3553d163306e7bb9", "type": "debug", "z": "7984fdde731ce3dc", "name": "Prices error", "active": true, "tosidebar": false, "console": true, "tostatus": false, "complete": "\"Chart data empty\"", "targetType": "jsonata", "statusVal": "", "statusType": "auto", "x": 760, "y": 600, "wires": [] }, { "id": "f7920408c4a762e9", "type": "complete", "z": "7984fdde731ce3dc", "name": "Run after Prices error", "scope": [ "3553d163306e7bb9" ], "uncaught": false, "x": 120, "y": 220, "wires": [ [ "f8d024dcf34214a8" ] ] }, { "id": "5fdd175b7e60d71e", "type": "switch", "z": "7984fdde731ce3dc", "name": "Check if hour = 23", "property": "payload", "propertyType": "msg", "rules": [ { "t": "jsonata_exp", "v": "\"23\"!=$fromMillis($millis(),'[H#1]','200')\t", "vt": "jsonata" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 450, "y": 180, "wires": [ [ "b871ce3d6c14d3b8" ], [ "19ed32eea493c1d4" ] ] }, { "id": "19ed32eea493c1d4", "type": "nordpool-api-plus", "z": "7984fdde731ce3dc", "name": "Get tomorrow prices", "area": "FI", "currency": "EUR", "action": "dayAhead", "x": 680, "y": 200, "wires": [ [ "f60f1a15f0e64e90" ] ] }, { "id": "f8d024dcf34214a8", "type": "change", "z": "7984fdde731ce3dc", "name": "Clear", "rules": [ { "t": "delete", "p": "date", "pt": "msg" }, { "t": "delete", "p": "payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 290, "y": 200, "wires": [ [ "5fdd175b7e60d71e" ] ] }, { "id": "f60f1a15f0e64e90", "type": "function", "z": "7984fdde731ce3dc", "name": "Append nextday to prices.", "func": "\nvar currentprices=global.get('prices');\nvar tomorrowprices=msg.payload;\nvar mergeResult = currentprices.concat(tomorrowprices);\n\nmsg.payload=mergeResult\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 930, "y": 200, "wires": [ [ "23f73c77b0045184", "04793b36fd0840de" ] ] }, { "id": "04793b36fd0840de", "type": "debug", "z": "7984fdde731ce3dc", "name": "Debug prices 23", "active": true, "tosidebar": false, "console": true, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1190, "y": 220, "wires": [] }, { "id": "c4d5ce0477c39264", "type": "ui_group", "name": "Nordpool Spot", "tab": "620143accf77ad3e", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "620143accf77ad3e", "type": "ui_tab", "name": "Home", "icon": "dashboard", "disabled": false, "hidden": false } ]