Here you go.
Please take the time to look closely what i changed. I heavily commented the function node to assist your learning - please try to figure it out.
sanitised flow...
[{"id":"4a249378.25a16c","type":"comment","z":"b1c27b9d.5a0ab8","name":"Efergy - Get Power Consumption","info":"Get and Put Sensor data","x":210,"y":200,"wires":[]},{"id":"accaddc3.362e2","type":"http request","z":"b1c27b9d.5a0ab8","name":"V1 URL","method":"GET","ret":"obj","paytoqs":false,"url":"https://engage.efergy.com/mobile_proxy/getInstant?token=xxxxxxxxx","tls":"","persist":false,"proxy":"","authType":"","x":140,"y":320,"wires":[["d1777e14.ac83e"]]},{"id":"382683be.59561c","type":"debug","z":"b1c27b9d.5a0ab8","name":"Time","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":870,"y":240,"wires":[]},{"id":"2933877c.95f368","type":"function","z":"b1c27b9d.5a0ab8","name":"Process values","func":"//V1 = getInstant: If payload is NOT an array, we are using getInstant\n//V2 = getCurrentValuesSummary: If payload IS an array, we are using getCurrentValuesSummary\n\n//As it already works for V1, we will translate V2 data to V1 style.\n\n//the style of V1 data is ...\n//{\"age\":0,\"last_reading_time\":1588755045000,\"reading\":233}\n\n\nvar V = 0;//unknown\nif(typeof msg.payload == \"object\"){\n V = 1;//payload is an object! Set V to 1\n}\nif(Array.isArray(msg.payload)){\n V = 2;//payload is an Array! Set V to 2\n}\n\n\nif(V === 1){\n //for V1 we add .date to the payload & return it\n msg.orig_data_v1 = {...msg.payload};//copy the original data here for later debugging\n msg.payload.date = new Date(msg.payload.last_reading_time);\n return msg;\n} else if(V === 2) {\n //make data compatible to V1\n //The reading should be in payload.reading\n //\n //The date value we want is the 1st KEY of payload[0].data[0]\n //because the time stamp is a key not a value\n // {\n // \"cid\":\"PWER\",\n // \"data\":[{\"1588754281000\":718}], << time stamp is a KEY! crazy!\n // \"sid\":\"778544\",\n // \"units\":\"W\",\n // \"age\":3\n // }\n var newPayload;\n msg.orig_data_v2 = msg.payload;//copy the original data here for later debugging\n var itemOfInterest = msg.payload[0];\n \n //inside the V2 data should be a data[] array.\n //if its not an array or its empty, throw an error\n if(Array.isArray(itemOfInterest.data) === false){\n throw new error(\"data array not found - invalid data\")\n }\n \n if(itemOfInterest.data.length <= 0){\n throw new error(\"data array is empty - invalid data\")\n }\n \n //now get the timestamp of 1st data element\n var keys = Object.keys(itemOfInterest.data[0] || {}); //\n if(keys.length <= 0){\n throw new Error(\"no data found in msg.payload[0].data[0]\")\n }\n let key = keys[0];//get key name (this is also the time stamp - stupid design)\n let last_reading_time = parseInt(key);\n let keyVal = itemOfInterest.data[0][key];//get the value of the first key\n //now build a new payload in format of V1\n msg.payload = {\n last_reading_time: last_reading_time, //get the timestamp from first key in keys\n date : new Date(last_reading_time).toString(), \n age : itemOfInterest.age,\n cid : itemOfInterest.cid,\n reading: keyVal,\n units: itemOfInterest.units\n }\n return msg;\n} else {\n throw new Error(\"Unable to determine data version\")\n}\n","outputs":1,"noerr":0,"x":620,"y":300,"wires":[["e9af5cc2.dcfcb","382683be.59561c","5f92417e.e2cb7","fd870e93.2aec3"]]},{"id":"d300039.3ce8f","type":"ui_chart","z":"b1c27b9d.5a0ab8","name":"Efergy - Chart","group":"f60c1c41.e1741","order":1,"width":0,"height":0,"label":"Efergy - Chart","chartType":"line","legend":"false","xformat":"%a %H:%M","interpolate":"linear","nodata":"waiting for inject...","ymin":"0","ymax":"3.2","removeOlder":"1","removeOlderUnit":"86400","outputs":1,"x":900,"y":400,"wires":[[]]},{"id":"287dda19.d420d6","type":"ui_gauge","z":"b1c27b9d.5a0ab8","name":"Efergy - Reading","group":"f60c1c41.e1741","order":2,"width":0,"height":0,"gtype":"gage","title":"Efergy - Reading","label":"kW","format":"{{value}} ","min":"0","max":"3.2","colors":["#00ff00","#ffff80","#ca3838"],"seg1":"","seg2":"","x":910,"y":440,"wires":[]},{"id":"d8c2d3fb.45741","type":"debug","z":"b1c27b9d.5a0ab8","name":"Power [kW]","active":false,"tosidebar":true,"console":false,"complete":"payload","x":890,"y":480,"wires":[]},{"id":"500e9d42.13caf4","type":"range","z":"b1c27b9d.5a0ab8","minin":"0","maxin":"1000","minout":"0","maxout":"1","action":"scale","round":false,"property":"payload","name":"Scaler","x":650,"y":420,"wires":[["287dda19.d420d6","d300039.3ce8f","d8c2d3fb.45741"]]},{"id":"e9af5cc2.dcfcb","type":"ui_text","z":"b1c27b9d.5a0ab8","group":"f60c1c41.e1741","order":3,"width":0,"height":0,"name":"Efergy - Time Stamp","label":"Efergy - Timestamp:","format":"{{msg.payload.date}}","layout":"col-center","x":920,"y":280,"wires":[]},{"id":"81d55671.67c0d8","type":"inject","z":"b1c27b9d.5a0ab8","name":"Poll trigger","topic":"efergy","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":280,"wires":[["accaddc3.362e2"]]},{"id":"39db22a4.085cee","type":"debug","z":"b1c27b9d.5a0ab8","name":"good data","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":400,"y":270,"wires":[]},{"id":"2c88ad29.e08332","type":"mqtt out","z":"b1c27b9d.5a0ab8","name":"","topic":"cmnd/linknode-r4/power1","qos":"0","retain":"","broker":"91974801.1d5348","x":390,"y":720,"wires":[]},{"id":"b9848359.f4886","type":"inject","z":"b1c27b9d.5a0ab8","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":150,"y":720,"wires":[["2c88ad29.e08332"]]},{"id":"1385010d.ff469f","type":"inject","z":"b1c27b9d.5a0ab8","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":150,"y":760,"wires":[["2c88ad29.e08332"]]},{"id":"d63f80f8.a66fd","type":"inject","z":"b1c27b9d.5a0ab8","name":"","topic":"","payload":"toggle","payloadType":"str","repeat":"","crontab":"","once":false,"x":150,"y":800,"wires":[["2c88ad29.e08332"]]},{"id":"c860661b.eca998","type":"comment","z":"b1c27b9d.5a0ab8","name":"MQTT control","info":"Controlling the relay via MQTT\n\nroot topic followed by relay/0/set\naccepted messages:\n0: off\n1: on\n2: toggle","x":150,"y":640,"wires":[]},{"id":"1329881b.d99a38","type":"inject","z":"b1c27b9d.5a0ab8","name":"","topic":"","payload":"blink","payloadType":"str","repeat":"","crontab":"","once":false,"x":150,"y":840,"wires":[["2c88ad29.e08332"]]},{"id":"d1777e14.ac83e","type":"switch","z":"b1c27b9d.5a0ab8","name":"statusCode == 200?","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":320,"wires":[["2933877c.95f368","39db22a4.085cee"],["31c461e8.04297e"]]},{"id":"31c461e8.04297e","type":"debug","z":"b1c27b9d.5a0ab8","name":"bad data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":400,"y":369,"wires":[]},{"id":"5f92417e.e2cb7","type":"change","z":"b1c27b9d.5a0ab8","name":"payload.reading > payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.reading","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":360,"wires":[["500e9d42.13caf4","d5f2ec7.051391"]]},{"id":"d5f2ec7.051391","type":"debug","z":"b1c27b9d.5a0ab8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":870,"y":360,"wires":[]},{"id":"b94c43d7.48bdd","type":"switch","z":"b1c27b9d.5a0ab8","name":"reading > 2000?","property":"payload.reading","propertyType":"msg","rules":[{"t":"gte","v":"2000","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":206,"y":560,"wires":[["ba9fee7a.83d08"],["3a66945b.1b711c"]]},{"id":"fd870e93.2aec3","type":"link out","z":"b1c27b9d.5a0ab8","name":"to Control Logic -->","links":["aaaa75dd.178b08"],"x":915,"y":320,"wires":[],"l":true},{"id":"aaaa75dd.178b08","type":"link in","z":"b1c27b9d.5a0ab8","name":"","links":["fd870e93.2aec3"],"x":94,"y":560,"wires":[["b94c43d7.48bdd"]]},{"id":"bde601d5.d8bc4","type":"trigger","z":"b1c27b9d.5a0ab8","op1":"","op2":"on","op1type":"nul","op2type":"str","duration":"20","extend":false,"units":"s","reset":"","bytopic":"all","name":"Wait 20s then send \"on\"","x":649,"y":540,"wires":[["3a9326c6.b364aa"]]},{"id":"3a66945b.1b711c","type":"change","z":"b1c27b9d.5a0ab8","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":419,"y":600,"wires":[["bde601d5.d8bc4","ba9fee7a.83d08","e4fa88c8.226ae8"]]},{"id":"ba9fee7a.83d08","type":"trigger","z":"b1c27b9d.5a0ab8","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":419,"y":540,"wires":[["bde601d5.d8bc4"]]},{"id":"e4fa88c8.226ae8","type":"change","z":"b1c27b9d.5a0ab8","name":"set payload off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"},{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":619,"y":600,"wires":[["3a9326c6.b364aa"]]},{"id":"7af53c49.a5f6a4","type":"link in","z":"b1c27b9d.5a0ab8","name":"-> on/off","links":["3f253d43.166872"],"x":140,"y":680,"wires":[["2c88ad29.e08332","6740cc45.ba9e84"]],"l":true},{"id":"3f253d43.166872","type":"link out","z":"b1c27b9d.5a0ab8","name":"send on/off -->","links":["7af53c49.a5f6a4"],"x":899,"y":600,"wires":[],"l":true},{"id":"6740cc45.ba9e84","type":"debug","z":"b1c27b9d.5a0ab8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":350,"y":680,"wires":[]},{"id":"3a9326c6.b364aa","type":"rbe","z":"b1c27b9d.5a0ab8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":869,"y":540,"wires":[["3f253d43.166872"]]},{"id":"d307ad1d.d5cb4","type":"comment","z":"b1c27b9d.5a0ab8","name":"Control logic","info":"Get and Put Sensor data","x":149,"y":520,"wires":[]},{"id":"6e2adb52.bd0a24","type":"http request","z":"b1c27b9d.5a0ab8","name":"V2 URL","method":"GET","ret":"obj","paytoqs":false,"url":"http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token=xxxxxxxxxxxxx","tls":"","persist":false,"proxy":"","authType":"","x":140,"y":400,"wires":[["d1777e14.ac83e"]]},{"id":"3af814c8.75730c","type":"inject","z":"b1c27b9d.5a0ab8","name":"Poll trigger","topic":"efergy","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":360,"wires":[["6e2adb52.bd0a24"]]},{"id":"1b0124c4.021c6b","type":"inject","z":"b1c27b9d.5a0ab8","name":"Fake V2 data 640 W","topic":"efergy","payload":"[{\"cid\":\"PWER\",\"data\":[{\"1588756181000\":640}],\"sid\":\"778544\",\"units\":\"W\",\"age\":10},{\"cid\":\"PWER\",\"data\":[{\"1588756185000\":318}],\"sid\":\"838150\",\"units\":\"W\",\"age\":6},{\"cid\":\"PWER_SUB\",\"data\":[{\"1588756187000\":169}],\"sid\":\"770194\",\"units\":\"W\",\"age\":4}]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":610,"y":80,"wires":[["66a00c4e.33bb54"]]},{"id":"5b6c2519.72464c","type":"inject","z":"b1c27b9d.5a0ab8","name":"Fake V2 data 2025W","topic":"efergy","payload":"[{\"cid\":\"PWER\",\"data\":[{\"1588756181000\":2025}],\"sid\":\"778544\",\"units\":\"W\",\"age\":10},{\"cid\":\"PWER\",\"data\":[{\"1588756185000\":318}],\"sid\":\"838150\",\"units\":\"W\",\"age\":6},{\"cid\":\"PWER_SUB\",\"data\":[{\"1588756187000\":169}],\"sid\":\"770194\",\"units\":\"W\",\"age\":4}]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":620,"y":120,"wires":[["66a00c4e.33bb54"]]},{"id":"66a00c4e.33bb54","type":"change","z":"b1c27b9d.5a0ab8","name":"","rules":[{"t":"set","p":"statusCode","pt":"msg","to":"200","tot":"num"},{"t":"set","p":"payload.last_reading_time","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":775,"y":80,"wires":[["5bb51509.f0121c"]],"l":false},{"id":"c7208d72.8c616","type":"link out","z":"b1c27b9d.5a0ab8","name":"","links":["79befa9e.011164"],"x":415,"y":80,"wires":[]},{"id":"41f5c25e.086ebc","type":"comment","z":"b1c27b9d.5a0ab8","name":"V1 Test data (uses getInstant API)","info":"Get and Put Sensor data","x":220,"y":40,"wires":[]},{"id":"68fc93dc.ea427c","type":"inject","z":"b1c27b9d.5a0ab8","name":"Fake V1 data 633 W","topic":"efergy","payload":"{\"age\":2,\"last_reading_time\":1588673388000,\"reading\":633}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":80,"wires":[["62a58709.c50fb8"]]},{"id":"8ecabd4f.f925e","type":"inject","z":"b1c27b9d.5a0ab8","name":"Fake V1 data 2011W","topic":"efergy","payload":"{\"age\":2,\"last_reading_time\":1588673388000,\"reading\":2011}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":120,"wires":[["62a58709.c50fb8"]]},{"id":"62a58709.c50fb8","type":"change","z":"b1c27b9d.5a0ab8","name":"","rules":[{"t":"set","p":"statusCode","pt":"msg","to":"200","tot":"num"},{"t":"set","p":"payload.last_reading_time","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":355,"y":80,"wires":[["c7208d72.8c616"]],"l":false},{"id":"79befa9e.011164","type":"link in","z":"b1c27b9d.5a0ab8","name":"--> test data","links":["5bb51509.f0121c","c7208d72.8c616"],"x":150,"y":240,"wires":[["d1777e14.ac83e"]],"l":true},{"id":"5bb51509.f0121c","type":"link out","z":"b1c27b9d.5a0ab8","name":"","links":["79befa9e.011164"],"x":835,"y":80,"wires":[]},{"id":"75f0c38.3e33f3c","type":"comment","z":"b1c27b9d.5a0ab8","name":"V2 Test data (uses getCurrentValuesSummary API)","info":"Get and Put Sensor data","x":690,"y":40,"wires":[]},{"id":"f60c1c41.e1741","type":"ui_group","z":"","name":"Energy","tab":"79f14fa.889beb","order":null,"disp":true,"width":"6"},{"id":"91974801.1d5348","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.5","port":"1883","clientid":"node-red","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"79f14fa.889beb","type":"ui_tab","name":"Home","icon":"dashboard","order":"1"}]