Yeah, sorry for that mistake with the payload.
Sorry, you lost me.
Each 30 minutes the main loop
starts things happening.
If the value given is less than 25 the A/C is turned on.
Then every minute there after the lower inject
node queries the value.
If it goes above the upper value the A/C is turned off.
The A/C can't be turned on again until the next 30 minute pulse occurs.
This is a slightly modified flow.
Again only to show the workings. Not the actual code.
[{"id":"560fe789e6b0be00","type":"inject","z":"d188b95f33e5f7e4","name":"Main loop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":3090,"y":2190,"wires":[["26a33d410f93272e"]]},{"id":"26a33d410f93272e","type":"function","z":"d188b95f33e5f7e4","name":"Get cost now (24)","func":"msg.payload = 24;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3380,"y":2190,"wires":[["274e9fa836c68313"]]},{"id":"274e9fa836c68313","type":"switch","z":"d188b95f33e5f7e4","name":"< flow.Max?","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"max","vt":"flow"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":3590,"y":2190,"wires":[["540f39dae242d597","4c0856898ceee7f3"],["dc9c3240aef09629"]]},{"id":"f62079db69bb13a0","type":"inject","z":"d188b95f33e5f7e4","name":"Setup","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":3130,"y":2110,"wires":[["6986c3abe5835262"]]},{"id":"6986c3abe5835262","type":"change","z":"d188b95f33e5f7e4","name":"Variables","rules":[{"t":"set","p":"max","pt":"flow","to":"25","tot":"num"},{"t":"set","p":"upper","pt":"flow","to":"28","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":3310,"y":2110,"wires":[[]]},{"id":"540f39dae242d597","type":"function","z":"d188b95f33e5f7e4","name":"Turn on A/C","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3770,"y":2160,"wires":[[]]},{"id":"a9b623bf366d61ad","type":"function","z":"d188b95f33e5f7e4","name":"Get cost now (30)","func":"msg.payload = 30;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3380,"y":2260,"wires":[["513c99275003ffa1"]]},{"id":"513c99275003ffa1","type":"switch","z":"d188b95f33e5f7e4","name":"> flow.upper?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"upper","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":3600,"y":2260,"wires":[["dc9c3240aef09629","b91bc170c21d504a"]]},{"id":"dc9c3240aef09629","type":"function","z":"d188b95f33e5f7e4","name":"Turn off A/C","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3770,"y":2210,"wires":[[]]},{"id":"6e02623843e54690","type":"inject","z":"d188b95f33e5f7e4","d":true,"name":"Ongoing checks every minute","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":3150,"y":2260,"wires":[["a9b623bf366d61ad"]]},{"id":"b91bc170c21d504a","type":"function","z":"d188b95f33e5f7e4","name":"Stop the minute by minute scan for prices.","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3860,"y":2280,"wires":[["4f472e409dc91bb1"]]},{"id":"4c0856898ceee7f3","type":"function","z":"d188b95f33e5f7e4","name":"Start minute by minute scan","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3820,"y":2120,"wires":[["4f472e409dc91bb1"]]},{"id":"4f472e409dc91bb1","type":"function","z":"d188b95f33e5f7e4","name":"Minute by minute price scan timer","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3130,"y":2310,"wires":[["a9b623bf366d61ad"]]}]