Timer Switch on Dashboard


#1

Hi,
I am struggling to have a timer in dashboard.

How to incorporate a Timer Switch input in node-red Dashboard ?

Thanks,

MD


#2

Perhaps you can clarify exactly what you mean by 'Timer Switch'. Can you provide some more information? For example, are you trying to delay the switching off of a lamp after it has been turned on?

In the meantime, I'll take a guess at what you are trying to do... You would like to start a timer to trigger a node after a specified time. For example, you click an 'inject' node (or receive input by some other means), and that starts the timer.

If this is what you want to do, you can use the standard 'delay' node (in the function section). Connect an input (such as an inject node) to the left-hand side, and connect the output to whatever it is you want to trigger. You can edit the 'delay' node to specific a fixed time-delay, or you can feed that delay-time from the input.


#3

Not quite sure what you mean - if you mean you want a switch that will start a timer if you look at Coffee Pot Timer it might give you some ideas.


#4

I need to input the time for my blinds to open for example 12:30 . I tried to use a slide to input Hour + minute but the result is bad. See picture below.

The coffee pot is what i want to reach in a few years ( It´s amazing work ). For now i only need to add a numeric input to set time , hour +minute :slight_smile:

Time .


#5

I was not happy with my attempts to use sliders for that so now I use two dropdowns, one for hours (00 to 24) and one for mins (00 to 55 in steps of 5 minutes). Then combine those to get the time.


#6

What do mean with combine the two dropdowns ? Do you have an example ?

This is the result of my "graphic" combine . I played with the Size and layout to combine the two. Is there a better way ?

Timer_pic1


#7

One of them is hours and one is minutes so they have to be combined to give hours and minutes. You could combine them immediately using a Join node, but I keep them separate and send them to mqtt so they can be fed back round to initialise the dropdowns on restart and when I need them I combine them using a join node in key/value mode.

[{"id":"d7d4618f.93c2e8","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/1/on/hours","topic":"tydwr/boiler/schedule/1/on/hours","qos":"2","broker":"9942958a.7c51b","x":142,"y":46,"wires":[["4fc7eddf.9963a4"]]},{"id":"4fc7eddf.9963a4","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"First on time hours","label":"First On Time","group":"61520602.d9d9b8","order":3,"width":"4","height":"1","options":[{"label":"00","value":"0"},{"label":"01","value":"1"},{"label":"02","value":"2"},{"label":"03","value":"3"},{"label":"04","value":"4"},{"label":"05","value":"5"},{"label":"06","value":"6"},{"label":"07","value":"7"},{"label":"08","value":"8"},{"label":"09","value":"9"},{"label":"10","value":"10"},{"label":"11","value":"11"},{"label":"12","value":"12"},{"label":"13","value":"13"},{"label":"14","value":"14"},{"label":"15","value":"15"},{"label":"16","value":"16"},{"label":"17","value":"17"},{"label":"18","value":"18"},{"label":"19","value":"19"},{"label":"20","value":"20"},{"label":"21","value":"21"},{"label":"22","value":"22"},{"label":"23","value":"23"}],"payload":"","topic":"tydwr/boiler/schedule/1/on/hours","x":407.5,"y":47,"wires":[["3215e1f6.f69ae6"]]},{"id":"3215e1f6.f69ae6","type":"rbe","z":"bcf950f4.7c4e4","name":"","func":"rbe","gap":"","start":"","inout":"out","x":635.5,"y":242,"wires":[["cf372f63.74cd6"]]},{"id":"cf372f63.74cd6","type":"mqtt out","z":"bcf950f4.7c4e4","name":"Publish","topic":"","qos":"0","retain":"true","broker":"9942958a.7c51b","x":694,"y":351,"wires":[]},{"id":"a41d6756.d938c","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/1/on/mins","topic":"tydwr/boiler/schedule/1/on/mins","qos":"2","broker":"9942958a.7c51b","x":136,"y":101,"wires":[["a3558879.c5c8d8"]]},{"id":"a3558879.c5c8d8","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"First on time mins","label":"","group":"61520602.d9d9b8","order":3,"width":"2","height":"1","options":[{"label":"00","value":"0"},{"label":"05","value":"5"},{"label":"10","value":"10"},{"label":"15","value":"15"},{"label":"20","value":"20"},{"label":"25","value":"25"},{"label":"30","value":"30"},{"label":"35","value":"35"},{"label":"40","value":"40"},{"label":"45","value":"45"},{"label":"50","value":"50"},{"label":"55","value":"55"}],"payload":"","topic":"tydwr/boiler/schedule/1/on/mins","x":401.5,"y":102,"wires":[["3215e1f6.f69ae6"]]},{"id":"cc7e43de.dd5ef8","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/1/off/hours","topic":"tydwr/boiler/schedule/1/off/hours","qos":"2","broker":"9942958a.7c51b","x":132,"y":169,"wires":[["6620c128.84ffc8"]]},{"id":"6620c128.84ffc8","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"First off time hours","label":"First Off Time","group":"61520602.d9d9b8","order":3,"width":"4","height":"1","options":[{"label":"00","value":"0"},{"label":"01","value":"1"},{"label":"02","value":"2"},{"label":"03","value":"3"},{"label":"04","value":"4"},{"label":"05","value":"5"},{"label":"06","value":"6"},{"label":"07","value":"7"},{"label":"08","value":"8"},{"label":"09","value":"9"},{"label":"10","value":"10"},{"label":"11","value":"11"},{"label":"12","value":"12"},{"label":"13","value":"13"},{"label":"14","value":"14"},{"label":"15","value":"15"},{"label":"16","value":"16"},{"label":"17","value":"17"},{"label":"18","value":"18"},{"label":"19","value":"19"},{"label":"20","value":"20"},{"label":"21","value":"21"},{"label":"22","value":"22"},{"label":"23","value":"23"}],"payload":"","topic":"tydwr/boiler/schedule/1/off/hours","x":397.5,"y":170,"wires":[["3215e1f6.f69ae6"]]},{"id":"850f0d17.c96a08","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/1/off/mins","topic":"tydwr/boiler/schedule/1/off/mins","qos":"2","broker":"9942958a.7c51b","x":126,"y":224,"wires":[["7315450f.433d8c"]]},{"id":"7315450f.433d8c","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"First off time mins","label":"","group":"61520602.d9d9b8","order":3,"width":"2","height":"1","options":[{"label":"00","value":"0"},{"label":"05","value":"5"},{"label":"10","value":"10"},{"label":"15","value":"15"},{"label":"20","value":"20"},{"label":"25","value":"25"},{"label":"30","value":"30"},{"label":"35","value":"35"},{"label":"40","value":"40"},{"label":"45","value":"45"},{"label":"50","value":"50"},{"label":"55","value":"55"}],"payload":"","topic":"tydwr/boiler/schedule/1/off/mins","x":391.5,"y":225,"wires":[["3215e1f6.f69ae6"]]},{"id":"5af4b264.d9c98c","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/2/on/hours","topic":"tydwr/boiler/schedule/2/on/hours","qos":"2","broker":"9942958a.7c51b","x":131,"y":290,"wires":[["5d72e2cd.168084"]]},{"id":"5d72e2cd.168084","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"Second on time hours","label":"Second On Time","group":"61520602.d9d9b8","order":3,"width":"4","height":"1","options":[{"label":"00","value":"0"},{"label":"01","value":"1"},{"label":"02","value":"2"},{"label":"03","value":"3"},{"label":"04","value":"4"},{"label":"05","value":"5"},{"label":"06","value":"6"},{"label":"07","value":"7"},{"label":"08","value":"8"},{"label":"09","value":"9"},{"label":"10","value":"10"},{"label":"11","value":"11"},{"label":"12","value":"12"},{"label":"13","value":"13"},{"label":"14","value":"14"},{"label":"15","value":"15"},{"label":"16","value":"16"},{"label":"17","value":"17"},{"label":"18","value":"18"},{"label":"19","value":"19"},{"label":"20","value":"20"},{"label":"21","value":"21"},{"label":"22","value":"22"},{"label":"23","value":"23"}],"payload":"","topic":"tydwr/boiler/schedule/2/on/hours","x":406.5,"y":291,"wires":[["3215e1f6.f69ae6"]]},{"id":"13264277.40a3f6","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/2/on/mins","topic":"tydwr/boiler/schedule/2/on/mins","qos":"2","broker":"9942958a.7c51b","x":125,"y":345,"wires":[["8f97c9f7.af57d8"]]},{"id":"8f97c9f7.af57d8","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"Second on time mins","label":"","group":"61520602.d9d9b8","order":3,"width":"2","height":"1","options":[{"label":"00","value":"0"},{"label":"05","value":"5"},{"label":"10","value":"10"},{"label":"15","value":"15"},{"label":"20","value":"20"},{"label":"25","value":"25"},{"label":"30","value":"30"},{"label":"35","value":"35"},{"label":"40","value":"40"},{"label":"45","value":"45"},{"label":"50","value":"50"},{"label":"55","value":"55"}],"payload":"","topic":"tydwr/boiler/schedule/2/on/mins","x":400.5,"y":346,"wires":[["3215e1f6.f69ae6"]]},{"id":"250781cc.3bb5ae","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/2/off/hours","topic":"tydwr/boiler/schedule/2/off/hours","qos":"2","broker":"9942958a.7c51b","x":121,"y":413,"wires":[["9beea3f5.e6ae88"]]},{"id":"9beea3f5.e6ae88","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"Second off time hours","label":"Second Off Time","group":"61520602.d9d9b8","order":3,"width":"4","height":"1","options":[{"label":"00","value":"0"},{"label":"01","value":"1"},{"label":"02","value":"2"},{"label":"03","value":"3"},{"label":"04","value":"4"},{"label":"05","value":"5"},{"label":"06","value":"6"},{"label":"07","value":"7"},{"label":"08","value":"8"},{"label":"09","value":"9"},{"label":"10","value":"10"},{"label":"11","value":"11"},{"label":"12","value":"12"},{"label":"13","value":"13"},{"label":"14","value":"14"},{"label":"15","value":"15"},{"label":"16","value":"16"},{"label":"17","value":"17"},{"label":"18","value":"18"},{"label":"19","value":"19"},{"label":"20","value":"20"},{"label":"21","value":"21"},{"label":"22","value":"22"},{"label":"23","value":"23"}],"payload":"","topic":"tydwr/boiler/schedule/2/off/hours","x":396.5,"y":414,"wires":[["3215e1f6.f69ae6"]]},{"id":"3bc66bf4.cfbf3c","type":"mqtt in","z":"bcf950f4.7c4e4","name":"boiler/schedule/2/off/mins","topic":"tydwr/boiler/schedule/2/off/mins","qos":"2","broker":"9942958a.7c51b","x":115,"y":468,"wires":[["9902f9a1.e14428"]]},{"id":"9902f9a1.e14428","type":"ui_dropdown","z":"bcf950f4.7c4e4","name":"Second off time mins","label":"","group":"61520602.d9d9b8","order":3,"width":"2","height":"1","options":[{"label":"00","value":"0"},{"label":"05","value":"5"},{"label":"10","value":"10"},{"label":"15","value":"15"},{"label":"20","value":"20"},{"label":"25","value":"25"},{"label":"30","value":"30"},{"label":"35","value":"35"},{"label":"40","value":"40"},{"label":"45","value":"45"},{"label":"50","value":"50"},{"label":"55","value":"55"}],"payload":"","topic":"tydwr/boiler/schedule/2/off/mins","x":390.5,"y":469,"wires":[["3215e1f6.f69ae6"]]},{"id":"9942958a.7c51b","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"pi02","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":"","willTopic":"","willQos":"0","willRetain":null,"willPayload":""},{"id":"61520602.d9d9b8","type":"ui_group","z":"bcf950f4.7c4e4","name":"Schedule","tab":"8b52d31d.4f1e78","disp":false,"width":"6"},{"id":"8b52d31d.4f1e78","type":"ui_tab","z":"bcf950f4.7c4e4","name":"Schedule","icon":"dashboard"}]

#8

:+1: Thanks

  • So you are able to write/input form your controllers values in the dropdowns and in this way you use your controller to keep in memory what was the last value entered ? Right ?
  • Are we able to write on UI text input or only on this UI dropdowns ?
  • Is there anyothe way to keep in memory of last value entered / input after a node-red restart ?

PS: I am very new on node-red subject please be patient :slight_smile:


#9

Not sure what you mean by 'controllers'. The values are retained by MQTT so they are provided on a system restart. If you are not using MQTT you probably should be, it is invaluable for handling system state.
Each time a value is changed using one of the dropdowns it is sent to MQTT and remembered there. Also any flows that subscribe to that value will get informed any time it changes.
The commonest MQTT server to use is probably mosquitto, which is very easy to setup on a pi or on a PC.
You can find all about MQTT here:
https://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt/


#10

My controller is a PLC ( Programmable logic Controller ). And i use Modbus /TCP to pass binary information between node-red and the PLC . One day i will try MQTT.
As my PLC retains the values i will try to use it to provide values on node-red restart.

  • Are we able to write on UI text input or only on this UI dropdowns ?

Thanks.

MD


#11

I don't understand the question.


#12

My mistake. As i could not see the value below the node ( blue) so i thought the input was not working but it works either changing the value from UI or injecting it on both UI nodes

Thanks

MD