Skip to content

Instantly share code, notes, and snippets.

@richardsg307
Last active January 7, 2024 09:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardsg307/9abafd9b15b7fa5bbbf577f35c444ec6 to your computer and use it in GitHub Desktop.
Save richardsg307/9abafd9b15b7fa5bbbf577f35c444ec6 to your computer and use it in GitHub Desktop.
Owl Intuition Full Featured Control Dashboard (almost) for Heating and Electricity

A few years ago Owl started charging for their service that enabled me to interrogate and update the settings of my Owl Intuition system. The main part I had was Central Heating control and monitoring of a single phase electrical supply. I decided then to write something to replace there service and be able to do it all myself. But I had no idea how to until I discovered Node-Red, which seemed to make communications with the Owl over UDP simple. So this project started as way for me to learn about Node-Red and how to use it.

A couple of months later the flow below has matured enough for me to be reasonably confident in publishing it for others to use and/or modify for their own purpose. I'm not saying it's perfect but it works for me.

The Flow enables you to control the Heating with buttons for switching between Comfort and Standby together with Toggle Buttons for Boosting or setting Away. The logic behind the buttons is a bit complex and has to cope with other methods being used to control the system (eg the wall thermostat panel).

In addition you can set the heating times (I've implemented up to 4 per day but the Flow could be amended to take it up to the 10 permitted). These can be set for the day or the week.

A future Away period can also be set, as can other parameters like Boost Increment, Boost Time and Minimum Temperature when in Standby.

On the Electrical side, you can set the Day and kWh costs to see what the daily charge is looking like.

I don't have the Hot Water or Solar Panel side, so have not included them in this project. Also, some more obscure commands are left out. However, I have implemented a free form Command Entry tab where, if you know the commands, you can type them in directly. You can also check the built in outgoing commands and the responses on this tab.

I implemented it on a Raspberry Pi4 with Node-Red running as an Integration within Home Assistant, but I have also run the Flow OK on a Windows 10 PC having installed node.js and Node-Red on it.

Once you copy the Flow into your Node-Red you will need to update the IP address to that of your Owl (you will need to fix it through your Router) in the UDP Output node. You may also want to change the local Port from 8887 to something else, but remember to also change that on the UDP input node. The other thing to change is your unique UDP key in the Function just before the UDP output node. You get your unique UDP key from the main Owl dashboard under System Set Data Push.

I've also got the flow to operate the Comfort, Standby and Boost buttons from an Alexa command, but this took quite a bit of effort that I'm not going to explain here. If you don't want that then just delete those nodes.

Having integrated it with Home Assistant, I also have a UDP Multicast sniffer listening out for messages from the Owl and reporting them to Home Assistant through an MQTT broker. I originally had an ESP8266 doing that job but when I realised Node-Red could do it I freed up the micro-controller.

To get to the Dashboard that this flow creates, open a new tab in the browser and type "IP of your Node-Red instance:1880/endpoint/ui".

Finally, I'm no expert programmer so there may be some bugs in the Flow and the Functions, and they may not be the best solutions but I am happy for constructive criticism or suggestions for improvement.

Enjoy.

[{"id":"ebf0c16.a3b5d4","type":"tab","label":"Owl Control Panel","disabled":false,"info":""},{"id":"2f5c71d4.6d97fe","type":"udp in","z":"ebf0c16.a3b5d4","name":"Multicast Sniffer","iface":"","port":"22600","ipv":"udp4","multicast":"true","group":"224.192.32.19","datatype":"utf8","x":100,"y":320,"wires":[["258c4c83.ef55a4"]]},{"id":"258c4c83.ef55a4","type":"switch","z":"ebf0c16.a3b5d4","name":"Message Switch","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"electricity","vt":"str"},{"t":"cont","v":"weather","vt":"str"},{"t":"cont","v":"heating","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":140,"y":200,"wires":[["b5564a54.2aac38"],["d3ad468a.21b688"],["e6384005.aa436"]],"inputLabels":["Raw UDP Message"]},{"id":"2c6a45e0.bf3c7a","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Get Version","group":"4017027e.ebfbfc","order":3,"width":3,"height":1,"passthru":false,"label":"Version","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,VERSION","payloadType":"str","topic":"","x":1850,"y":180,"wires":[["dfaa1a1.16f70e8"]],"outputLabels":["Command"]},{"id":"e9a9d183.8e523","type":"udp in","z":"ebf0c16.a3b5d4","name":"Get Owl Responses","iface":"","port":"8887","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":110,"y":920,"wires":[["17c9dc5c.879fa4","1cdb50e8.0ced4f"]],"info":"The Port must match the sending node's Binding Port"},{"id":"ec5b8d3b.6161c","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":13,"width":3,"height":1,"passthru":false,"label":"Devices","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,DEVICE,ALL","payloadType":"str","topic":"","x":1860,"y":220,"wires":[["dfaa1a1.16f70e8"]]},{"id":"77c4dcd8.18a0d4","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":5,"width":3,"height":1,"passthru":false,"label":"Get Uptime","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,UPTIME","payloadType":"str","topic":"","x":1850,"y":260,"wires":[["dfaa1a1.16f70e8"]]},{"id":"17c9dc5c.879fa4","type":"csv","z":"ebf0c16.a3b5d4","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":110,"y":1300,"wires":[["24040dec.2bd232"]]},{"id":"ee664b4b.892fb8","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":4,"width":5,"height":1,"name":"Model","label":"","format":"{{msg.payload}}","layout":"row-left","x":830,"y":900,"wires":[]},{"id":"24040dec.2bd232","type":"switch","z":"ebf0c16.a3b5d4","name":"Owl Responce Switch","property":"payload.col2","propertyType":"msg","rules":[{"t":"eq","v":"VERSION","vt":"str"},{"t":"eq","v":"UPTIME","vt":"str"},{"t":"eq","v":"MAC","vt":"str"},{"t":"eq","v":"DEVICE","vt":"str"},{"t":"eq","v":"UDP","vt":"str"},{"t":"eq","v":"CLOCK","vt":"str"},{"t":"eq","v":"TARIFF","vt":"str"},{"t":"eq","v":"DAYHEATINGPERIODS","vt":"str"},{"t":"eq","v":"ELECTRICITY","vt":"str"},{"t":"eq","v":"TZ","vt":"str"},{"t":"eq","v":"HOLIDAY","vt":"str"},{"t":"eq","v":"SUMMER","vt":"str"},{"t":"eq","v":"PROPERTY","vt":"str"},{"t":"eq","v":"DST","vt":"str"},{"t":"eq","v":"COMFORT","vt":"str"},{"t":"eq","v":"STANDBY","vt":"str"},{"t":"eq","v":"AWAY","vt":"str"},{"t":"eq","v":"HEATING","vt":"str"},{"t":"eq","v":"BOOST","vt":"str"}],"checkall":"true","repair":false,"outputs":19,"x":280,"y":1300,"wires":[["b521de6e.ae6bc"],["9efeddaa.104d6"],["a5f30f7f.3326c"],["2e535c79.317dd4"],["53c68df3.9bab94"],[],["898dcca1.af6ea"],["498427f4.444218"],[],[],[],[],[],[],[],[],["75bf0da3.603fc4"],["c8b9ac74.8c236"],[]]},{"id":"88a44ab9.175198","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":14,"width":5,"height":1,"name":"Device","label":"","format":"{{msg.payload}}","layout":"row-left","x":790,"y":1020,"wires":[]},{"id":"9efeddaa.104d6","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":6,"width":5,"height":1,"name":"Uptime","label":"","format":"{{msg.payload.col3}}","layout":"row-left","x":660,"y":940,"wires":[]},{"id":"a5f30f7f.3326c","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":8,"width":5,"height":1,"name":"MAC","label":"","format":"{{msg.payload.col3}}","layout":"row-left","x":650,"y":980,"wires":[]},{"id":"ed1fca0a.e63548","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"GET,VERSION","payloadType":"str","x":1300,"y":200,"wires":[["dfaa1a1.16f70e8"]]},{"id":"288e9378.22097c","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"GET,DEVICE,ALL","payloadType":"str","x":1290,"y":240,"wires":[["dfaa1a1.16f70e8"]]},{"id":"db788914.67f968","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1.5","topic":"","payload":"GET,UPTIME","payloadType":"str","x":1300,"y":280,"wires":[["dfaa1a1.16f70e8"]]},{"id":"66a5ba38.bacfc4","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"GET,MAC","payloadType":"str","x":1310,"y":320,"wires":[["dfaa1a1.16f70e8"]]},{"id":"3dd1480.240abb8","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"2.5","topic":"","payload":"GET,UDP","payloadType":"str","x":1320,"y":360,"wires":[["dfaa1a1.16f70e8"]]},{"id":"6ca0747b.af861c","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":10,"width":5,"height":1,"name":"UDP IP","label":" ","format":"{{msg.payload}}","layout":"row-left","x":800,"y":1060,"wires":[]},{"id":"65323d93.a19da4","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":9,"width":3,"height":1,"passthru":false,"label":"UDP Push","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,UDP","payloadType":"str","topic":"","x":1850,"y":340,"wires":[["dfaa1a1.16f70e8"]]},{"id":"2fa4eeff.f3d8c2","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":7,"width":3,"height":1,"passthru":false,"label":"MAC Address","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,MAC","payloadType":"str","topic":"","x":1840,"y":300,"wires":[["dfaa1a1.16f70e8"]]},{"id":"9c216bf.bde0598","type":"ui_gauge","z":"ebf0c16.a3b5d4","name":"Power","group":"7b890bde.739cf4","order":2,"width":0,"height":0,"gtype":"gage","title":"Power (W)","label":"Watts","format":"{{value}}","min":0,"max":"10000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":890,"y":120,"wires":[]},{"id":"e6384005.aa436","type":"xml","z":"ebf0c16.a3b5d4","name":"Heating","property":"payload","attr":"","chr":"","x":360,"y":280,"wires":[["f70ee793.79e478"]]},{"id":"d3ad468a.21b688","type":"xml","z":"ebf0c16.a3b5d4","name":"Weather","property":"payload","attr":"","chr":"","x":360,"y":220,"wires":[["17e9ebb7.5d3f24"]]},{"id":"b5564a54.2aac38","type":"xml","z":"ebf0c16.a3b5d4","name":"Electricity","property":"payload","attr":"","chr":"","x":360,"y":80,"wires":[["ed6fe25c.954bf"]]},{"id":"dc0e12dc.605e5","type":"ui_chart","z":"ebf0c16.a3b5d4","name":"Temp Chart","group":"4891585b.501088","order":5,"width":0,"height":0,"label":"Temperature Chart (°C)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Waiting for data","dot":false,"ymin":"0","ymax":"30","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":910,"y":320,"wires":[[]]},{"id":"7f3f21fa.495ae","type":"ui_gauge","z":"ebf0c16.a3b5d4","name":"Hall Temp","group":"4891585b.501088","order":2,"width":0,"height":0,"gtype":"gage","title":"Hall Temperature (°C)","label":"°C","format":"{{value}}","min":0,"max":"30","colors":["#00b500","#e6e600","#ca3838"],"seg1":"20","seg2":"25","x":900,"y":480,"wires":[]},{"id":"17e9ebb7.5d3f24","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msg1 = {}; // Temperature for chart\nvar msgwm = {}; // Weather message counter\nvar msg3 = {}; // Weather string\nvar msgmqtt = {};\n\n// Message count\nif (typeof flow.get(\"wm\") == 'undefined') {\n flow.set(\"wm\", 1);\n}else{\n flow.set(\"wm\", flow.get(\"wm\") + 1); \n}\nmsgwm.payload = flow.get(\"wm\");\n\n// Ambient temperature for chart\nmsg1.topic = \"Ambient Temperature\";\nmsg1.payload = msg.payload.weather.temperature[0];\n\n// Temperature and Weather message string for display\nmsg3.payload = msg.payload.weather.temperature[0] + \"°C - \" + msg.payload.weather.text[0]; // Temp and Weather\n\n// Build the MQTT message for Home Assistant\nmsgmqtt.topic = \"tele/owl/weather\"\nmsgmqtt.payload = \"{\\\"Weather\\\":{\\\"Ambient\\\":\"\nmsgmqtt.payload += msg.payload.weather.temperature[0];\nmsgmqtt.payload += \",\\\"Weather\\\":\\\"\"\nmsgmqtt.payload += msg.payload.weather.text[0]\nmsgmqtt.payload += \"\\\"}}\"\n\nreturn [msg1, msgwm, msg3, msgmqtt];","outputs":4,"noerr":0,"initialize":"","finalize":"","x":520,"y":220,"wires":[["dc0e12dc.605e5","8bd8d785.30f948"],["2330fd07.cbd8f2"],["897be659.e22ca8"],["76fa1a2c.6a6d34"]]},{"id":"e24eb583.e93b78","type":"ui_chart","z":"ebf0c16.a3b5d4","name":"","group":"7b890bde.739cf4","order":3,"width":0,"height":0,"label":"Power Levels (W)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":930,"y":160,"wires":[[]]},{"id":"adf95d20.3e433","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Comfort","group":"e9add7f2.770078","order":4,"width":4,"height":1,"passthru":false,"label":"{{label}}","tooltip":"Start the next Comfort period now. No effect if already in Comfort.","color":"","bgcolor":"{{colour}}","icon":"","payload":"COMFORT","payloadType":"str","topic":"","x":900,"y":620,"wires":[["dfaa1a1.16f70e8"]]},{"id":"1cdb50e8.0ced4f","type":"ui_text","z":"ebf0c16.a3b5d4","group":"f589e73.7f8e918","order":2,"width":0,"height":0,"name":"Responses","label":"","format":"{{msg.payload}}","layout":"row-left","x":330,"y":920,"wires":[]},{"id":"b8b9bcce.e9262","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Standby","group":"e9add7f2.770078","order":5,"width":4,"height":1,"passthru":false,"label":"{{label}}","tooltip":"Sets system to Standby pending the next Comfort period.","color":"","bgcolor":"{{colour}}","icon":"","payload":"STANDBY","payloadType":"str","topic":"","x":900,"y":660,"wires":[["dfaa1a1.16f70e8"]]},{"id":"78696be1.b037a4","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Away","group":"e9add7f2.770078","order":6,"width":4,"height":1,"passthru":false,"label":"{{label}}","tooltip":"Toggle. Put the system into Away mode (ie no heating unless the hall temperature drops below 15°C), or back into Standby.","color":"","bgcolor":"{{colour}}","icon":"","payload":"SET,AWAY","payloadType":"str","topic":"","x":890,"y":700,"wires":[["dfaa1a1.16f70e8"]]},{"id":"9f257fc0.346fc","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msgbb = {};\nvar msgcb = {};\nvar msgsb = {};\nvar msgab = {};\n\nmsgbb.label = \"Boost\";\nmsgcb.label = \"Comfort\";\nmsgsb.label = \"Standby\";\nmsgab.label = \"Away\";\n\nmsgbb.colour = \"#3FADB5\"; // greenish\nmsgcb.colour = \"#3FADB5\"; // greenish\nmsgsb.colour = \"#3FADB5\"; // greenish\nmsgab.colour = \"#3FADB5\"; // greenish\n\nreturn [msgbb, msgcb, msgsb, msgab]","outputs":4,"noerr":0,"initialize":"","finalize":"","x":520,"y":580,"wires":[["c3058314.4cbad"],["adf95d20.3e433"],["b8b9bcce.e9262"],["78696be1.b037a4"]]},{"id":"c3058314.4cbad","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Boost","group":"e9add7f2.770078","order":3,"width":4,"height":1,"passthru":false,"label":"{{label}}","tooltip":"Toggle. Turns the Boost On or Off.","color":"","bgcolor":"{{colour}}","icon":"","payload":"BOOST","payloadType":"str","topic":"","x":890,"y":580,"wires":[["dfaa1a1.16f70e8"]]},{"id":"3edb3ba7.82cc24","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"GET,TARIFF","payloadType":"str","x":1310,"y":400,"wires":[["dfaa1a1.16f70e8"]]},{"id":"74875211.45d93c","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":11,"width":3,"height":1,"passthru":true,"label":"Tariff","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,TARIFF","payloadType":"str","topic":"","x":1870,"y":380,"wires":[["dfaa1a1.16f70e8"]]},{"id":"898dcca1.af6ea","type":"function","z":"ebf0c16.a3b5d4","name":"Rates","func":"var msgd = {};\nvar msgk = {};\nvar msgr = {};\n\nmsgr.payload = msg.payload.col4;\nmsgr.payload += \" / \";\nmsgr.payload += msg.payload.col5;\n\nmsgd.payload = msg.payload.col4;\n\nmsgk.payload = msg.payload.col5;\n\nreturn [msgd, msgk, msgr];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","x":650,"y":1140,"wires":[["68d7cc87.790a24"],["8992a907.766678"],["4823bc69.6c6244"]]},{"id":"b521de6e.ae6bc","type":"function","z":"ebf0c16.a3b5d4","name":"Version","func":"var v = {};\nv.payload = msg.payload.col3;\nv.payload += \" V \" + msg.payload.col4;\nv.payload += \" : \" + msg.payload.col5;\nreturn v;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":900,"wires":[["ee664b4b.892fb8"]]},{"id":"53c68df3.9bab94","type":"function","z":"ebf0c16.a3b5d4","name":"UDP","func":"var v = {};\nv.payload = msg.payload.col4;\nv.payload += \":\" + msg.payload.col5;\nreturn v;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":1060,"wires":[["6ca0747b.af861c"]]},{"id":"4f36dfce.714ba","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"drate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":960,"y":1100,"wires":[[]]},{"id":"a1f045d1.9a3b58","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"badbc62a.b26778","order":4,"width":4,"height":1,"passthru":false,"label":"Commit Tariff Changes","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":2140,"y":380,"wires":[["25d32c8d.b84204"]],"info":"//var msg = {};\n//msg.payload = global.get(\"drate\");\n//msg.payload += \",\";\n//msg.payload += global.get(\"krate\");\n//return msg;\nstring s = global.get(\"drate\");\n"},{"id":"25d32c8d.b84204","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"\nvar msg1 = {};\nmsg1.payload = \"SET,TARIFF,1,\";\nmsg1.payload += global.get(\"drate\");\nmsg1.payload += \",\"; // The 1 is needed due to a rounding down\nmsg1.payload += global.get(\"krate\");\nreturn msg1;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2240,"y":320,"wires":[["5fa95a77.4baa54","dfaa1a1.16f70e8"]]},{"id":"a426c36a.72534","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"krate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":960,"y":1140,"wires":[[]]},{"id":"5fa95a77.4baa54","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2200,"y":240,"wires":[["74875211.45d93c"]]},{"id":"ed6fe25c.954bf","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msgem = {}; // Count of Energy messages\nvar msgtc = {}; // Today's consumption Watt Hours \nvar msgpwr = {}; // Live power reading\nvar msgyc = {}; // Yesterday's cost\nvar msgmqtt = {}; // MQTT output for Home Assistant\nvar c = 0; // Cost\nvar prevTc; //Previous cost\nvar tC = 0; // Today's consumption Wh\n var d = new Date();\n\n// Increment the message count\nif (typeof flow.get(\"em\") == 'undefined') {\n flow.set(\"em\", 1);\n}else{\n flow.set(\"em\", flow.get(\"em\") + 1); // Energy messages \n}\nmsgem.payload = flow.get(\"em\");\n\n// Build the MQTT message\nmsgmqtt.topic = \"tele/owl/electricity\"\nmsgmqtt.payload = \"{\\\"Electricity\\\":{\\\"RSSI\\\":\"\nmsgmqtt.payload += msg.payload.electricity.signal[0].$.rssi\nmsgmqtt.payload += \",\\\"LQI\\\":\"\nmsgmqtt.payload += msg.payload.electricity.signal[0].$.lqi\nmsgmqtt.payload += \",\\\"Battery\\\":\"\nvar bat = msg.payload.electricity.battery[0].$.level\nvar len =bat.length // This bit is needed to get rid of the % sign\nmsgmqtt.payload += bat.substr(0, len-1) \nmsgmqtt.payload += \",\\\"Power\\\":\"\nmsgmqtt.payload += msg.payload.electricity.chan[0].curr[0]._\nmsgmqtt.payload += \",\\\"Energy\\\":\"\nmsgmqtt.payload += msg.payload.electricity.chan[0].day[0]._\nmsgmqtt.payload += \"}}\"\n\n// Set the units consumed so far today (Wh) \ntC = msg.payload.electricity.chan[0].day[0]._;\nmsgtc.topic = \"Consumption\";\nmsgtc.payload = tC;\n\n// Set the live power reading\nmsgpwr.topic = \"Power(W)\"\nmsgpwr.payload = msg.payload.electricity.chan[0].curr[0]._;\n\n// Check if toaday's consumption has been reset\n// Assumes such reset is at midnight\n// Posts the cost to the bar chart\nprevTc = global.get(\"tCost\");\nglobal.set(\"tCost\", tC);\nif (prevTc > tC || true) { // Assumes a reset at midnight has occured\n c = (global.get(\"drate\") + global.get(\"krate\") * prevTc)/100000;\n msgyc.payload = c; // Cost in pence\n //d = d - 43200000;\n msgyc.label = d.getDate() + \"/\" + (d.getMonth() + 1);\n return [msgem, msgtc, msgpwr, msgyc, msgmqtt];\n}\n\nglobal.set(\"tCost\", tC);\nreturn [msgem, msgtc, msgpwr];","outputs":5,"noerr":0,"initialize":"","finalize":"","x":520,"y":80,"wires":[["8aa6da97.28b688"],["1e075b7b.908a15"],["9c216bf.bde0598","e24eb583.e93b78"],["5b4c5974.d44fa8"],["76fa1a2c.6a6d34"]]},{"id":"1e075b7b.908a15","type":"ui_chart","z":"ebf0c16.a3b5d4","name":"","group":"9c7fafed.09e19","order":1,"width":0,"height":0,"label":"Daily Consumption (Wh)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Waiting for data","dot":false,"ymin":"0","ymax":"40000","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":950,"y":80,"wires":[[]]},{"id":"f70ee793.79e478","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msgrt = {}; // msg for the displays Required Temperature\nvar msght = {}; // Ditto Hall Temperature\nvar msgcb = {}; // msg For the Comfort Button colour/label\nvar msgsb = {}; // Standby Button\nvar msgbb = {}; // Boost Button\nvar msgab = {}; // Away Button\nvar msghm = {}; // Heating Message Count\nvar msgmqtt = {}; // MQTT message to Home Assistant\nvar boost = false;\nvar greenish = \"#3FADB5\"\nvar reddish = \"#FFAAAA\"\nvar blueish = \"#C0DEED\"\n\n// Heating message count\nif (typeof flow.get(\"hm\") == 'undefined') {\n flow.set(\"hm\", 1);\n}else{\n flow.set(\"hm\", flow.get(\"hm\") + 1); \n}\nmsghm.payload = flow.get(\"hm\");\n\n// Do the MQTT message for Home Assistant\nmsgmqtt.topic = \"tele/owl/heating\"\nmsgmqtt.payload = \"{\\\"Heating\\\":{\\\"RSSI\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].signal[0].$.rssi\nmsgmqtt.payload += \",\\\"LQI\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].signal[0].$.lqi\nmsgmqtt.payload += \",\\\"Battery\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].battery[0].$.level\nmsgmqtt.payload += \",\\\"State\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].temperature[0].$.state\nmsgmqtt.payload += \",\\\"Flags\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].temperature[0].$.flags\nmsgmqtt.payload += \",\\\"Measured\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].temperature[0].current[0]\nmsgmqtt.payload += \",\\\"Required\\\":\"\nmsgmqtt.payload += msg.payload.heating.zones[0].zone[0].temperature[0].required[0]\nmsgmqtt.payload += \"}}\"\n\n// When first run the globals may be undefined. Does it matter? - Yes code below now deals with it\ncurRT = msg.payload.heating.zones[0].zone[0].temperature[0].required[0]; // Curent required temperature\ncurState = msg.payload.heating.zones[0].zone[0].temperature[0].$.state; // Current state\ncurHallT = msg.payload.heating.zones[0].zone[0].temperature[0].current[0];\nif (global.get(\"reqT\") !== undefined){\n prevRT = global.get(\"reqT\");\n prevState = global.get(\"state\");\n prevHallT = global.get(\"hT\");\n}\nelse{\n prevRT = curRT;\n prevState = curState;\n prevHallT = curHallT;\n}\nglobal.set(\"reqT\", curRT);\nglobal.set(\"state\", curState);\nglobal.set(\"hT\", curHallT);\n// So now we know about changes in State and Temperatures\n\nmsgrt.topic = \"Required Temperature\"; // Load payload for display on dial and graph\nmsgrt.payload = curRT; // Required Temperature\nmsght.topic = \"Hall Temperature\"; // and Hall Temperature\nmsght.payload = curHallT;\n\n// Determine if BOOST has been activated by looking at changes to required temperature and scheduled temperatures\n// There is a Flags value that appears to go to\n// 5 if Boosted from Comfort\n// 6 if Boosted from Standby and\n// 22 if Boosted from Away.\n// Otherwise the Flag is 1 (Comfort), 2 (Standby) and 18 (Away). There may be other values\n// It is reported in the MQTT section above\nvar boostFlag = msg.payload.heating.zones[0].zone[0].temperature[0].$.flags\n/*if (curRT != prevRT){\n // The Required Temperature has changed\n // Find out if Comfort Period change, Away or Boost\n var st = [Number(global.get(\"s1\")), Number(global.get(\"s2\")), Number(global.get(\"s3\")), Number(global.get(\"s4\"))];\n var et = [Number(global.get(\"e1\")), Number(global.get(\"e2\")), Number(global.get(\"e3\")), Number(global.get(\"e4\"))];\n var tt = [global.get(\"t1\"), global.get(\"t2\"), global.get(\"t3\"), global.get(\"t4\")];\n var np = global.get(\"shps\");\n let mn = new Date();\n var mySeconds = Number(mn.getSeconds() + mn.getMinutes() * 60 + mn.getHours() * 3600); // Seconds into the day. ie Same units as sx and ex\n mn.setHours(0,0,0,0); // Sets hours, minutes, second, milliseconds to 0. ie midnight\n for (i=0; i<np; i++){\n pt = 15; // Programmed Temperature for Standby\n if (mySeconds>st[i] & mySeconds<et[i]) { // must be in a Comfort period\n pt = tt[i]; // Comfort Programmed Temperature\n i = np; // Force break from for loop\n } \n }\n // If Required Temp == Programmed Temp then Comfort or Standby so nothing needed\n // msgdbg.payload = curRT + \", \" + prevRT + \", \" + pt + \", \" + mySeconds + \", \" + st[1] + \", \" + et[1] + \", \" + tt[1]; // debug line\n if (curRT > pt){ // Boost has been started\n boost = true;\n }\n else{\n boost = false;\n }\n}\nif (global.get(\"boost\") == \"ON\"){\n msgbb.colour = \"#ffaaaa\";\n msgbb.label = \"Cancel Boost\";\n}\nelse{\n msgbb.colour = \"#3fadb5\"; // Set default BOOST colour\n msgbb.label = \"Boost\"; // and label\n}\n*/\n\n// Need some code here to determine Away status\n\nif (curState != prevState) global.set(\"state\", curState);\n// States 0, 1, 4, 5, 6 & 7 are used by the Owl.\n// I will hijack 8 for B from Comfort, 9 for B from Standby and 10 B from Away\n// Also 11 for Away.\n// This may not be the end of it as there are some states I cannot test unless\n// I'm prepared to let my house go cold!\nswitch (boostFlag){\n case '4': // Boosted from Standby on Timer\n curState = \"9\"\n break\n case '5': // Boosted from Comfort on Timer\n curState = \"8\"\n break\n case '6': // Boosted from Standby from Comfort on Timer\n curState = \"9\"\n break\n case '7': // Boosted from Comfort from Standby on Timer\n curState = \"9\"\n break\n case '16': // Away\n curState = \"11\"\n break\n case '18': // Away\n curState = \"11\"\n break\n case '22': // Boosted from Away\n curState = \"10\"\n break\n default: // 0 is in Standby on Timer, 1 is in Comfort on Timer\n break// 3 is in Comfort from Standby on Timer. Don't know what 8 means\n}\nmsgbb.payload = curState\nswitch (curState){\n case '0': // Standby\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort\";\n msgcb.colour = greenish;\n msgsb.label = \"In Standby\";\n msgsb.colour = blueish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '1': // Comfort Running\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort (Running)\";\n msgcb.colour = reddish;\n msgsb.label = \"Standby\";\n msgsb.colour = greenish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '4': // Comfort Up to Temp\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort (Up to Temp)\";\n msgcb.colour = reddish;\n msgsb.label = \"Standby\";\n msgsb.colour = greenish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '5': // Comfort Warm Up\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort (Warm up)\";\n msgcb.colour = reddish;\n msgsb.label = \"Standby\";\n msgsb.colour = greenish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '6': // Comfort Cool Down\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort (Cool down)\";\n msgcb.colour = reddish;\n msgsb.label = \"Standby\";\n msgsb.colour = greenish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break; \n case '7': // Standby Running\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort\";\n msgcb.colour = greenish;\n msgsb.label = \"Standby (Running)\";\n msgsb.colour = reddish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '8': // Boost from Comfort\n msgbb.payload = \"Boosted from Comfort\"\n msgbb.label = \"Cancel Boost\";\n msgbb.colour = reddish; \n msgcb.label = \"Comfort (Boosted)\";\n msgcb.colour = reddish;\n msgsb.label = \"Standby\";\n msgsb.colour = greenish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '9': // Boost from Standby\n msgbb.label = \"Cancel Boost\";\n msgbb.colour = reddish\n msgcb.label = \"Comfort\";\n msgcb.colour = greenish;\n msgsb.label = \"Standby (Boosted)\";\n msgsb.colour = reddish;\n msgab.label = \"Away\";\n msgab.colour = greenish;\n break;\n case '10': // Boost from Away\n msgbb.label = \"Cancel Boost\";\n msgbb.colour = reddish; \n msgcb.label = \"Comfort\";\n msgcb.colour = greenish;\n msgsb.label = \"Standby (Running)\";\n msgsb.colour = greenish;\n msgab.label = \"Away (Boosted)\";\n msgab.colour = reddish;\n break;\n case '11': // Away\n msgbb.label = \"Boost\";\n msgbb.colour = greenish; \n msgcb.label = \"Comfort\";\n msgcb.colour = greenish;\n msgsb.label = \"Standby\";\n msgsb.colour = greenish;\n msgab.label = \"Away\";\n msgab.colour = blueish;\n break;\n default:\n break;\n}\nreturn [msgrt, msght, msghm, msgbb, msgcb, msgsb, msgab, msgmqtt];\n\n","outputs":8,"noerr":0,"initialize":"","finalize":"","x":520,"y":340,"wires":[["dc0e12dc.605e5","1d100c8c.197cf3"],["dc0e12dc.605e5","7f3f21fa.495ae"],["5ad91632.1ef978"],["c3058314.4cbad"],["adf95d20.3e433"],["b8b9bcce.e9262"],["78696be1.b037a4"],["76fa1a2c.6a6d34"]]},{"id":"1d100c8c.197cf3","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4891585b.501088","order":3,"width":0,"height":0,"name":"","label":"Required Temperature (°C)","format":"{{msg.payload}}","layout":"row-center","x":960,"y":440,"wires":[]},{"id":"aa8047c8.1d0118","type":"amazon-echo-device","z":"ebf0c16.a3b5d4","name":"Heating","topic":"switch","x":300,"y":820,"wires":[["e45f2c2e.64143"]],"info":"Alexa, turn the heating on - for Comfort\n\nAlexa, turn the heating off - for Standby"},{"id":"f92a9337.cc3fa","type":"amazon-echo-device","z":"ebf0c16.a3b5d4","name":"Boost","topic":"switch","x":310,"y":760,"wires":[["f6576928.20d1a8"]],"info":"Alexa, tunr the boost on (or off) - Toggles the Boost"},{"id":"1e60ca69.6c8bf6","type":"amazon-echo-hub","z":"ebf0c16.a3b5d4","port":"80","processinput":0,"discovery":true,"x":110,"y":760,"wires":[["aa8047c8.1d0118","f92a9337.cc3fa"]]},{"id":"f6576928.20d1a8","type":"change","z":"ebf0c16.a3b5d4","name":"Toggle Boost","rules":[{"t":"set","p":"payload","pt":"msg","to":"BOOST","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":760,"wires":[["dfaa1a1.16f70e8"]]},{"id":"8ab3abe4.2357c8","type":"change","z":"ebf0c16.a3b5d4","name":"Comfort","rules":[{"t":"set","p":"payload","pt":"msg","to":"COMFORT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":800,"wires":[["dfaa1a1.16f70e8"]]},{"id":"e45f2c2e.64143","type":"switch","z":"ebf0c16.a3b5d4","name":"On/Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":820,"wires":[["8ab3abe4.2357c8"],["a3c9003e.913d7"]]},{"id":"a3c9003e.913d7","type":"change","z":"ebf0c16.a3b5d4","name":"Standby","rules":[{"t":"set","p":"payload","pt":"msg","to":"STANDBY","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":840,"wires":[["dfaa1a1.16f70e8"]]},{"id":"24750d6d.e61662","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":1,"width":2,"height":1,"name":"","label":"Day #","format":"{{msg.payload}}","layout":"row-left","x":1570,"y":1300,"wires":[]},{"id":"498427f4.444218","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msgd = {};\nvar msgp1 = {};\nvar msgp2 = {};\nvar msgp3 = {};\nvar msgp4 = {};\nvar periods = 0; // Count of the number of heating periods used\n\n\ns1 = msg.payload.col4; // Seconds after Midnight\nif (s1 > 0) periods++;\ns2 = msg.payload.col8;\nif (s2 > 0) periods++;\ns3 = msg.payload.col12;\nif (s3 > 0) periods++;\ns4 = msg.payload.col16;\nif (s4 > 0) periods++;\ne1 =msg.payload.col5;\ne2 =msg.payload.col9;\ne3 =msg.payload.col13;\ne4 =msg.payload.col17;\n\nglobal.set(\"shps\", periods); // Set Heating PeriodS\nglobal.set(\"s1\", s1); // Set Heating Start 1 Seconds after Midnight\nglobal.set(\"s2\", s2); // Set Heating Start 2\nglobal.set(\"s3\", s3); // Set Heating Start 3\nglobal.set(\"s4\", s4); // Set Heating Start 4\nglobal.set(\"e1\", e1); // Set Heating End 1\nglobal.set(\"e2\", e2); // Set Heating End 2\nglobal.set(\"e3\", e3); // Set Heating End 3\nglobal.set(\"e4\", e4); // Set Heating End 4\n\n\nlet sd1 = new Date(s1 * 1000); // Date type for display\nlet sd2 = new Date(s2 * 1000);\nlet sd3 = new Date(s3 * 1000);\nlet sd4 = new Date(s4 * 1000);\nlet ed1 = new Date(e1 * 1000);\nlet ed2 = new Date(e2 * 1000);\nlet ed3 = new Date(e3 * 1000);\nlet ed4 = new Date(e4 * 1000);\n\n\nmsgd.payload = msg.payload.col3; // Day #\nmsgp1.payload = {\"start\":sd1,\"end\":ed1,\"temp\":msg.payload.col6,\"unk\":msg.payload.col7}; // Heating period 1\nmsgp2.payload = {\"start\":sd2,\"end\":ed2,\"temp\":msg.payload.col10,\"unk\":msg.payload.col11}; // Heating period 2\nmsgp3.payload = {\"start\":sd3,\"end\":ed3,\"temp\":msg.payload.col14,\"unk\":msg.payload.col15};\nmsgp4.payload = {\"start\":sd4,\"end\":ed4,\"temp\":msg.payload.col18,\"unk\":msg.payload.col15};\n\nreturn [msgd, msgp1, msgp2, msgp3, msgp4];\n","outputs":5,"noerr":0,"initialize":"","finalize":"","x":1140,"y":1280,"wires":[["24750d6d.e61662","b92e0be.996e6f8"],["de64a26b.6a8b"],["c6ec62ad.3164f"],["edb887ef.799ec8"],["68dd271c.2de0d8"]]},{"id":"29f01b8c.78cb74","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Set Heating","group":"576fbb57.7a0cc4","order":2,"width":4,"height":1,"passthru":false,"label":"Set Heating Times","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Set Heating\"}","payloadType":"json","topic":"","x":200,"y":2660,"wires":[["da7c04cf.ca5b08"]]},{"id":"347bf2ec.bfafce","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Set Heating to Heating","group":"9a0199d0.1b31b8","order":31,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":200,"y":3420,"wires":[["da7c04cf.ca5b08"]]},{"id":"9a8b5746.60fe98","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":9,"width":1,"height":1,"name":"","label":"1:","format":"","layout":"row-right","x":1510,"y":2060,"wires":[]},{"id":"3b15fba2.6e63c4","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":13,"width":1,"height":1,"name":"","label":"2:","format":"","layout":"row-right","x":1510,"y":2180,"wires":[]},{"id":"805ec4c5.dbb1f8","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":17,"width":1,"height":1,"name":"","label":"3:","format":"","layout":"row-right","x":1510,"y":2300,"wires":[]},{"id":"3919b1f7.db26ce","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":21,"width":1,"height":1,"name":"","label":"4:","format":"","layout":"row-right","x":1510,"y":2420,"wires":[]},{"id":"7112b88f.fe6ed8","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"s1","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":10,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2000,"wires":[["ef622336.71faa"]]},{"id":"de64a26b.6a8b","type":"function","z":"ebf0c16.a3b5d4","name":"Split1","func":"var msgs = {};\nvar msge = {};\nvar msgt = {};\nmsgs.payload = msg.payload.start;\nmsge.payload = msg.payload.end;\nmsgt.payload = msg.payload.temp;\nreturn [msgs, msge, msgt];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","x":1510,"y":2000,"wires":[["7112b88f.fe6ed8"],["fc4a18e6.669328"],["af81908d.c7899"]]},{"id":"fc4a18e6.669328","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"e1","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":11,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2040,"wires":[["e67effc2.d5e6a"]]},{"id":"ef622336.71faa","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"s1\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2000,"wires":[[]]},{"id":"e67effc2.d5e6a","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"e1\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2040,"wires":[[]]},{"id":"9483946c.e54308","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"t1\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2080,"wires":[[]]},{"id":"15d97aa8.526b85","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"s2","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":14,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2120,"wires":[["c6ca69cb.f15a78"]]},{"id":"c6ec62ad.3164f","type":"function","z":"ebf0c16.a3b5d4","name":"Split2","func":"var msgs = {};\nvar msge = {};\nvar msgt = {};\nmsgs.payload = msg.payload.start;\nmsge.payload = msg.payload.end;\nmsgt.payload = msg.payload.temp;\nreturn [msgs, msge, msgt];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","x":1510,"y":2120,"wires":[["15d97aa8.526b85"],["2e991ffc.2a439"],["d8f75cc.e769da"]]},{"id":"2e991ffc.2a439","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"e2","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":15,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2160,"wires":[["99103ea5.117e2"]]},{"id":"d8f75cc.e769da","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"t2","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":16,"width":2,"height":1,"passthru":true,"mode":"number","delay":300,"topic":"","x":1730,"y":2200,"wires":[["c8aa432f.17ccd"]]},{"id":"c6ca69cb.f15a78","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"s2\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2120,"wires":[[]]},{"id":"99103ea5.117e2","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"e2\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2160,"wires":[[]]},{"id":"c8aa432f.17ccd","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"t2\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2200,"wires":[[]]},{"id":"3c1019a6.061a46","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"s3","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":18,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2240,"wires":[["62f819db.d799e8"]]},{"id":"edb887ef.799ec8","type":"function","z":"ebf0c16.a3b5d4","name":"Split3","func":"var msgs = {};\nvar msge = {};\nvar msgt = {};\nmsgs.payload = msg.payload.start;\nmsge.payload = msg.payload.end;\nmsgt.payload = msg.payload.temp;\nreturn [msgs, msge, msgt];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","x":1510,"y":2240,"wires":[["3c1019a6.061a46"],["16cdb18f.b3c09e"],["99a8a6c6.223188"]]},{"id":"16cdb18f.b3c09e","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"e3","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":19,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2280,"wires":[["f5cbce1d.404d9"]]},{"id":"99a8a6c6.223188","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"t3","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":20,"width":2,"height":1,"passthru":true,"mode":"number","delay":300,"topic":"","x":1730,"y":2320,"wires":[["ca4138bb.1b0878"]]},{"id":"62f819db.d799e8","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"s3\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2240,"wires":[[]]},{"id":"f5cbce1d.404d9","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"e3\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2280,"wires":[[]]},{"id":"ca4138bb.1b0878","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"t3\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2320,"wires":[[]]},{"id":"2f573222.8c5fae","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"s4","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":22,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2360,"wires":[["eac5d163.29399"]]},{"id":"68dd271c.2de0d8","type":"function","z":"ebf0c16.a3b5d4","name":"Split4","func":"var msgs = {};\nvar msge = {};\nvar msgt = {};\nmsgs.payload = msg.payload.start;\nmsge.payload = msg.payload.end;\nmsgt.payload = msg.payload.temp;\nreturn [msgs, msge, msgt];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","x":1510,"y":2360,"wires":[["2f573222.8c5fae"],["dc436f37.b6703"],["870f6c67.9becf"]]},{"id":"dc436f37.b6703","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"e4","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":23,"width":3,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":1730,"y":2400,"wires":[["2d0e0682.5c0caa"]]},{"id":"870f6c67.9becf","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"t4","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":24,"width":2,"height":1,"passthru":true,"mode":"number","delay":300,"topic":"","x":1730,"y":2440,"wires":[["5ea30533.72bf6c"]]},{"id":"eac5d163.29399","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"s4\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2360,"wires":[[]]},{"id":"2d0e0682.5c0caa","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"e4\", msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2400,"wires":[[]]},{"id":"5ea30533.72bf6c","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"global.set(\"t4\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1880,"y":2440,"wires":[[]]},{"id":"a1cc836e.c929e","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":4,"width":1,"height":1,"name":"","label":"Period","format":"{{msg.payload}}","layout":"row-center","x":1510,"y":1940,"wires":[]},{"id":"a410a9e1.bc5148","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":5,"width":2,"height":1,"name":"","label":"Start","format":"{{msg.payload}}","layout":"row-left","x":1630,"y":1940,"wires":[]},{"id":"de41d65.3072c28","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":7,"width":3,"height":1,"name":"","label":"End","format":"{{msg.payload}}","layout":"row-left","x":1750,"y":1940,"wires":[]},{"id":"5d792aaf.b5c204","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":8,"width":2,"height":1,"name":"","label":"Temperature","format":"{{msg.payload}}","layout":"row-center","x":1890,"y":1940,"wires":[]},{"id":"2ca2810b.791bae","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commit this day","group":"9a0199d0.1b31b8","order":27,"width":5,"height":1,"passthru":false,"label":"Commit Changes For This Day","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":1600,"y":1580,"wires":[["aa86c34d.a8d6e"]]},{"id":"aa86c34d.a8d6e","type":"function","z":"ebf0c16.a3b5d4","name":"Delete All Heating Periods for Day","func":"var d = global.get(\"day\") // 0, Sunday to 6, Saturday\nvar msgh = {};\nmsgh.payload = \"DEL,HEATINGDAY,\";\nmsgh.payload += d;\nglobal.set(\"period\", 0);\nreturn msgh;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2160,"y":1580,"wires":[["1b5606e0.d445a9","dfaa1a1.16f70e8"]]},{"id":"7fc5e4f3.0537ac","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commit all days","group":"9a0199d0.1b31b8","order":29,"width":5,"height":1,"passthru":false,"label":"Commit Changes to All Days","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":1600,"y":1620,"wires":[["507acf02.43d13"]]},{"id":"507acf02.43d13","type":"function","z":"ebf0c16.a3b5d4","name":"Day 0","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 0)\nmsgd.payload = \"Go 0\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1620,"wires":[["7d21dd27.2cab54","aa86c34d.a8d6e"]]},{"id":"b92e0be.996e6f8","type":"ui_dropdown","z":"ebf0c16.a3b5d4","name":"Pick day","label":"","tooltip":"","place":"Select option","group":"9a0199d0.1b31b8","order":2,"width":4,"height":1,"passthru":false,"multiple":false,"options":[{"label":"Sunday","value":0,"type":"num"},{"label":"Monday","value":"1","type":"str"},{"label":"Tuesday","value":"2","type":"str"},{"label":"Wednesday","value":"3","type":"str"},{"label":"Thursday","value":"4","type":"str"},{"label":"Friday","value":"5","type":"str"},{"label":"Saturday","value":"6","type":"str"}],"payload":"","topic":"","x":1580,"y":1340,"wires":[["16e21963.31d8c7"]]},{"id":"16e21963.31d8c7","type":"function","z":"ebf0c16.a3b5d4","name":"Get day data","func":"global.set(\"day\", msg.payload)\nmsg.payload = \"GET,DAYHEATINGPERIODS,\" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1870,"y":1340,"wires":[["dfaa1a1.16f70e8"]]},{"id":"d8b3d586.67a668","type":"inject","z":"ebf0c16.a3b5d4","name":"Heating Periods","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"3.5","topic":"","payload":"do it","payloadType":"str","x":1300,"y":440,"wires":[["bf2fd195.00d57"]]},{"id":"af81908d.c7899","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"t1","label":"","tooltip":"","group":"9a0199d0.1b31b8","order":12,"width":2,"height":1,"passthru":true,"mode":"number","delay":300,"topic":"","x":1730,"y":2080,"wires":[["9483946c.e54308"]]},{"id":"7fc25a4e.d2d7d4","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Stats to Heating","group":"b5f3abf7.f53de8","order":2,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":180,"y":2980,"wires":[["da7c04cf.ca5b08"]]},{"id":"ad669c06.ad364","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Stats to Electricity","group":"b5f3abf7.f53de8","order":4,"width":4,"height":1,"passthru":false,"label":"Electricity","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Electricity\"}","payloadType":"json","topic":"","x":190,"y":3020,"wires":[["da7c04cf.ca5b08"]]},{"id":"da7c04cf.ca5b08","type":"ui_ui_control","z":"ebf0c16.a3b5d4","name":"Go To","events":"change","x":890,"y":2860,"wires":[[]]},{"id":"c778c7cf.b87818","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Home","group":"869caf24.84faf","order":8,"width":4,"height":1,"passthru":false,"label":"Home","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":190,"y":2620,"wires":[["da7c04cf.ca5b08"]]},{"id":"3b2a0643.4bf81a","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Electricity to Home","group":"60afeb85.368424","order":8,"width":4,"height":1,"passthru":false,"label":"Home","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":190,"y":2920,"wires":[["da7c04cf.ca5b08"]]},{"id":"80e9fdc1.b0108","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Electricity to Heating","group":"60afeb85.368424","order":2,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":200,"y":2800,"wires":[["da7c04cf.ca5b08"]]},{"id":"9ed28627.70ba28","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Electricity","group":"869caf24.84faf","order":2,"width":4,"height":1,"passthru":false,"label":"Electricity","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Electricity\"}","payloadType":"json","topic":"","x":200,"y":2500,"wires":[["da7c04cf.ca5b08"]]},{"id":"4823bc69.6c6244","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":12,"width":5,"height":1,"name":"","label":"Day/KWh Rates:","format":"{{msg.payload}}","layout":"row-left","x":820,"y":1180,"wires":[]},{"id":"2e535c79.317dd4","type":"function","z":"ebf0c16.a3b5d4","name":"Device","func":"var d = {};\nd.payload = msg.payload.col3;\nd.payload += \" & \" + msg.payload.col4;\nreturn d;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":1020,"wires":[["88a44ab9.175198"]]},{"id":"5f86d998.180b78","type":"comment","z":"ebf0c16.a3b5d4","name":"Navigation Buttons","info":"","x":190,"y":2280,"wires":[]},{"id":"bf2fd195.00d57","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var day = {};\nlet today = new Date();\nvar d = today.getDay(); // 0-6 Sun - Sat\nday.payload = \"GET,DAYHEATINGPERIODS,\";\nday.payload += d;\nreturn day;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1320,"y":480,"wires":[["dfaa1a1.16f70e8"]]},{"id":"24dcf3af.3c3c7c","type":"ui_text","z":"ebf0c16.a3b5d4","group":"1f2c286a.c3a7d8","order":1,"width":0,"height":0,"name":"Date Stamp Home","label":"","format":"{{msg.payload}}","layout":"row-left","x":2490,"y":1980,"wires":[]},{"id":"605c2c6f.ab22d4","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":15,"width":3,"height":1,"passthru":false,"label":"Away","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,AWAY","payloadType":"str","topic":"","x":1870,"y":420,"wires":[["dfaa1a1.16f70e8"]]},{"id":"9e648487.a4b1e8","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"4.5","topic":"","payload":"GET,AWAY","payloadType":"str","x":1310,"y":520,"wires":[["dfaa1a1.16f70e8"]]},{"id":"2600e5b1.25caaa","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":16,"width":3,"height":1,"name":"Away","label":"","format":"{{msg.payload}}","layout":"row-left","x":830,"y":1420,"wires":[]},{"id":"75bf0da3.603fc4","type":"function","z":"ebf0c16.a3b5d4","name":"Away","func":"// Away can return 1) No Away Period Set \n// 2) A future Away Period Set\n// 3) In an Away Period Now\nvar msgam = {}; // Away Message\nvar msgas = {}; // Away Start\nvar msgae = {}; // Away End\nvar msgdbg = {}; //debug\n\nlet myNow = new Date(); // timestamp Now including date. MiliiSeconds after 00:00:00 1/1/70\nlet as = new Date(msg.payload.col3 * 1000); // ms after midnight 1/1/70\nlet ae = new Date(msg.payload.col4 * 1000);\nvar myOwlNow = myNow/1000; // Owl uses seconds after 00:00 00 1/1/70\n\nif (Number(as) == 0 & Number(ae) == 0) msgam.payload = \"Not set\";\nelse if (myOwlNow < msg.col3) msgam.payload = \"Away Period Set!\";\nelse msgam.payload = \"Away is Active\";\n\nmsgas.payload = Number(as);\nmsgae.payload = Number(ae);\nmsgdbg.payload = Number(as) + \",\" + Number(ae) + \",\" + myNow + \",\" + myOwlNow\n\nreturn [msgam, msgas, msgae, msgdbg];","outputs":4,"noerr":0,"initialize":"","finalize":"","x":650,"y":1520,"wires":[["2600e5b1.25caaa","279144cb.b45a5c"],["66b156a.062fba8","a75586d.9cdae78"],["fdf6f557.929ff8","28747bf9.272174"],[]]},{"id":"66b156a.062fba8","type":"ui_date_picker","z":"ebf0c16.a3b5d4","name":"Pick Away Start Date","label":"Start","group":"2641f0f4.cd2b3","order":1,"width":4,"height":1,"passthru":true,"topic":"","x":880,"y":1520,"wires":[["f19219f6.e2ca18"]]},{"id":"54e5e7a9.af73e8","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Set Away","group":"576fbb57.7a0cc4","order":6,"width":4,"height":1,"passthru":false,"label":"Set Away Period","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Set Away Period\"}","payloadType":"json","topic":"","x":200,"y":2740,"wires":[["da7c04cf.ca5b08"]]},{"id":"a75586d.9cdae78","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"Pick Away Start Time","label":"","tooltip":"","group":"2641f0f4.cd2b3","order":3,"width":4,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":880,"y":1560,"wires":[["1c3a98ed.612837"]]},{"id":"fdf6f557.929ff8","type":"ui_date_picker","z":"ebf0c16.a3b5d4","name":"Pick Away End Date","label":"Start","group":"2641f0f4.cd2b3","order":2,"width":4,"height":1,"passthru":true,"topic":"","x":880,"y":1600,"wires":[["1ce04ed7.1c9e01"]]},{"id":"28747bf9.272174","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"Pick Away End Time","label":"","tooltip":"","group":"2641f0f4.cd2b3","order":4,"width":4,"height":1,"passthru":true,"mode":"time","delay":300,"topic":"","x":880,"y":1640,"wires":[["b0cef0d7.dbaff"]]},{"id":"be5323ec.081cd","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Set Away to Heating","group":"2641f0f4.cd2b3","order":9,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":200,"y":3340,"wires":[["da7c04cf.ca5b08"]]},{"id":"8f8d9080.a989c","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"2641f0f4.cd2b3","order":7,"width":4,"height":1,"passthru":false,"label":"Commit Away","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":2140,"y":420,"wires":[["24790c7b.a2d544"]]},{"id":"f19219f6.e2ca18","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"asd","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":1520,"wires":[[]]},{"id":"1c3a98ed.612837","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"ast","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":1560,"wires":[[]]},{"id":"b0cef0d7.dbaff","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"aet","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":1640,"wires":[[]]},{"id":"1ce04ed7.1c9e01","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"aed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":1600,"wires":[[]]},{"id":"24790c7b.a2d544","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"/* NB\nNode-Red and Javascript dates are in milliseconds after 1/1/1970 00:00:00\nOwl requires dates/times in seconds after 1/1/1970 00:00:00\n*/\n\nlet myNow = new Date();\noSD = flow.get(\"asd\"); // JS Start Date (milliseconds after 1/1/1970)\noST = flow.get(\"ast\"); // JS Start Time (milliseconds after midnight)\noS = oSD + oST; // Combine\noED = flow.get(\"aed\"); // JS End Date\noET = flow.get(\"aet\"); // JS End Time\noE = oED + oET;\n// Check for errors\nif (oE < myNow || oE < oS || oS < myNow) return null;\n\noS /= 1000; // Millis to seconds for the Owl\noE /= 1000;\nmsg.payload = \"SET,AWAY,\";\nmsg.payload += oS + \",\" + oE\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2460,"y":420,"wires":[["dfaa1a1.16f70e8"]]},{"id":"99d438e7.92fb08","type":"ui_button","z":"ebf0c16.a3b5d4","name":"AWAY - Clear","group":"2641f0f4.cd2b3","order":6,"width":4,"height":1,"passthru":false,"label":"{{payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"SET,AWAY,0,0","payloadType":"str","topic":"","x":1060,"y":1460,"wires":[["f9fa2be0.f9bcf8","dfaa1a1.16f70e8"]]},{"id":"279144cb.b45a5c","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"if (msg.payload != \"Not set\") msg.payload = \"Clear AWAY Period\";\n// Else leave as Not set\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":1460,"wires":[["99d438e7.92fb08"]]},{"id":"f9fa2be0.f9bcf8","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"msg.payload = \"Awaiting Confirmation\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1080,"y":1400,"wires":[["99d438e7.92fb08"]]},{"id":"b5c197ca.b09ce8","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msgDay = {};\nlet today = new Date();\nvar d = today.getDay(); // 0-6 Sun - Sat\nvar M = today.getMonth() +1; // 0-11\nvar D = today.getDate(); // 1-31\nvar Y = today.getFullYear(); // yyyy\nvar h = String(today.getHours());\nvar m = String(today.getMinutes());\nvar s = String(today.getSeconds());\nvar c = 0;\nmsgDay.payload = D + \"/\" + M + \"/\" + Y;\nmsgDay.payload += \" \" + d2(h) + \":\" + d2(m) + \":\" + d2(s);\n\nreturn [msgDay];\n\nfunction d2(s){\n if (s.length == 1) s = \"0\" + s;\n return s;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2220,"y":2040,"wires":[["24dcf3af.3c3c7c","c5ed0155.b26bd","42ec4606.7b7458","f2f6cc69.0a9b4"]]},{"id":"7b4d83d9.d3a0bc","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":"10","topic":"","payload":"","payloadType":"date","x":2230,"y":1980,"wires":[["b5c197ca.b09ce8"]]},{"id":"8992a907.766678","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"KWh Rate:","tooltip":"","group":"badbc62a.b26778","order":2,"width":4,"height":1,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"50","step":"0.001","x":810,"y":1140,"wires":[["a426c36a.72534"]]},{"id":"68d7cc87.790a24","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Day Rate:","tooltip":"","group":"badbc62a.b26778","order":1,"width":4,"height":1,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"50","step":"0.01","x":800,"y":1100,"wires":[["4f36dfce.714ba"]]},{"id":"d1f87182.e500b","type":"ui_text","z":"ebf0c16.a3b5d4","group":"f589e73.7f8e918","order":1,"width":0,"height":0,"name":"Commands","label":"","format":"{{msg.payload}}","layout":"row-left","x":2530,"y":600,"wires":[]},{"id":"2330fd07.cbd8f2","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":23,"width":5,"height":1,"name":"Weather msg Count","label":"Weather:","format":"{{msg.payload}}","layout":"row-left","x":940,"y":360,"wires":[]},{"id":"5ad91632.1ef978","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":19,"width":5,"height":1,"name":"Heating msg Count","label":"Heating:","format":"{{msg.payload}}","layout":"row-left","x":930,"y":520,"wires":[]},{"id":"8aa6da97.28b688","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":21,"width":5,"height":1,"name":"Electricity msg Count","label":"Electricity:","format":"{{msg.payload}}","layout":"row-left","x":940,"y":40,"wires":[]},{"id":"897be659.e22ca8","type":"ui_text","z":"ebf0c16.a3b5d4","group":"1f2c286a.c3a7d8","order":4,"width":0,"height":0,"name":"Weather","label":"Weather report:","format":"{{msg.payload}}","layout":"row-left","x":900,"y":400,"wires":[]},{"id":"9a4f32ab.09372","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"4017027e.ebfbfc","order":18,"width":3,"height":1,"passthru":false,"label":"Messages (Reset)","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":1830,"y":100,"wires":[["35e94ebc.6672a2"]]},{"id":"6c103a3f.ff0444","type":"udp out","z":"ebf0c16.a3b5d4","name":"Send UDP Command","addr":"192.168.0.98","iface":"","port":"5100","ipv":"udp4","outport":"8887","base64":false,"multicast":"false","x":2560,"y":680,"wires":[],"info":"Amend thi IP address to your own Owl's IP address. You must assign a fixed IP to your Owl Hub through the router. You cannot set it locally! The Port (8887) can also be changed but you must also change the response UDP In Node to match."},{"id":"5b4c5974.d44fa8","type":"ui_chart","z":"ebf0c16.a3b5d4","name":"","group":"9c7fafed.09e19","order":2,"width":0,"height":0,"label":"Daily Costs (£)","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Waiting for Data","dot":false,"ymin":"0","ymax":"4","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":true,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#986bc2","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":920,"y":200,"wires":[[]]},{"id":"5a840997.d9f848","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"GET,HEATING","payloadType":"str","x":1300,"y":160,"wires":[["dfaa1a1.16f70e8"]]},{"id":"dbf271a6.cc5e5","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"a2e1b599.099be8","order":2,"width":3,"height":1,"passthru":false,"label":"Get Heating Params","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GET,HEATING","payloadType":"str","topic":"","x":1820,"y":140,"wires":[["dfaa1a1.16f70e8"]]},{"id":"c8b9ac74.8c236","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"// Extract the editable parameters and pass to the displays\nvar msgbtemp = {}; // Boost temp\nmsgbtemp.payload = msg.payload.col5;\nvar msgsbtemp = {}; // Standby temp\nmsgsbtemp.payload = msg.payload.col6;\nvar msgatemp = {}; // Away temp\nmsgatemp.payload = msg.payload.col9;\nvar msghtemp = {}; // holiday temp\nmsghtemp.payload = msg.payload.col10;\nvar msgbtime = {}; // Boost time\nmsgbtime.payload = msg.payload.col11/60; // Make Minutes\nvar msgwo = {}; // Warm Up offset\nmsgwo.payload = msg.payload.col13;\nvar msgco = {}; // Cool Down offset\nmsgco.payload = msg.payload.col14;\nvar msgwt = {}; // Warm Up time\nmsgwt.payload = msg.payload.col15/60; // Make minutes\nvar msgct = {}; // Cool down Time\nmsgct.payload = msg.payload.col16/60; // Make minutes\nvar msghy = {}; // Hysteresis\nmsghy.payload = msg.payload.col21;\n// The following are not used in the Owl's proprietary dashboard\n// so I haven't implemented them here. Some are not used\n// according to the API documentation\nflow.set(\"minBoilerTime\", msg.payload.col12); // Minimum Boiler time not used set to 120\nflow.set(\"comfortRI\", msg.payload.col17); // Comfort Report Interval - 33\nflow.set(\"standbyRI\", msg.payload.col18); // Standby report interval - 63\nflow.set(\"awayRI\", msg.payload.col19); // Away report interval - 303\nflow.set(\"summerRI\", msg.payload.col20); // Summer report interval - 303\nflow.set(\"upperTemp\", msg.payload.col3); // Upper temp Not Used - 35\nflow.set(\"lowerTemp\", msg.payload.col4); // Lower Temp not used - 5\nflow.set(\"standbyOcTemp\", msg.payload.col7); // Standby Occupied temp - 15\nflow.set(\"standbySleepTemp\", msg.payload.col8); // Standby Sleep temp\n\n\n\nreturn [msgbtemp, msgbtime, msgsbtemp, msgatemp, msghtemp, msgwo, msgco, msgwt, msgct, msghy];","outputs":10,"noerr":0,"initialize":"","finalize":"","x":620,"y":2020,"wires":[["f721a57d.3dbed8"],["b1b631a0.5a556"],["fb13db08.9165f8"],["9769fafe.949e48"],["8f5aeafd.bea168"],["a2d1470a.604bb8"],["97e48fc1.5c68c"],["a87d501f.2a326"],["460f27ff.6f5d88"],["4b201c73.fe5fe4"]]},{"id":"f721a57d.3dbed8","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Boost Temp","tooltip":"","group":"a2e1b599.099be8","order":3,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}C°","min":0,"max":"5","step":".1","x":850,"y":1860,"wires":[["c7529218.34b35"]]},{"id":"fb13db08.9165f8","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Standby Temp","tooltip":"","group":"a2e1b599.099be8","order":5,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}°C","min":"5","max":"20","step":1,"x":860,"y":1940,"wires":[["f31896ae.0714b8"]]},{"id":"9769fafe.949e48","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Away Temp","tooltip":"","group":"a2e1b599.099be8","order":6,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}°C","min":"5","max":"20","step":1,"x":850,"y":1980,"wires":[["f9c0549e.fce6c8"]]},{"id":"8f5aeafd.bea168","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Holiday Temp","tooltip":"","group":"a2e1b599.099be8","order":7,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}°C","min":"5","max":"20","step":1,"x":860,"y":2020,"wires":[["3eb4b906.703e36"]]},{"id":"b1b631a0.5a556","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Boost Time","tooltip":"","group":"a2e1b599.099be8","order":4,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}m","min":"30","max":"120","step":"1","x":850,"y":1900,"wires":[["c193fa90.18c638"]]},{"id":"9a1a077d.dbead8","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Params to Heating","group":"a2e1b599.099be8","order":17,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":190,"y":3380,"wires":[["da7c04cf.ca5b08"]]},{"id":"f4ac54f8.009538","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commit Params","group":"a2e1b599.099be8","order":15,"width":4,"height":1,"passthru":false,"label":"Commit Params","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":2120,"y":140,"wires":[["cb648342.2ce29"]]},{"id":"9b495980.a854f8","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Set Params","group":"576fbb57.7a0cc4","order":4,"width":4,"height":1,"passthru":false,"label":"Set Params","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating Parameters\"}","payloadType":"json","topic":"","x":200,"y":2700,"wires":[["da7c04cf.ca5b08"]]},{"id":"c7529218.34b35","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"boostTemp","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":1860,"wires":[[]]},{"id":"c193fa90.18c638","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"boostTime","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":1900,"wires":[[]]},{"id":"f31896ae.0714b8","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"standbyUnocTemp","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":1940,"wires":[[]]},{"id":"f9c0549e.fce6c8","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"awayTemp","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":1980,"wires":[[]]},{"id":"3eb4b906.703e36","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"holidayTemp","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":2020,"wires":[[]]},{"id":"cb648342.2ce29","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"var msgh = {};\nmsgh.payload = \"SET,HEATING,\"; // Upper/Lower Temp not used! \nmsgh.payload += flow.get(\"upperTemp\"); // Upper Temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"lowerTemp\"); // Lower temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"boostTemp\"); // Boost temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"standbyUnocTemp\"); // Standby Unoccupied temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"standbyOcTemp\"); // Standby Occupied temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"standbySleepTemp\"); // Standby Sleep temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"awayTemp\"); // Away temp\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"holidayTemp\"); // Holiday temp\nmsgh.payload += \",\";\nmsgh.payload += 60 * flow.get(\"boostTime\"); // Boost time back to seconds\nmsgh.payload += \",\"; \nmsgh.payload += flow.get(\"minBoilerTime\"); // Min boiler time Not Used\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"warmUp\"); // Warm Up offset\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"coolDown\"); // Cool Down offset\nmsgh.payload += \",\";\nmsgh.payload += 60 * flow.get(\"maxWarm\"); // Warm Up Time\nmsgh.payload += \",\";\nmsgh.payload += 60 * flow.get(\"maxCool\"); // Cool Down Time\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"comfortRI\"); // Comfort Report Interval\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"standbyRI\"); // Standby Report Interval\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"awayRI\"); // Away Report Interval\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"summerRI\"); // Summer Report Interval\nmsgh.payload += \",\";\nmsgh.payload += flow.get(\"hysteresis\"); // Hysteresis\nreturn msgh;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2500,"y":140,"wires":[["dfaa1a1.16f70e8"]]},{"id":"a2d1470a.604bb8","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Warm Up Offset","tooltip":"","group":"a2e1b599.099be8","order":8,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}%","min":"10","max":"200","step":1,"x":860,"y":2060,"wires":[["13e6a512.e705cb"]]},{"id":"13e6a512.e705cb","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"warmUp","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":2060,"wires":[[]]},{"id":"97e48fc1.5c68c","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Cool Down Offset","tooltip":"","group":"a2e1b599.099be8","order":9,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}%","min":"10","max":"200","step":1,"x":870,"y":2100,"wires":[["30f0db87.a74324"]]},{"id":"30f0db87.a74324","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"coolDown","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":2100,"wires":[[]]},{"id":"a87d501f.2a326","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Max warm Up Time","tooltip":"","group":"a2e1b599.099be8","order":10,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}m","min":"15","max":"120","step":1,"x":870,"y":2140,"wires":[["11289d14.398d23"]]},{"id":"11289d14.398d23","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"maxWarm","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":2140,"wires":[[]]},{"id":"460f27ff.6f5d88","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Max Cool Down Time","tooltip":"","group":"a2e1b599.099be8","order":11,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}m","min":"15","max":"120","step":1,"x":880,"y":2180,"wires":[["348bc2c8.241b8e"]]},{"id":"348bc2c8.241b8e","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"maxCool","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":2180,"wires":[[]]},{"id":"4b201c73.fe5fe4","type":"ui_numeric","z":"ebf0c16.a3b5d4","name":"","label":"Hysteresis","tooltip":"","group":"a2e1b599.099be8","order":12,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}C°","min":".1","max":"1","step":".1","x":850,"y":2220,"wires":[["b2baed9a.6f5ee"]]},{"id":"b2baed9a.6f5ee","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"hysteresis","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":2220,"wires":[[]]},{"id":"8bd8d785.30f948","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4891585b.501088","order":4,"width":0,"height":0,"name":"","label":"Outside Temperature (°C)","format":"{{msg.payload}}","layout":"row-center","x":950,"y":240,"wires":[]},{"id":"dfaa1a1.16f70e8","type":"function","z":"ebf0c16.a3b5d4","name":"Amend to include your UDP Code","func":"msg.payload += \",ABCD1234\" // Add UDP code (don't delete the comma)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2240,"y":680,"wires":[["6c103a3f.ff0444","d1f87182.e500b"]]},{"id":"1b5606e0.d445a9","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1520,"wires":[["3290464e.66eb8a"]]},{"id":"3290464e.66eb8a","type":"function","z":"ebf0c16.a3b5d4","name":"Set First Heating Period","func":"var msgh = {};\nif (global.get(\"s1\") > 0){\n msgh.payload = \n msgh.payload = \"SET,HEATINGPERIOD,\";\n msgh.payload += global.get(\"day\"); // Day\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"s1\")); // Start time Period 1\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"e1\")); // End time\n msgh.payload += \",\"; \n msgh.payload += Number(global.get(\"t1\")).toFixed(2); // Temperature\n return msgh\n} \nelse{\n return null\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1830,"y":1520,"wires":[["4f5fe41.b55351c","dfaa1a1.16f70e8"]]},{"id":"af91b6e5.dbeab8","type":"function","z":"ebf0c16.a3b5d4","name":"Set Second Heating Period","func":"var msgh = {};\nif (global.get(\"s2\") > 0){\n msgh.payload = \n msgh.payload = \"SET,HEATINGPERIOD,\";\n msgh.payload += global.get(\"day\"); // Day\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"s2\")); // Start time Period 1\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"e2\")); // End time\n msgh.payload += \",\"; \n msgh.payload += Number(global.get(\"t2\")).toFixed(2); // Temperature\n return msgh\n} \nelse{\n return null\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1820,"y":1480,"wires":[["42a80af9.dcfbf4","dfaa1a1.16f70e8"]]},{"id":"c9b7f4ef.ccfc48","type":"function","z":"ebf0c16.a3b5d4","name":"Set Third Heating Period","func":"var msgh = {};\nif (global.get(\"s3\") > 0){\n msgh.payload = \n msgh.payload = \"SET,HEATINGPERIOD,\";\n msgh.payload += global.get(\"day\"); // Day\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"s3\")); // Start time Period 1\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"e3\")); // End time\n msgh.payload += \",\"; \n msgh.payload += Number(global.get(\"t3\")).toFixed(2); // Temperature\n return msgh\n} \nelse{\n return null\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1830,"y":1440,"wires":[["8bbf0fe7.fe421","dfaa1a1.16f70e8"]]},{"id":"ed1f3c6a.9ea7d","type":"function","z":"ebf0c16.a3b5d4","name":"Set Fourth Heating Period","func":"var msgh = {};\nif (global.get(\"s4\") > 0){\n msgh.payload = \n msgh.payload = \"SET,HEATINGPERIOD,\";\n msgh.payload += global.get(\"day\"); // Day\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"s4\")); // Start time Period 1\n msgh.payload += \",\"; \n msgh.payload += (global.get(\"e4\")); // End time\n msgh.payload += \",\"; \n msgh.payload += Number(global.get(\"t4\")).toFixed(2); // Temperature\n return msgh\n} \nelse{\n return null\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1830,"y":1400,"wires":[["dfaa1a1.16f70e8"]]},{"id":"4f5fe41.b55351c","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1480,"wires":[["af91b6e5.dbeab8"]]},{"id":"42a80af9.dcfbf4","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1440,"wires":[["c9b7f4ef.ccfc48"]]},{"id":"8bbf0fe7.fe421","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1400,"wires":[["ed1f3c6a.9ea7d"]]},{"id":"f60576ae.d2c998","type":"comment","z":"ebf0c16.a3b5d4","name":"View and change Heating changes for given day","info":"","x":1660,"y":1260,"wires":[]},{"id":"4844def6.c082a","type":"comment","z":"ebf0c16.a3b5d4","name":"Owl Command Buttons","info":"","x":1820,"y":40,"wires":[]},{"id":"576ff72c.c2dde8","type":"comment","z":"ebf0c16.a3b5d4","name":"Edit Heating Parameters","info":"","x":890,"y":1820,"wires":[]},{"id":"68a0ee95.7f63f","type":"comment","z":"ebf0c16.a3b5d4","name":"Edit Away Period","info":"","x":860,"y":1380,"wires":[]},{"id":"e251f87.a59fb08","type":"inject","z":"ebf0c16.a3b5d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":580,"wires":[["9f257fc0.346fc"]]},{"id":"5d30a42c.baa33c","type":"ui_text_input","z":"ebf0c16.a3b5d4","name":"","label":"","tooltip":"","group":"f589e73.7f8e918","order":7,"width":15,"height":1,"passthru":true,"mode":"text","delay":"0","topic":"","x":1240,"y":960,"wires":[["2c62dfad.ed858"]]},{"id":"bf76a7d8.412e98","type":"ui_text","z":"ebf0c16.a3b5d4","group":"f589e73.7f8e918","order":4,"width":8,"height":2,"name":"","label":"","format":"Manual commands may be entered below. Leave out the UDP Code. Commands will be converted to upper case. Erroneous commands are uasually ignored or return \"ERROR\". However, be careful...","layout":"row-spread","x":1230,"y":1000,"wires":[]},{"id":"a7c19d05.817c4","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"msg.payload = global.get(\"manualCommand\")\nmsg.payload = msg.payload.toUpperCase()\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1400,"y":920,"wires":[["dfaa1a1.16f70e8"]]},{"id":"aa2c4690.b97b08","type":"ui_button","z":"ebf0c16.a3b5d4","name":"","group":"f589e73.7f8e918","order":9,"width":4,"height":1,"passthru":false,"label":"Send","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":1230,"y":920,"wires":[["a7c19d05.817c4"]]},{"id":"2c62dfad.ed858","type":"change","z":"ebf0c16.a3b5d4","name":"","rules":[{"t":"set","p":"manualCommand","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1460,"y":960,"wires":[[]]},{"id":"76fa1a2c.6a6d34","type":"mqtt out","z":"ebf0c16.a3b5d4","name":"MQTT","topic":"","qos":"0","retain":"false","broker":"91b9efe8.4a598","x":890,"y":280,"wires":[]},{"id":"35cee4d7.340a6c","type":"comment","z":"ebf0c16.a3b5d4","name":"Manual Command Input","info":"","x":1280,"y":880,"wires":[]},{"id":"12f155d8.e7cdfa","type":"ui_text","z":"ebf0c16.a3b5d4","group":"1f2c286a.c3a7d8","order":2,"width":8,"height":3,"name":"Welcome message","label":"","format":"Welcome to the Owl Intuition Dasboard. This has been developed to work with your Owl Intuition Central Heating and a single Electricity sensor. Please use the navigation buttons below.","layout":"col-center","x":2210,"y":1780,"wires":[]},{"id":"34449ec9.1af112","type":"comment","z":"ebf0c16.a3b5d4","name":"Welcome","info":"","x":2180,"y":1740,"wires":[]},{"id":"3b60c281.c188ce","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Welcome to Heating","group":"ce55982d.16ff08","order":2,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":200,"y":2320,"wires":[["da7c04cf.ca5b08"]]},{"id":"f0a8c7f9.cd1ae8","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Welcome to Electricity","group":"ce55982d.16ff08","order":4,"width":4,"height":1,"passthru":false,"label":"Electricity","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Electricity\"}","payloadType":"json","topic":"","x":200,"y":2360,"wires":[["da7c04cf.ca5b08"]]},{"id":"68accb89.8a2444","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Welcome to Stats","group":"ce55982d.16ff08","order":6,"width":4,"height":1,"passthru":false,"label":"System Stats","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Stats\"}","payloadType":"json","topic":"","x":190,"y":2400,"wires":[["da7c04cf.ca5b08"]]},{"id":"2aadfeee.a2a972","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Stats to Home","group":"b5f3abf7.f53de8","order":8,"width":4,"height":1,"passthru":false,"label":"Home","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":180,"y":3100,"wires":[["da7c04cf.ca5b08"]]},{"id":"eff8b1b.7ce3d5","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Stats to Commands","group":"b5f3abf7.f53de8","order":6,"width":4,"height":1,"passthru":false,"label":"Commands","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Commands\"}","payloadType":"json","topic":"","x":190,"y":3060,"wires":[["da7c04cf.ca5b08"]]},{"id":"9fc489c3.ea7598","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":2,"width":8,"height":2,"name":"Stats text","label":"","format":"The buttons below may be used to update the data. Check out the Commands and Responses by navigating to the Commands tab.","layout":"row-left","x":2180,"y":1860,"wires":[]},{"id":"c1e2ea2d.133948","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commands to Stats","group":"859ceabd.e40bc8","order":6,"width":4,"height":1,"passthru":false,"label":"System Stats","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Stats\"}","payloadType":"json","topic":"","x":190,"y":3240,"wires":[["da7c04cf.ca5b08"]]},{"id":"6f13212a.f4c17","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commands to Home","group":"859ceabd.e40bc8","order":8,"width":4,"height":1,"passthru":false,"label":"Home","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Owl\"}","payloadType":"json","topic":"","x":200,"y":3280,"wires":[["da7c04cf.ca5b08"]]},{"id":"35e94ebc.6672a2","type":"function","z":"ebf0c16.a3b5d4","name":"","func":"flow.set(\"em\", 0)\nflow.set(\"wm\", 0)\nflow.set(\"hm\", 0)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":2100,"y":100,"wires":[[]]},{"id":"e80a06a6.271d38","type":"ui_text","z":"ebf0c16.a3b5d4","group":"e9add7f2.770078","order":1,"width":4,"height":5,"name":"Heating control text","label":"","format":"Note: Boost and Away operate as toggles. Comfort and Standby switch from each other. Confirmation will take several seconds until the next Multicast Heating message is received.","layout":"row-left","x":2210,"y":1820,"wires":[]},{"id":"772f15ca.b8b6ec","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commands to Heating","group":"859ceabd.e40bc8","order":2,"width":4,"height":1,"passthru":false,"label":"Heating","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Heating\"}","payloadType":"json","topic":"","x":200,"y":3160,"wires":[["da7c04cf.ca5b08"]]},{"id":"f932f1a0.f8413","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Commands to Electricity","group":"859ceabd.e40bc8","order":4,"width":4,"height":1,"passthru":false,"label":"Electricity","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Electricity\"}","payloadType":"json","topic":"","x":210,"y":3200,"wires":[["da7c04cf.ca5b08"]]},{"id":"200e4b79.253014","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Welcome to Commands","group":"ce55982d.16ff08","order":8,"width":4,"height":1,"passthru":false,"label":"Commands","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Commands\"}","payloadType":"json","topic":"","x":210,"y":2440,"wires":[["da7c04cf.ca5b08"]]},{"id":"65078299.ea15ec","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Stats","group":"869caf24.84faf","order":4,"width":4,"height":1,"passthru":false,"label":"System Stats","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Stats\"}","payloadType":"json","topic":"","x":180,"y":2540,"wires":[["da7c04cf.ca5b08"]]},{"id":"b4ac53e1.ca75e","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Heating to Commands","group":"869caf24.84faf","order":6,"width":4,"height":1,"passthru":false,"label":"Commands","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Commands\"}","payloadType":"json","topic":"","x":200,"y":2580,"wires":[["da7c04cf.ca5b08"]]},{"id":"c7c339e0.995058","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Electricity to Stats","group":"60afeb85.368424","order":4,"width":4,"height":1,"passthru":false,"label":"System Stats","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Stats\"}","payloadType":"json","topic":"","x":190,"y":2880,"wires":[["da7c04cf.ca5b08"]]},{"id":"83e29db8.b6e22","type":"ui_button","z":"ebf0c16.a3b5d4","name":"Electricity to Commands","group":"60afeb85.368424","order":6,"width":4,"height":1,"passthru":false,"label":"Commands","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Commands\"}","payloadType":"json","topic":"","x":210,"y":2840,"wires":[["da7c04cf.ca5b08"]]},{"id":"c5ed0155.b26bd","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4017027e.ebfbfc","order":1,"width":0,"height":0,"name":"Date Stamp Stats","label":"","format":"{{msg.payload}}","layout":"row-left","x":2490,"y":2020,"wires":[]},{"id":"42ec4606.7b7458","type":"ui_text","z":"ebf0c16.a3b5d4","group":"4891585b.501088","order":1,"width":0,"height":0,"name":"Date Stamp Heating","label":"","format":"{{msg.payload}}","layout":"row-left","x":2500,"y":2060,"wires":[]},{"id":"f2f6cc69.0a9b4","type":"ui_text","z":"ebf0c16.a3b5d4","group":"7b890bde.739cf4","order":1,"width":0,"height":0,"name":"Date Stamp Electricity","label":"","format":"{{msg.payload}}","layout":"row-left","x":2500,"y":2100,"wires":[]},{"id":"e0e0dddb.d3018","type":"comment","z":"ebf0c16.a3b5d4","name":"Date and Time Displays","info":"","x":2220,"y":1940,"wires":[]},{"id":"50366d74.4c3c14","type":"comment","z":"ebf0c16.a3b5d4","name":"Amazon Controls","info":"You can say...\n\nAlexa, turn the heating on - Puts the system into Comfort\n\nAlexa, turn the heating off - Puts the system into Standby\n\nAlexa, turn the boost on (or off) - Toggles the Boost ","x":100,"y":700,"wires":[]},{"id":"2903947.90a7e6c","type":"function","z":"ebf0c16.a3b5d4","name":"Day 1","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 1)\nmsgd.payload = \"Go 1\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1660,"wires":[["efd42796.14c568","aa86c34d.a8d6e"]]},{"id":"7d21dd27.2cab54","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1660,"wires":[["2903947.90a7e6c"]]},{"id":"c15ba8a8.6c0528","type":"function","z":"ebf0c16.a3b5d4","name":"Day 2","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 2)\nmsgd.payload = \"Go 2\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1700,"wires":[["d9969bef.fdf1f8","aa86c34d.a8d6e"]]},{"id":"efd42796.14c568","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1700,"wires":[["c15ba8a8.6c0528"]]},{"id":"54e20a61.ef0664","type":"function","z":"ebf0c16.a3b5d4","name":"Day 3","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 3)\nmsgd.payload = \"Go 3\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1740,"wires":[["d741afa8.83c12","aa86c34d.a8d6e"]]},{"id":"d9969bef.fdf1f8","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1740,"wires":[["54e20a61.ef0664"]]},{"id":"dafab4af.41cc98","type":"function","z":"ebf0c16.a3b5d4","name":"Day 4","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 4)\nmsgd.payload = \"Go 4\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1780,"wires":[["ca72ab6.3397158","aa86c34d.a8d6e"]]},{"id":"d741afa8.83c12","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1780,"wires":[["dafab4af.41cc98"]]},{"id":"8146b11a.7a133","type":"function","z":"ebf0c16.a3b5d4","name":"Day 5","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 5)\nmsgd.payload = \"Go 5\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1820,"wires":[["4ccf6ff6.976fb","aa86c34d.a8d6e"]]},{"id":"ca72ab6.3397158","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1820,"wires":[["8146b11a.7a133"]]},{"id":"38523775.fc2ec8","type":"function","z":"ebf0c16.a3b5d4","name":"Day 6","func":"// Not implemented this yet\nvar msgd = {}\nglobal.set(\"day\", 6)\nmsgd.payload = \"Go 6\"\nreturn msgd\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1890,"y":1860,"wires":[["aa86c34d.a8d6e"]]},{"id":"4ccf6ff6.976fb","type":"delay","z":"ebf0c16.a3b5d4","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1580,"y":1860,"wires":[["38523775.fc2ec8"]]},{"id":"e9d4acea.ccd6c","type":"comment","z":"ebf0c16.a3b5d4","name":"Amend to your Owl's IP the node below ","info":"","x":2610,"y":640,"wires":[]},{"id":"beae0046.378d3","type":"ui_text","z":"ebf0c16.a3b5d4","group":"9a0199d0.1b31b8","order":32,"width":9,"height":3,"name":"Set Heating Note","label":"","format":"If Commiting for This Day, wait 6 seconds for the commands to complete. If the All Days then wait 40 seconds. You can open a second browser widow and it will show the commands being executed with the responses..","layout":"col-center","x":2110,"y":1520,"wires":[]},{"id":"4017027e.ebfbfc","type":"ui_group","name":"System Data","tab":"67ce1763.332ba8","order":1,"disp":true,"width":8,"collapse":false},{"id":"7b890bde.739cf4","type":"ui_group","name":"Owl Electricity Power","tab":"58a873ec.e84cfc","order":1,"disp":true,"width":"8","collapse":false},{"id":"4891585b.501088","type":"ui_group","name":"Owl Heating Temperatures","tab":"93701cb7.df51","order":1,"disp":true,"width":"8","collapse":false},{"id":"e9add7f2.770078","type":"ui_group","name":"Heating Controls","tab":"93701cb7.df51","order":2,"disp":true,"width":8,"collapse":false},{"id":"f589e73.7f8e918","type":"ui_group","name":"Commands/Responses:","tab":"f68b1566.790328","order":1,"disp":true,"width":"15","collapse":false},{"id":"badbc62a.b26778","type":"ui_group","name":"Electricity Rates","tab":"58a873ec.e84cfc","order":3,"disp":true,"width":8,"collapse":false},{"id":"9c7fafed.09e19","type":"ui_group","name":"Electricity Consumption","tab":"58a873ec.e84cfc","order":2,"disp":true,"width":8,"collapse":false},{"id":"9a0199d0.1b31b8","type":"ui_group","name":"View/Modify Heating Periods","tab":"5ad87f19.c1bb7","order":1,"disp":true,"width":9,"collapse":false},{"id":"576fbb57.7a0cc4","type":"ui_group","name":"Heating Setup","tab":"93701cb7.df51","order":3,"disp":true,"width":8,"collapse":false},{"id":"b5f3abf7.f53de8","type":"ui_group","name":"Navigation","tab":"67ce1763.332ba8","order":2,"disp":true,"width":8,"collapse":false},{"id":"869caf24.84faf","type":"ui_group","name":"Navigation","tab":"93701cb7.df51","order":4,"disp":true,"width":8,"collapse":false},{"id":"60afeb85.368424","type":"ui_group","name":"Navigation","tab":"58a873ec.e84cfc","order":4,"disp":true,"width":8,"collapse":false},{"id":"1f2c286a.c3a7d8","type":"ui_group","name":"Welcome ","tab":"99e051be.60704","order":1,"disp":true,"width":8,"collapse":false},{"id":"2641f0f4.cd2b3","type":"ui_group","name":"Set the Away Period","tab":"8d3b7bd5.e1d758","order":1,"disp":true,"width":"8","collapse":false},{"id":"a2e1b599.099be8","type":"ui_group","name":"Heating Parameters","tab":"6bdad7dc.59a698","order":1,"disp":true,"width":8,"collapse":false},{"id":"91b9efe8.4a598","type":"mqtt-broker","name":"MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"ce55982d.16ff08","type":"ui_group","name":"Navigation","tab":"99e051be.60704","order":2,"disp":true,"width":8,"collapse":false},{"id":"859ceabd.e40bc8","type":"ui_group","name":"Navigation","tab":"f68b1566.790328","order":2,"disp":true,"width":8,"collapse":false},{"id":"67ce1763.332ba8","type":"ui_tab","name":"Stats","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"58a873ec.e84cfc","type":"ui_tab","name":"Electricity","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"93701cb7.df51","type":"ui_tab","name":"Heating","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"f68b1566.790328","type":"ui_tab","name":"Commands","icon":"dashboard","order":8,"disabled":false,"hidden":false},{"id":"5ad87f19.c1bb7","type":"ui_tab","name":"Set Heating","icon":"dashboard","order":5,"disabled":false,"hidden":false},{"id":"99e051be.60704","type":"ui_tab","name":"Owl","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"8d3b7bd5.e1d758","type":"ui_tab","name":"Set Away Period","icon":"dashboard","order":6,"disabled":false,"hidden":false},{"id":"6bdad7dc.59a698","type":"ui_tab","name":"Heating Parameters","icon":"dashboard","order":7,"disabled":false,"hidden":false}]
@el3venth
Copy link

el3venth commented Jan 9, 2023

@richardsg307 I see you had a piece of Arduino code working that does the traffic sniffing.
Any chance you still have that available?

@richardsg307
Copy link
Author

richardsg307 commented Jan 9, 2023 via email

@richardsg307
Copy link
Author

richardsg307 commented Jan 10, 2023

@richardsg307 I see you had a piece of Arduino code working that does the traffic sniffing. Any chance you still have that available?
I've got several versions. This is the WiFi one that receives the packets and then sends them on HA via MQTT. Haven't checked it to see if it still works (ie that I haven't corrupted it in any way in the couple of years since I dropped it). You'll need to put in your own SSID, IPs, users and passwords.

/**************************************************************************
 * Written for A-Z Delivery ESP8266 NodeMCU V3
 * Set up UDP Multicast to receive Pushed messages from the Owl Intuition
 * This required a setting in the Owl Dashboard (Local IP (currently 199 but 
 * will change to 15x) and Port(8600))
 */

#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#include <WiFiUdp.h>
#include <PubSubClient.h>

#define buffer_size 360
#define LED_BUILTIN D4

IPAddress myIP(192, 168, x,y);
unsigned int localPort =  8600;   // local port to listen on 8600 (push) or 22600 (MultiCast)
char packetBuffer[buffer_size]; //buffer to hold incoming packet,
int start_point;
String UDP_Data;
String hrssi, hlqi, hbattery, state, flags, until, current, required; // Heating
String temp, weather; // Weather
String erssi, elqi, ebattery, watts, watt_hours;
boolean address_shown = false;
const char* mqtt_server = "192.168.x.y";
const char* mqtt_user = "user";
const char* mqtt_pwd = "pwd";
String payload; 
char output[110];
char* topic;


WiFiClient wifiClient;
PubSubClient mqttClient(wifiClient);
WiFiUDP Udp;

void setup() {
    WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP

    // put your setup code here, to run once:
    Serial.begin(115200);
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);

    //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wm;

    wm.setSTAStaticIPConfig(myIP, IPAddress(192,168,x,y), IPAddress(255,255,255,0)); // set static ip,gw,sn
    //delay(1000);
    wm.setConnectTimeout(10); // n seconds to try to connect for before continuing
    wm.setConfigPortalTimeout(10); // auto close configportal after n seconds

    // Automatically connect using saved credentials,
    // if connection fails, it starts an access point with the specified name ( "AutoConnectAP"),
    // if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
    // then goes into a blocking loop awaiting configuration and will return success result
    bool res;
    res = wm.autoConnect("ssid","pwd"); // password protected ap

    if(!res) {
        Serial.println("Failed to connect");
        ESP.restart(); // Reboot!
    } 
    else {
        //if you get here you have connected to the WiFi    
        Serial.println("connected...yeey :)");
        digitalWrite(LED_BUILTIN, LOW); // Turn LED on to show unit is connected
    }
    Udp.beginMulticast(myIP, IPAddress(224,192,32,19),localPort); // Start listening
    mqttClient.setServer("192.168.x.y", 1883); // Identify MQTT broker
}

void loop() {
    // put your main code here, to run repeatedly:
   int packetSize = Udp.parsePacket();
   if(packetSize){ // The packet has some size
     Udp.read(packetBuffer,packetSize);
     for(int i=0; i < packetSize; i++) Serial.print(char(packetBuffer[i]));
     Serial.println();
     UDP_Data = packetBuffer;
     for(int i=0; i < packetSize; i++) packetBuffer[i] = '\0';
     digitalWrite(LED_BUILTIN, HIGH); // Little blink to show packet received
     delay(100);
     digitalWrite(LED_BUILTIN, LOW);
     delay(50);

     switch (UDP_Data[1]) { // Decode packets and create Json string for sending to Home Assistant
       
       case 'w':
         //deal with a weather string
         Serial.println("Weather string");
         payload = "{\"Weather\":{\"Ambient\":"; // Initialise W string
         start_point = UDP_Data.indexOf("ture>") + 5;
         temp = UDP_Data.substring(start_point, UDP_Data.indexOf("</temp", start_point));
         payload += temp;
         payload += ",\"Weather\":\"";
         start_point = UDP_Data.indexOf("text>", start_point) + 5;
         weather =  UDP_Data.substring(start_point, UDP_Data.indexOf("</text", start_point));
         payload += weather;
         payload += "\"}}";
         Serial.println(temp + " " + weather);
         topic = "tele/owl/weather";
         break;
         
       case 'e':
         //deal with an electricity string
         Serial.println("Electric string");
         payload = "{\"Electricity\":{\"RSSI\":"; // Initialise E string
         start_point = UDP_Data.indexOf("rssi=\'") + 6;
         erssi = UDP_Data.substring(start_point, UDP_Data.indexOf("\' lqi", start_point));
         payload += erssi;
         payload += ",\"LQI\":";
         start_point = UDP_Data.indexOf("lqi=\'", start_point) + 5;
         elqi =  UDP_Data.substring(start_point, UDP_Data.indexOf("\'/><", start_point));
         payload += elqi;
         payload += ",\"Battery\":";
         start_point = UDP_Data.indexOf("level=\'", start_point) + 7;
         ebattery =  UDP_Data.substring(start_point, UDP_Data.indexOf("%\'/><", start_point));
         payload += ebattery;
         payload += ",\"Power\":";
         start_point = UDP_Data.indexOf("<curr units=\'w\'>", start_point) + 16;
         watts = UDP_Data.substring(start_point,UDP_Data.indexOf("</curr>",start_point));
         payload += watts;
         payload += ",\"Energy\":";
         start_point = UDP_Data.indexOf("<day units=\'wh\'>", start_point) + 16;
         watt_hours = UDP_Data.substring(start_point,UDP_Data.indexOf("</day>",start_point));
         payload += watt_hours;
         payload +="}}";
         Serial.println(erssi + " " + elqi + " " + ebattery + " " + watts + " " + watt_hours); 
         topic = "tele/owl/electricity";
         break;
         
       case 'h':
         //deal with a heating string
         Serial.println("Heating string");
         payload = "{\"Heating\":{\"RSSI\":"; // Initialise H string
         start_point = UDP_Data.indexOf("rssi=\'") + 6;
         hrssi = UDP_Data.substring(start_point, UDP_Data.indexOf("\' lqi", start_point));
         payload += hrssi;
         payload += ",\"LQI\":";
         start_point = UDP_Data.indexOf("lqi=\'", start_point) + 5;
         hlqi =  UDP_Data.substring(start_point, UDP_Data.indexOf("\'/><", start_point));
         payload += hlqi;
         payload += ",\"Battery\":";
         start_point = UDP_Data.indexOf("level=\'", start_point) + 7;
         hbattery =  UDP_Data.substring(start_point, UDP_Data.indexOf("\'/><", start_point));
         payload += hbattery;
         payload += ",\"State\":";
         start_point = UDP_Data.indexOf("state=\'", start_point) + 7;
         state = UDP_Data.substring(start_point,UDP_Data.indexOf("\' flags",start_point));
         payload += state;
         payload += ",\"Flags\":";
         start_point = UDP_Data.indexOf("flags=\'", start_point) + 7;
         flags = UDP_Data.substring(start_point,UDP_Data.indexOf("\' until",start_point));
         payload += flags;
         payload += ",\"Measured\":";
         start_point = UDP_Data.indexOf("current>", start_point) + 8;
         current = UDP_Data.substring(start_point,UDP_Data.indexOf("</current",start_point));
         payload += current;
         payload += ",\"Required\":";
         start_point = UDP_Data.indexOf("required>", start_point) + 9;
         required = UDP_Data.substring(start_point,UDP_Data.indexOf("</required",start_point));
         payload += required;
         payload += "}}";
         Serial.println(hrssi + " " + hlqi + " " + hbattery + " " + state + " " + flags + " " + until + " " + current + " " + required);    
         topic = "tele/owl/heating";
         break;
       
       default:
         // if nothing else matches, do the default
         // default is optional
         break;
      } //end switch
      
      Serial.print(topic);
      Serial.print(" ");
      Serial.println(payload);
      if (!mqttClient.connected()) {
        reconnect();
      }
      Serial.println("Still connected");
      for (int i = 0; i <= payload.length(); i++) output[i] = payload[i];
      mqttClient.publish(topic, output);
      mqttClient.loop();      
     digitalWrite(LED_BUILTIN, HIGH); // Do another little blink to show publishing
     delay(100);
     digitalWrite(LED_BUILTIN, LOW);
   }
}

void reconnect() {
  // Loop until we're reconnected
    // Attempt to connect
  while (!mqttClient.connected()) {
    Serial.print("Attempting MQTT connection...");
    if (mqttClient.connect("mqttClient", "mqttuser", "mqttpwd")) {
      Serial.println("connected");
      mqttClient.setBufferSize(256); 
    } else {
      Serial.print("failed, rc=");
      Serial.print(mqttClient.state());
      Serial.println(" try again in 5 seconds");
      delay(5000); // Wait 5 seconds before retrying
    }
  }
}

@richardsg307
Copy link
Author

@richardsg307 I see you had a piece of Arduino code working that does the traffic sniffing. Any chance you still have that available?

Code is now Posted

@el3venth
Copy link

Thank you Richard.

@muzzy00uk
Copy link

Hey All. hope you're all good.
Since the massive breaking changes in HA ive been trying to find an alternative way of getting the owl readings into HA.
seen your work above and been trying to get this added in which im just about there. ive added the flow to node-red in HA and changed the details to match my MQTT server, UDP key and IP for the sniffer and im able to get info from owl but the power consumption etc is not showing.
is this something that take a little time to come through or have i missed something? i also want to try and get the details for solar added but one step at a time..

@richardsg307
Copy link
Author

Hey All. hope you're all good. Since the massive breaking changes in HA ive been trying to find an alternative way of getting the owl readings into HA. seen your work above and been trying to get this added in which im just about there. ive added the flow to node-red in HA and changed the details to match my MQTT server, UDP key and IP for the sniffer and im able to get info from owl but the power consumption etc is not showing. is this something that take a little time to come through or have i missed something? i also want to try and get the details for solar added but one step at a time..

Stick a Debug Node on the Sniffer and you should see something like

<electricity id='443719002FAD'><timestamp>1703799342</timestamp><signal rssi='-53' lqi='5'/><battery level='10%'/><chan id='0'><curr units='w'>901.00</curr><day units='wh'>27454.02</day></chan><chan id='1'><curr units='w'>0.00</curr><day units='wh'>0.00</day></chan><chan id='2'><curr units='w'>0.00</curr><day units='wh'>0.00</day></chan></electricity>

every minute or so. I assume you actually have the physical Electricity monitor component?

@muzzy00uk
Copy link

Yeah got the monitor working and can see the info on the owl website. I was using the hacs integration and up until the python changes it worked.

I've used the listener for owl and get that info you've mentioned.

<electricity id='4437191047E0' ver='2.0'><timestamp>1703801490</timestamp><signal rssi='-100' lqi='127'/><battery level='100%'/><channels><chan id='0'><curr units='w'>837.00</curr><day units='wh'>16803.11</day></chan><chan id='1'><curr units='w'>16.00</curr><day units='wh'>2654.64</day></chan><chan id='2'><curr units='w'>0.00</curr><day units='wh'>0.00</day></chan><chan id='3'><curr units='w'>0.00</curr><day units='wh'>0.00</day></chan><chan id='4'><curr units='w'>0.00</curr><day units='wh'>0.00</day></chan><chan id='5'><curr units='w'>0.00</curr><day units='wh'>0.00</day></chan></channels><property><current><watts>837.00</watts><cost>9.78</cost></current><day><wh>16803.11</wh><cost>187.82</cost></day><tariff time='1703801490'><start>1703721600</start><curr_price>0.12</curr_price><block_limit>4294967295</block_limit><block_usage>12946</block_usage></tariff></property></electricity>

<solar id='4437191047E0'><timestamp>1703801671</timestamp><current><generating units='w'>16.00</generating><exporting units='w'>0.00</exporting></current><day><generated units='wh'>2655.47</generated><exported units='wh'>0.00</exported></day></solar>

@richardsg307
Copy link
Author

richardsg307 commented Dec 29, 2023

Hmmm. Your message looks more complicated than mine. I have no Solar and just a single tariff for the electricity. You'll have to work out what changes you need to make to the Function following the Electricity Edit XML Node to build the MQTT message for forwarding to HA. And, similarly a brand new Function to deal with the Solar message. You'll have to use my code as an example to help you work out the syntax.

I've now given up on the Owl Heating side and changed my thermostat to a Sonoff NS Panel and ESP Home, so just use the Electricity and Weather bit of Owl now. I might even get rid of that soon, replacing it with a Zigbee sensor.

It's late, and I've not looked at this for over a year now, but it looks like I didn't mention that you have to create the MQTT sensors in HA which receive the MQTT message and populate the entities. These are all that I had matching the Node-Red code given in my original post. This was in my configuration.yaml file.

mqtt:
  sensor:
   ...
    - name: "Owl Intuition Outside Temperature"
      unique_id: sunny_mqtt_0007
      state_topic: "tele/owl/weather"
      unit_of_measurement: '°C'
      value_template: "{{value_json['Weather'].Ambient}}"
      force_update: true
    - name: "Owl Intuition Weather Report"
      unique_id: sunny_mqtt_0008
      state_topic: "tele/owl/weather"
      value_template: "{{value_json['weather'].Weather}}"
    - name: "Owl Intuition Power"
      unique_id: sunny_mqtt_0009
      state_topic: "tele/owl/electricity"
      unit_of_measurement: "W"
      value_template: "{{value_json['Electricity'].Power}}"
      force_update: true
    - name: "Owl Intuition Energy"
      unique_id: sunny_mqtt_00010
      state_topic: "tele/owl/electricity"
      unit_of_measurement: "Wh"
      device_class: energy
      state_class: total_increasing
      value_template: "{{value_json['Electricity'].Energy}}"
      force_update: true
    - name: "Owl Intuition Electricity RSSI"
      unique_id: sunny_mqtt_0011
      state_topic: "tele/owl/electricity"
      unit_of_measurement: "dB"
      value_template: "{{value_json['Electricity'].RSSI}}"
      force_update: true
    - name: "Owl Intuition Electricity LQI"
      unique_id: sunny_mqtt_0012
      state_topic: "tele/owl/electricity"
      unit_of_measurement: "%"
      value_template: "{{value_json['Electricity'].LQI}}"
      force_update: true
    - name: "Owl Intuition Electricity Battery"
      unique_id: sunny_mqtt_00013
      state_topic: "tele/owl/electricity"
      value_template: "{{value_json['Electricity'].Battery}}"
      force_update: true
    - name: "Owl Intuition Hall Temperature"
      unique_id: sunny_mqtt_0014
      state_topic: "tele/owl/heating"
      unit_of_measurement: '°C'
      value_template: "{{value_json['Heating'].Measured}}"
      force_update: true
    - name: "Owl Intuition Demanded Temperature"
      unique_id: sunny_mqtt_0015
      state_topic: "tele/owl/heating"
      unit_of_measurement: '°C'
      force_update: true
      value_template: "{{value_json['Heating'].Required}}"
    - name: "Owl Intuition Thermostat RSSI"
      unique_id: sunny_mqtt_0016
      state_topic: "tele/owl/heating"
      unit_of_measurement: "dB"
      value_template: "{{value_json['Heating'].RSSI}}"
      force_update: true
    - name: "Owl Intuition Thermostat LQI"
      unique_id: sunny_mqtt_0017
      state_topic: "tele/owl/heating"
      unit_of_measurement: "%"
      value_template: "{{value_json['Heating'].LQI}}"
      force_update: true
    - name: "Owl Intuition Thermostat Battery"
      unique_id: sunny_mqtt_0018
      state_topic: "tele/owl/heating"
      value_template: "{{value_json['Heating'].Battery}}"
      unit_of_measurement: "mV"
      force_update: true
   - name: "Owl Intuition Heating State"
      unique_id: sunny_mqtt_0019
      state_topic: "tele/owl/heating"
      value_template: "{{value_json['Heating'].State}}"
      force_update: true
    - name: "Owl Intuition Heating Flags"
      unique_id: sunny_mqtt_00020
      state_topic: "tele/owl/heating"
      value_template: "{{value_json['Heating'].Flags}}"
      force_update: true

Good luck.

@muzzy00uk
Copy link

thanks for looking. i'm also getting the point where i might just give up on owl and get something like the shelly em to work with HA.

I didnt get to the point of setting up the sensors, was just making sure the node-red flow was working before that. will take a look at what you've posted and see what i can do... im far from a coder so dont understand all of the code from node-red and the json scripts.

i will let you know if i manage to figure something out.

@nivek1612
Copy link

nivek1612 commented Jan 7, 2024

I can’t have a smart meter due to the signal reception where we live (not sure I’d want one either) I’ve been the using idea in this code for a while now just to capture the multicast electricity reading as that’s all I use owl for. I then reverse engineer the meter reading value from the owl data. After 6 months of it running it my HA instance readings for the meter are within 1 kWh accuracy for both my day and night readings so seems super accurate. Thanks for the inspiration

IMG_4646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment