Maybe my idea sounds a bit strange at first, but heres the idea. (Could be realized in Node-RED or Hassio automation, i do not care:))
The time for bread dough to rise, especially of sourdough bread, depends on the room temperature.
I would like to make an automation that runs e.g. 20 hours (which should be configurable) at 20°C room temperature.
At higher temperatures, i will take less time, at lower temperatures it takes longer.
My idea is the following.
Start a timer / counter with e.g. 20 hours
After each hour check the average temperature (or even integrate). If the temperature was 20°C, reduce the timer /counter by one hour. Otherwise reduce it by a different number depending on the temperature deviation from 20°C. The correct time is calculated by a linear equation.
When the timer is in the last hour/done → send message/notify (easist job).
I’m quite new to Node-REd, so i need some hints how to do this? Is it possible using nodes or do i need to use functions-nodes?
Yes add the average sensor to your configuration & restart HA. Wait awhile and you will see the sensor change values.
By function do you mean calculating the end time? If yes, that’s the actions performed when trigger & conditions are met. Automations have 3 parts, Trigger, Condition & Actions., not sure of your skill level. If you need more help, let me know.
I use something similar where input_number.hw_tank_timer is =16
Instead of average sensor, you can also use Node red get history node to get every single reading from the temperature sensor and do your own math.
During a span of 20 hours a spike might not be noticed in a average sensor.
If that even makes a difference?
you’ll need node-red-contrib-stoptimer-varidelay. Here you have a sensor with the remaining hours for your bread. The sensors drops by one every hour and it’s safe against restarts/deploys. From this sensor you can do the rest.
You can do that by calculating every hour the deviation and sending a msg.delay to the varidelay node, the sensors changes its state every hour. It’ll be done when the sensors reaches 0.
I think you need to calculate the minimum amount of time that it would take for the bread to rise and start there. Let’s say 18 hours is the fastest rise.
This flow will wait 18 hours, then take an average of the temp for that same period. From that adv temp either start a new timer or notify.
[{"id":"854589d4864e1971","type":"inject","z":"f80b6c338afd5483","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":3640,"wires":[["5c48051172556ae6"]]},{"id":"260c495e63ea3b17","type":"api-get-history","z":"f80b6c338afd5483","name":"","server":"","version":0,"startdate":"","enddate":"","entityid":"sensor.flue_temp_2","entityidtype":"is","useRelativeTime":true,"relativeTime":"18 hours","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":560,"y":3640,"wires":[["18e2a65cdc2a20cb"]]},{"id":"18e2a65cdc2a20cb","type":"function","z":"f80b6c338afd5483","name":"","func":"msg.payload = msg.payload.reduce((a,o) => a+Number(o.state), 0)/msg.payload.length\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":3640,"wires":[["051151e5aeed81ad"]]},{"id":"5c48051172556ae6","type":"stoptimer-varidelay","z":"f80b6c338afd5483","duration":"18","durationType":"num","units":"Hour","payloadtype":"num","payloadval":"0","name":"","reporting":"none","persist":true,"ignoretimerpass":false,"x":380,"y":3640,"wires":[["260c495e63ea3b17"],[],[]]},{"id":"051151e5aeed81ad","type":"switch","z":"f80b6c338afd5483","name":"start a new timer or notify now","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"74","vt":"num"},{"t":"btwn","v":"74","vt":"num","v2":"78","v2t":"num"},{"t":"gte","v":"78","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":950,"y":3640,"wires":[["5a34ca1ee6fd84a4"],["29ec58c5099102d8"],["2f6b8ed81bf412bc"]]},{"id":"2f6b8ed81bf412bc","type":"api-call-service","z":"f80b6c338afd5483","name":"notify","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":3660,"wires":[[]]},{"id":"5a34ca1ee6fd84a4","type":"stoptimer-varidelay","z":"f80b6c338afd5483","duration":"2","durationType":"num","units":"Hour","payloadtype":"num","payloadval":"0","name":"","reporting":"none","persist":true,"ignoretimerpass":false,"x":1250,"y":3560,"wires":[["2f6b8ed81bf412bc"],[],[]]},{"id":"29ec58c5099102d8","type":"stoptimer-varidelay","z":"f80b6c338afd5483","duration":"1","durationType":"num","units":"Hour","payloadtype":"num","payloadval":"0","name":"","reporting":"none","persist":true,"ignoretimerpass":false,"x":1250,"y":3620,"wires":[["2f6b8ed81bf412bc"],[],[]]}]