Temperature alarm with slider

Hi all!

Still learning so bare with me!

I want to create a dashboard were i can choose a countdown alarm with a slider. The slider should choose hours to activate a temperature alarm with different users getting an alarm.

There is many timers around but all seems to be for setting a specific alarm in a schedule. This is not what i wanted, and sadly i dont have the knowledge on how to code it :frowning: YET!

Does someone have an example code for a beginner so i can learn?

I was thinking something like this!

Dashboard slider for selecting input of the hours
Button for on/off
Select user1,user2 and so on

Output could bee almost anything, like email, mqtt,grafana

Have a nice day and Thanks in advanced!

Well it looks like you have an idea and have broken it down into tasks so now you should try to code each task so build a dashboard with a slider and stick a debug node on the output of what you come up with so you can see what you are getting.

Once that works, move onto the next task.

Trying something and working thru any issues is the best way to learn :grin:

Can you explain what that means please? Do you mean you want to delay the notification of the alarm until a certain number of hours has elapsed? That seems very odd.

Hi thanks for the reply!

Sorry if i was a bit unclear..

I want to be able to choose how many hours the alarm should be active and i thought a slider might be easiest?

So in that time interval i choose from the slider the alarm should be active and send alarms if a certain temp is below the threshold, and only to the user i have choosen.

And if the alarm hours runs out the alarm should be inactivated. Similar to an eggclock timer

I have seen acouple of similar scenarios on watering plants flows, but they are often very complicated to understand.

Hopefully that might be a bit more clear

Hi again!

Found a flow elsewhere that might solve this. Just need to figure out to set it to Hours instead of minutes and then build the rest of the flow.

[{"id":"ce5534a3.3f8b98","type":"function","z":"be10358d.5f3058","name":"","func":"\nvar value  = context.get('value') || 60000;\n\nif (msg.topic == \"value\")\n{\n  value = msg.payload * 60000;\n  context.set('value',value);  \n}\n\nelse if (msg.topic == \"start\")\n{\n\nvar timer = setTimeout(function(){msg.payload = \"now\";node.send([msg,{ payload: \"Ende\" }]);var countdownstop  = context.get('countdown');clearInterval(countdownstop)},value);\ncontext.set('timer',timer); \n\nvar count = value/60000;\n//count = count -1 ;\nmsg.payload=count;\nnode.send([null,msg]);\nvar countdown = setInterval(function() {count=count-1;msg.payload=count; node.send([null,msg]) }, 60000);\ncontext.set('countdown',countdown);\n\n}\n\nelse if (msg.topic == \"stop\")\n{\nvar timerstop  = context.get('timer')\nclearTimeout(timerstop);\n\nvar countdownstop  = context.get('countdown')\nclearInterval(countdownstop);\n\n}\n\n\n","outputs":"2","noerr":0,"x":410,"y":220,"wires":[["a70f86ce.c18f58"],["fa7c7eb.15f9d8"]]},{"id":"a70f86ce.c18f58","type":"debug","z":"be10358d.5f3058","name":"","active":true,"console":"false","complete":"payload","x":590,"y":180,"wires":[]},{"id":"6c4f84d8.656ebc","type":"ui_button","z":"be10358d.5f3058","name":"","group":"637d8cb3.d53d74","order":0,"width":0,"height":0,"label":"Start","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"start","x":190,"y":200,"wires":[["ce5534a3.3f8b98"]]},{"id":"1f4a748.bcd498c","type":"ui_numeric","z":"be10358d.5f3058","name":"","label":"Minuten","group":"637d8cb3.d53d74","order":0,"width":0,"height":0,"passthru":true,"topic":"value","format":"{{value}}","min":"1","max":"300","step":1,"x":180,"y":280,"wires":[["ce5534a3.3f8b98"]]},{"id":"8dba67c8.f2a418","type":"ui_button","z":"be10358d.5f3058","name":"","group":"637d8cb3.d53d74","order":0,"width":0,"height":0,"label":"Stop","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"stop","x":190,"y":240,"wires":[["ce5534a3.3f8b98"]]},{"id":"fa7c7eb.15f9d8","type":"ui_text","z":"be10358d.5f3058","group":"637d8cb3.d53d74","order":0,"width":0,"height":0,"name":"","label":"Restzeit","format":"{{msg.payload}} Minuten","layout":"row-spread","x":600,"y":240,"wires":[]},{"id":"637d8cb3.d53d74","type":"ui_group","z":"","name":"Default","tab":"7fe8c0a9.8eebd","disp":true,"width":"6"},{"id":"7fe8c0a9.8eebd","type":"ui_tab","z":"","name":"tests","icon":"dashboard"}]