Coffee Pot Timer

platform: PiZero W also running MQTT
SonOff S20 switch running ESPeasy mega-20181025
NR: v0.19.4
Node.js: v8.12.0
dashboard: v2.10.1
Extra node(s):

  • node-red-dashboard
  • node-red-contrib-mytimeout
  • node-red-contrib-alexa-local (optional)

Goal: Shut off a coffee pot 20 minutes after it is turned on and allow it to be turned on/off remotely or by voice (Alexa)

The story: I make coffee for myself and sometimes (ok, enough times to make me come up with this solution) I forget to shut off the pot after pouring the last (or most of the last) of the coffee. When I come back several hours later, the bottom of the pot (glass pot) has coffee baked on to it and I have to scrub it off.

So I got a SonOff S20, flashed it with ESPeasy and configured it to use MQTT, defined the device as a switch, and added a rule (cnfiguration attached).

In Node-RED, I put in a dashboard button (using fa-coffee) colored green when on and red when off and a donut graph to show the state - green on, grey off and I added a count down timer:
on-off
Every thing works great, if I setup the coffee the night before, I can wake up, grab my phone and link to the dashboard, click on the coffee cup and by the time I get downstairs, my coffee is ready. And if I forget to shut off the pot, the countdown timer will shut it off for me.

I even added a small extra flow so you can have Alexa turn it on or off with voice commands!

Here is the flow:

[{"id":"6c29b57a.3e9e6c","type":"tab","label":"Coffee Pot","disabled":false,"info":""},{"id":"4de47888.28887","type":"tab","label":"CP - monitor S20","disabled":false,"info":""},{"id":"2cafff00.623622","type":"tab","label":"CP - countdown","disabled":false,"info":""},{"id":"b487bcf.89c704","type":"tab","label":"CP  - Alexa code","disabled":false,"info":""},{"id":"c3a390f2.e60ef8","type":"mqtt-broker","z":"","name":"","broker":"192.168.48.100","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"cd1729e6.702738","type":"ui_group","z":"","name":"Coffee Pot","tab":"f973b669.331fa","order":2,"disp":false,"width":"6","collapse":false},{"id":"f973b669.331fa","type":"ui_tab","z":"","name":"Coffee Pot","icon":"dashboard","order":1},{"id":"9a726505.83a4b","type":"mqtt-broker","z":"","name":"","broker":"192.168.48.100","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"6dc3c9c2.d9fed8","type":"ui_group","z":"","name":"Coffee Pot","tab":"99d668e.48e2918","order":2,"disp":false,"width":"6","collapse":false},{"id":"99d668e.48e2918","type":"ui_tab","z":"","name":"Coffee Pot","icon":"dashboard","order":1},{"id":"13ed15eb.4bda0a","type":"ui_group","z":"","name":"Coffee Pot","tab":"2019b454.21de84","order":2,"disp":false,"width":"6","collapse":false},{"id":"2019b454.21de84","type":"ui_tab","z":"","name":"Coffee Pot","icon":"dashboard","order":1},{"id":"41088cb9.4f7424","type":"mqtt in","z":"6c29b57a.3e9e6c","name":"Monitor all messages","topic":"coffee30/#","qos":"2","broker":"c3a390f2.e60ef8","x":440,"y":400,"wires":[["7c0b3cd1.a3fc74"]]},{"id":"7c0b3cd1.a3fc74","type":"debug","z":"6c29b57a.3e9e6c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":630,"y":400,"wires":[]},{"id":"a1456196.d699d","type":"mqtt out","z":"6c29b57a.3e9e6c","name":"Send 1/0 to the switch","topic":"","qos":"","retain":"","broker":"c3a390f2.e60ef8","x":680,"y":220,"wires":[]},{"id":"8b510e6f.bbb6b8","type":"comment","z":"6c29b57a.3e9e6c","name":"Flows to turn a SonOff S20 on/off via dashboard, Alexa, inject nodes or by manually pressing the switch. Turns it off after 20 minutes","info":"These flows allow various ways to turn on/off a SonOff S20 that has a coffee pot \nplugged into it. You can use the dashboard, you can manually press the switch's \nbutton or tell Alexa \"Alexa, turn the coffee pot on\". (You could easilly add other\nmethods if needed.) In all situations, it will automatically turn the pot off after \ntwenty (20) minutes (or the value you set in the editor.)\n\nThe flow create a dashboard with an on/off switch (a coffee cup icon), a donut chart \nthat changes from red to green and a countdown timer showing how long before the \nswitch will be turned off. You can change the amount of time by changing the value \nin the insert node.\n\nIf the switch is manually pressed, it will also start the countdown timer and shut \nthe plug off after the defined time limit. ","x":480,"y":40,"wires":[]},{"id":"1cbbdee8.36f261","type":"change","z":"6c29b57a.3e9e6c","name":"Setup switch topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"coffee30/gpio/12","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":220,"wires":[["a1456196.d699d","20d6f55.06afa8a"]]},{"id":"ca372d2d.479b78","type":"ui_switch","z":"6c29b57a.3e9e6c","name":"ON/OFF","label":"","group":"cd1729e6.702738","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"fa-coffee fa-5x","oncolor":"#00B500","offvalue":"0","offvalueType":"num","officon":"fa-coffee fa-5x","offcolor":"#CA3838","x":180,"y":220,"wires":[["1cbbdee8.36f261","9cf1c376.81537"]]},{"id":"20d6f55.06afa8a","type":"debug","z":"6c29b57a.3e9e6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":370,"y":260,"wires":[]},{"id":"9e3c5771.e4cd98","type":"inject","z":"6c29b57a.3e9e6c","name":"manual on","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":360,"wires":[["ca372d2d.479b78"]]},{"id":"a53ae132.1387d8","type":"inject","z":"6c29b57a.3e9e6c","name":"manual off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":400,"wires":[["ca372d2d.479b78"]]},{"id":"2e8414f7.9b3454","type":"link in","z":"6c29b57a.3e9e6c","name":"on/off","links":["62f7139.fe0aa6c","e5273161.235928"],"x":55,"y":220,"wires":[["ca372d2d.479b78"]]},{"id":"414ace38.ce8618","type":"ui_text","z":"6c29b57a.3e9e6c","group":"cd1729e6.702738","order":1,"width":"6","height":"1","name":"filler - push ON/OFF down in dashboard","label":"","format":"{{msg.payload}}","layout":"row-spread","x":760,"y":320,"wires":[]},{"id":"8f5b6fef.68d02","type":"inject","z":"6c29b57a.3e9e6c","name":"Send 1200 to the timer","topic":"","payload":"1200","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":120,"wires":[["2ad7dc36.2c3cdc"]]},{"id":"2ad7dc36.2c3cdc","type":"change","z":"6c29b57a.3e9e6c","name":"","rules":[{"t":"set","p":"coffeePotTimer","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":120,"wires":[[]]},{"id":"727d4cf5.d52424","type":"comment","z":"6c29b57a.3e9e6c","name":"initilize the countdown timer to 20 minutes (60 seconds times 20 minutes = 1200 seconds)","info":"","x":350,"y":80,"wires":[]},{"id":"2b8983fc.8ed43c","type":"comment","z":"6c29b57a.3e9e6c","name":"Process on/off (1/0) and send it to the switch using the topic 'coffee30/gpio/12'","info":"","x":420,"y":180,"wires":[]},{"id":"36d3260f.04415a","type":"comment","z":"6c29b57a.3e9e6c","name":"Manual on/off for testing","info":"","x":150,"y":320,"wires":[]},{"id":"9cf1c376.81537","type":"change","z":"6c29b57a.3e9e6c","name":"","rules":[{"t":"set","p":"buttonState","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":320,"wires":[["2e1d7f12.627fe"]]},{"id":"2e1d7f12.627fe","type":"debug","z":"6c29b57a.3e9e6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":450,"y":360,"wires":[]},{"id":"bdd9127d.92c99","type":"mqtt in","z":"4de47888.28887","name":"Coffee state: on/off?","topic":"coffee30/coffeeState/Switch","qos":"2","broker":"9a726505.83a4b","x":130,"y":80,"wires":[["e16ed6d2.80eb48","98c1ed4c.28211"]]},{"id":"e0b3b3d7.9af48","type":"debug","z":"4de47888.28887","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":140,"wires":[]},{"id":"e16ed6d2.80eb48","type":"switch","z":"4de47888.28887","name":"check on or off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":140,"y":140,"wires":[["242b1d64.e7f9c2"],["dfd6d68a.6f976"]]},{"id":"dfd6d68a.6f976","type":"change","z":"4de47888.28887","name":"if OFF, reset DELAY","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":260,"wires":[["d560c1e9.9dd698","8fbeb053.569c5"]]},{"id":"98c1ed4c.28211","type":"ui_gauge","z":"4de47888.28887","name":"Coffee Pot Status","group":"6dc3c9c2.d9fed8","order":3,"width":0,"height":0,"gtype":"donut","title":"Coffee Pot Status","label":"","format":"{{value}}","min":"0","max":"1","colors":["#00B500","#00B500","#00B500"],"seg1":"","seg2":"","x":390,"y":80,"wires":[]},{"id":"f8fd4cc5.671fe8","type":"comment","z":"4de47888.28887","name":"This code monitors the status of the SonOff switch (the 'Pot') and sets or resets the delay","info":"","x":350,"y":40,"wires":[]},{"id":"81c8fa85.0e05d","type":"debug","z":"4de47888.28887","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":200,"wires":[]},{"id":"242b1d64.e7f9c2","type":"change","z":"4de47888.28887","name":"if ON build DELAY json","rules":[{"t":"set","p":"coffeePotTimer","pt":"msg","to":"coffeePotTimer","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"{\t   \"payload\": \"on\",\t   \"timeout\": coffeePotTimer,\t   \"warning\": 3\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":140,"wires":[["d560c1e9.9dd698","e0b3b3d7.9af48"]]},{"id":"e31228bb.2f8b4","type":"debug","z":"4de47888.28887","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":320,"wires":[]},{"id":"f26c688e.16755","type":"link out","z":"4de47888.28887","name":"to timer","links":["11532c7f.408924"],"x":735,"y":320,"wires":[]},{"id":"8fbeb053.569c5","type":"debug","z":"4de47888.28887","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":190,"y":360,"wires":[]},{"id":"d5643832.dc186","type":"comment","z":"4de47888.28887","name":"Link to countdown timer","info":"","x":870,"y":320,"wires":[]},{"id":"d560c1e9.9dd698","type":"mytimeout","z":"4de47888.28887","name":"Coffee OFF delay","outtopic":"","outsafe":"1","outwarning":"","outunsafe":"0","warning":"5","timer":"4","debug":false,"ndebug":false,"ignoreCase":false,"repeat":false,"again":false,"x":590,"y":240,"wires":[["81c8fa85.0e05d","2f5efc86.2e8464"],["e31228bb.2f8b4","f26c688e.16755"]]},{"id":"6838d540.83973c","type":"link out","z":"4de47888.28887","name":"To on/off","links":["d2d55e9f.41c84"],"x":795,"y":260,"wires":[]},{"id":"30092471.27f35c","type":"comment","z":"4de47888.28887","name":"need this since timer returns strings","info":"","x":900,"y":160,"wires":[]},{"id":"287ac60d.fb413a","type":"comment","z":"4de47888.28887","name":"Link to Coffee Pot","info":"","x":910,"y":260,"wires":[]},{"id":"2f5efc86.2e8464","type":"change","z":"4de47888.28887","name":"convert literal number to numeric ","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":200,"wires":[["6838d540.83973c"]]},{"id":"a64bf2b1.bae428","type":"change","z":"2cafff00.623622","name":"change to hh:ss","rules":[{"t":"set","p":"payload","pt":"msg","to":"(payload-(payload%60))/60 & \":\" & $pad($string(payload%60),-2,\"0\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":120,"wires":[["46327c49.6a3ae4"]]},{"id":"aea3a5fb.21606","type":"link in","z":"2cafff00.623622","name":"timer","links":["f2c3430.c53094"],"x":115,"y":120,"wires":[["a64bf2b1.bae428"]]},{"id":"4fbdbd02.131c74","type":"comment","z":"2cafff00.623622","name":"Displays countdown till pot turns off","info":"","x":240,"y":80,"wires":[]},{"id":"46327c49.6a3ae4","type":"ui_text","z":"2cafff00.623622","group":"13ed15eb.4bda0a","order":4,"width":0,"height":0,"name":"","label":"Time till auto shutoff","format":"{{msg.payload}}","layout":"col-center","x":480,"y":120,"wires":[]},{"id":"b05f3a86.70683","type":"debug","z":"b487bcf.89c704","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":130,"y":200,"wires":[]},{"id":"e66810dd.f9b4f","type":"link out","z":"b487bcf.89c704","name":"To on/off","links":["d2d55e9f.41c84"],"x":655,"y":140,"wires":[]},{"id":"791bf4f5.f8159c","type":"change","z":"b487bcf.89c704","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":120,"wires":[["e66810dd.f9b4f"]]},{"id":"222970b9.bfcbf","type":"switch","z":"b487bcf.89c704","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":140,"wires":[["791bf4f5.f8159c"],["10992e17.451aaa"]]},{"id":"10992e17.451aaa","type":"change","z":"b487bcf.89c704","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":160,"wires":[["e66810dd.f9b4f"]]},{"id":"51ca5e06.a6026","type":"comment","z":"b487bcf.89c704","name":"Code to allow Alexa to turn the pot on/off","info":"","x":260,"y":60,"wires":[]},{"id":"f4445c86.044008","type":"comment","z":"b487bcf.89c704","name":"Link to Coffee Pot","info":"","x":770,"y":140,"wires":[]},{"id":"eb3c84a.3cbebf8","type":"alexa-local","z":"b487bcf.89c704","devicename":"Coffee Pot","inputtrigger":false,"x":150,"y":140,"wires":[["b05f3a86.70683","222970b9.bfcbf"]]}]

Here are images of SonOff configuration:
cp-espeasy-config




cp-espeasy-devices-task-1
cp-espeasy-devices-task-2
NOTE: for device 1 and 2 bottom of the page was cutoff - the name filed is 'switch' for both
cp-espeasy-devices-task-3
NOTE: in order to see the rules menu, you must go to Tools->Advanced and check off the 'Rules' box
cp-espeasy-rules

Any questions feel free to ask.
Paul

7 Likes

Mmmm, coffee and donuts... yum! Although I would probably expect a hot pot of coffee to be shown in Red, not green ;*)

Thanks for this detailed explanation, Paul -- for those of us who have never interfaced node-red with any hardware (and cannot spell "ESP Easy"), it helps to see how the config is set up.

Here is your next challenge: put the "time until shut off" inside the donut, and color the fraction of the ring that is left with that much time remaining...

3 Likes

Thanks Steve, I just spend a couple hours figuring out why when I press the button on the SonOff, the donut went green but the coffee cup didn't and now you have tempted...I say tempted me!!! (...brain starts to churn...hmmm...) and next you'll probably want me to calculate the amount of time it takes to fill the pot and have the donut go green by degrees.

Once you have a couple espeasy devices, try out my 'ET Display Home' which displays all your ESPeasy or Tasmota devices on your network and each one has a link to the devices controer page. Lately I've found it is so helfull to see which device is online and lets me go to the settings with a click.

1 Like

@shrickus - ok Steve, I finally had a chance to get back to this and this is the result
30%20AM

and here is the flow:

[{"id":"e60e32d1.50335","type":"tab","label":"Coffee Pot","disabled":false,"info":""},{"id":"4203db52.02bc74","type":"mqtt in","z":"e60e32d1.50335","name":"Monitor all messages","topic":"coffee30/#","qos":"2","broker":"d3a534c7.1a7f5","x":440,"y":400,"wires":[["1d28d6db.955bd9"]]},{"id":"1d28d6db.955bd9","type":"debug","z":"e60e32d1.50335","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":630,"y":400,"wires":[]},{"id":"81283e4a.004db8","type":"mqtt out","z":"e60e32d1.50335","name":"Send 1/0 to the switch","topic":"","qos":"","retain":"","broker":"d3a534c7.1a7f5","x":800,"y":220,"wires":[]},{"id":"f70491ae.3fd5e","type":"comment","z":"e60e32d1.50335","name":"Flows to turn a SonOff S20 on/off via dashboard, Alexa, inject nodes or by manually pressing the switch. Turns it off after 20 minutes","info":"These flows allow various ways to turn on/off a SonOff S20 that has a coffee pot \nplugged into it. You can use the dashboard, you can manually press the switch's \nbutton or tell Alexa \"Alexa, turn the coffee pot on\". (You could easilly add other\nmethods if needed.) In all situations, it will automatically turn the pot off after \ntwenty (20) minutes (or the value you set in the editor.)\n\nThe flow create a dashboard with an on/off switch (a coffee cup icon), a donut chart \nthat changes from red to green and a countdown timer showing how long before the \nswitch will be turned off. You can change the amount of time by changing the value \nin the insert node.\n\nIf the switch is manually pressed, it will also start the countdown timer and shut \nthe plug off after the defined time limit. ","x":480,"y":40,"wires":[]},{"id":"62d12718.40c9c8","type":"change","z":"e60e32d1.50335","name":"Setup switch topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"coffee30/gpio/12","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":220,"wires":[["81283e4a.004db8","feed0e2d.8f5dd8"]]},{"id":"d384d493.27ce9","type":"ui_switch","z":"e60e32d1.50335","name":"ON/OFF","label":"","group":"cc4e00e1.3a6d1","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"fa-coffee fa-5x","oncolor":"#00B500","offvalue":"0","offvalueType":"num","officon":"fa-coffee fa-5x","offcolor":"#CA3838","x":220,"y":220,"wires":[["3c2f41ba.88fb56","706b99ed.ec4628","62d12718.40c9c8","67d19980.c8437"]]},{"id":"feed0e2d.8f5dd8","type":"debug","z":"e60e32d1.50335","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":260,"wires":[]},{"id":"9d95d951.cb814","type":"inject","z":"e60e32d1.50335","name":"manual on","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":360,"wires":[["d384d493.27ce9"]]},{"id":"c58f34ba.cab9a","type":"inject","z":"e60e32d1.50335","name":"manual off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":400,"wires":[["d384d493.27ce9"]]},{"id":"d2d55e9f.41c84","type":"link in","z":"e60e32d1.50335","name":"on/off","links":["62f7139.fe0aa6c","e5273161.235928"],"x":55,"y":220,"wires":[["d384d493.27ce9"]]},{"id":"b01f62f8.a1c968","type":"ui_text","z":"e60e32d1.50335","group":"cc4e00e1.3a6d1","order":1,"width":"6","height":"1","name":"filler - push ON/OFF down in dashboard","label":"","format":"{{msg.payload}}","layout":"row-spread","x":500,"y":460,"wires":[]},{"id":"4f5fc825.6cabb8","type":"inject","z":"e60e32d1.50335","name":"Send 1200 to the timer","topic":"","payload":"1200","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":120,"wires":[["7eea39a9.537448"]]},{"id":"7eea39a9.537448","type":"change","z":"e60e32d1.50335","name":"","rules":[{"t":"set","p":"coffeePotTimer","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":120,"wires":[[]]},{"id":"38ffe23b.a2375e","type":"comment","z":"e60e32d1.50335","name":"initilize the countdown timer to 20 minutes (60 seconds times 20 minutes = 1200 seconds)","info":"","x":350,"y":80,"wires":[]},{"id":"8fb2e45b.4eb6a","type":"comment","z":"e60e32d1.50335","name":"Process on/off (1/0) and send it to the switch using the topic 'coffee30/gpio/12'","info":"","x":420,"y":180,"wires":[]},{"id":"91eb99b2.762af","type":"comment","z":"e60e32d1.50335","name":"Manual on/off for testing","info":"","x":150,"y":320,"wires":[]},{"id":"706b99ed.ec4628","type":"change","z":"e60e32d1.50335","name":"","rules":[{"t":"set","p":"buttonState","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":320,"wires":[["6d722919.43f498"]]},{"id":"6d722919.43f498","type":"debug","z":"e60e32d1.50335","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":650,"y":320,"wires":[]},{"id":"67d19980.c8437","type":"debug","z":"e60e32d1.50335","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":390,"y":260,"wires":[]},{"id":"3c2f41ba.88fb56","type":"debug","z":"e60e32d1.50335","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":350,"y":580,"wires":[]},{"id":"d3a534c7.1a7f5","type":"mqtt-broker","z":"","name":"","broker":"192.168.48.100","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"cc4e00e1.3a6d1","type":"ui_group","z":"","name":"Coffee Pot","tab":"7cf8cd4f.6316fc","order":1,"disp":false,"width":"6","collapse":false},{"id":"7cf8cd4f.6316fc","type":"ui_tab","z":"","name":"Coffee Pot","icon":"dashboard","order":1},{"id":"32999909.eeef96","type":"tab","label":"CP - monitor S20","disabled":false,"info":""},{"id":"980ea1a9.201128","type":"mqtt in","z":"32999909.eeef96","name":"Coffee state: on/off?","topic":"coffee30/coffeeState/Switch","qos":"2","broker":"d3a534c7.1a7f5","x":130,"y":80,"wires":[["eabe129b.217b6","b518647a.dd2e88"]]},{"id":"e1035966.b9611","type":"debug","z":"32999909.eeef96","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":140,"wires":[]},{"id":"eabe129b.217b6","type":"switch","z":"32999909.eeef96","name":"check on or off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":140,"y":140,"wires":[["f79d9af.61073e8"],["73958595.3cbdbc"]]},{"id":"73958595.3cbdbc","type":"change","z":"32999909.eeef96","name":"if OFF, reset DELAY","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":260,"wires":[["ce392687.3546c8","3133125f.1c0296"]]},{"id":"b518647a.dd2e88","type":"ui_gauge","z":"32999909.eeef96","name":"Coffee Pot Status","group":"cc4e00e1.3a6d1","order":3,"width":0,"height":0,"gtype":"donut","title":"Coffee Pot Status","label":"","format":"","min":"0","max":"1200","colors":["#FFFF00","#FFFF00","#00B500"],"seg1":"","seg2":"","x":390,"y":80,"wires":[]},{"id":"9daae5f0.6d776","type":"comment","z":"32999909.eeef96","name":"This code monitors the status of the SonOff switch (the 'Pot') and sets or resets the delay","info":"","x":350,"y":40,"wires":[]},{"id":"a36d657e.fabc98","type":"debug","z":"32999909.eeef96","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":200,"wires":[]},{"id":"f79d9af.61073e8","type":"change","z":"32999909.eeef96","name":"if ON build DELAY json","rules":[{"t":"set","p":"coffeePotTimer","pt":"msg","to":"coffeePotTimer","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"{\t   \"payload\": \"on\",\t   \"timeout\": coffeePotTimer,\t   \"warning\": 3\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":140,"wires":[["ce392687.3546c8","e1035966.b9611"]]},{"id":"66bc3eed.91e66","type":"debug","z":"32999909.eeef96","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":320,"wires":[]},{"id":"f2c3430.c53094","type":"link out","z":"32999909.eeef96","name":"to timer","links":["11532c7f.408924"],"x":735,"y":320,"wires":[]},{"id":"3133125f.1c0296","type":"debug","z":"32999909.eeef96","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":190,"y":360,"wires":[]},{"id":"2aa0d5b3.0b9f12","type":"comment","z":"32999909.eeef96","name":"Link to countdown timer","info":"","x":870,"y":320,"wires":[]},{"id":"ce392687.3546c8","type":"mytimeout","z":"32999909.eeef96","name":"Coffee OFF delay","outtopic":"","outsafe":"1","outwarning":"","outunsafe":"0","warning":"5","timer":"4","debug":false,"ndebug":false,"ignoreCase":false,"repeat":false,"again":false,"x":590,"y":240,"wires":[["a36d657e.fabc98","4e405848.318aa8"],["66bc3eed.91e66","f2c3430.c53094","b518647a.dd2e88"]]},{"id":"e5273161.235928","type":"link out","z":"32999909.eeef96","name":"To on/off","links":["d2d55e9f.41c84"],"x":795,"y":260,"wires":[]},{"id":"72907f23.c04f5","type":"comment","z":"32999909.eeef96","name":"need this since timer returns strings","info":"","x":900,"y":160,"wires":[]},{"id":"71b5b5eb.c52cd4","type":"comment","z":"32999909.eeef96","name":"Link to Coffee Pot","info":"","x":910,"y":260,"wires":[]},{"id":"4e405848.318aa8","type":"change","z":"32999909.eeef96","name":"convert literal number to numeric ","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":200,"wires":[["e5273161.235928"]]},{"id":"d3a534c7.1a7f5","type":"mqtt-broker","z":"","name":"","broker":"192.168.48.100","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"cc4e00e1.3a6d1","type":"ui_group","z":"","name":"Coffee Pot","tab":"7cf8cd4f.6316fc","order":1,"disp":false,"width":"6","collapse":false},{"id":"7cf8cd4f.6316fc","type":"ui_tab","z":"","name":"Coffee Pot","icon":"dashboard","order":1},{"id":"e451e5cd.ae65a","type":"tab","label":"CP - countdown","disabled":false,"info":""},{"id":"1d877ef3.258351","type":"change","z":"e451e5cd.ae65a","name":"change to hh:ss","rules":[{"t":"set","p":"payload","pt":"msg","to":"(payload-(payload%60))/60 & \":\" & $pad($string(payload%60),-2,\"0\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":120,"wires":[["591b8a.07976c78"]]},{"id":"11532c7f.408924","type":"link in","z":"e451e5cd.ae65a","name":"timer","links":["f2c3430.c53094"],"x":115,"y":120,"wires":[["1d877ef3.258351"]]},{"id":"8b0855b4.b3c538","type":"comment","z":"e451e5cd.ae65a","name":"Displays countdown till pot turns off","info":"","x":240,"y":80,"wires":[]},{"id":"591b8a.07976c78","type":"ui_text","z":"e451e5cd.ae65a","group":"cc4e00e1.3a6d1","order":4,"width":0,"height":0,"name":"Time till shutoff","label":"","format":"{{msg.payload}}</br>poweroff","layout":"col-center","x":460,"y":120,"wires":[]},{"id":"e3f09e90.a5ab98","type":"ui_template","z":"e451e5cd.ae65a","group":"cc4e00e1.3a6d1","name":"","order":5,"width":0,"height":0,"format":"<style>\n    \n#Coffee_Pot_Coffee_Pot .nr-dashboard-text {\n    position: relative;\n    top: 10.7em !important;\n    width: 8em !important;\n    left: 5.8em !important;\n    text-align: center;\n    background-color: transparent;\n}\n</style>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":380,"y":200,"wires":[[]]},{"id":"cc4e00e1.3a6d1","type":"ui_group","z":"","name":"Coffee Pot","tab":"7cf8cd4f.6316fc","order":1,"disp":false,"width":"6","collapse":false},{"id":"7cf8cd4f.6316fc","type":"ui_tab","z":"","name":"Coffee Pot","icon":"dashboard","order":1}]
1 Like

Looks great!

One thing for others finding this thread to note, is that approximately 8% of the population are Red-Green Colourblind and they would find it hard to differentiate between an icon that switches between the two colours.
(one of the reasons that in Traffic lights the Red and Green are in different places).

Hmmm didn't know that, so what colors do you think I should use? Black for the coffee being brewed :joy:

There's a good document on the UK Gov website: https://www.gov.uk/service-manual/helping-people-to-use-your-service/understanding-wcag

Thanks, that is even way more information than I needed - excellent and a very nice project in deed ! Thanks again.