Time picker pre-fill

I'm using the input text node as time picker. The time is stored in a Domoticz user variable. The current value is sent to the text node (in the correct format) to prefill this value in the input box.
When I display the dash, it shows an empty field. When I click in the field, and then click on another input node on the same dash page, it does displays the value.
What am I doing wrong?
This is the flow:

[{"id":"621447c6.5c35d8","type":"mqtt out","z":"d4438f0d.e6d41","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"698d3ae2.89ac94","x":1030,"y":640,"wires":[]},{"id":"45b87d98.ea3d74","type":"function","z":"d4438f0d.e6d41","name":"convert for 46","func":"msg.payload = {\"command\":\"setuservariable\",\"idx\":46,\"value\":((msg.payload/60000).toString())};\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":640,"wires":[["621447c6.5c35d8"]]},{"id":"b443d4fc.a45df8","type":"ui_text_input","z":"d4438f0d.e6d41","name":"starttijd achter","label":"starttijd","tooltip":"formaat hh:mm, 24 hr","group":"1e7e61e2.24feee","order":2,"width":"3","height":"1","passthru":true,"mode":"time","delay":"0","topic":"","x":660,"y":640,"wires":[["45b87d98.ea3d74"]]},{"id":"4a6a20f0.caf74","type":"function","z":"d4438f0d.e6d41","name":"select","func":"var var46 = \"\"\nvar var47 = \"\"\nvar var48 = \"\"\nvar var49 = \"\"\nvar var50 = \"\"\nvar var51 = \"\"\nvar var52 = \"\"\nvar var53 = \"\"\nvar var54 = \"\"\nmsg.payload.result.forEach(function (uservar,index) {\n    if (msg.payload.result[index].idx == \"46\") {var46 = uservar.Value*60000;}\n    if (msg.payload.result[index].idx == \"47\") {var47 = uservar.Value;}\n    if (msg.payload.result[index].idx == \"48\") {var48 = uservar.Value;}\n    if (msg.payload.result[index].idx == \"49\") {var49 = uservar.Value;}\n    if (msg.payload.result[index].idx == \"50\") {var50 = uservar.Value*60000;}\n    if (msg.payload.result[index].idx == \"51\") {var51 = uservar.Value;}\n    if (msg.payload.result[index].idx == \"52\") {var52 = uservar.Value;}\n    if (msg.payload.result[index].idx == \"53\") {var53 = uservar.Value;}\n    if (msg.payload.result[index].idx == \"54\") {var54 = uservar.Value;}\n});\nreturn[{payload:var46},\n        {payload:var47},\n        {payload:var48},\n        {payload:var49},\n        {payload:var50},\n        {payload:var51},\n        {payload:var52},\n        {payload:var53},\n        {payload:var54}];","outputs":9,"noerr":0,"x":490,"y":640,"wires":[["b443d4fc.a45df8"],[],[],[],[],[],[],[],[]]},{"id":"af38569e.7abaf8","type":"http request","z":"d4438f0d.e6d41","name":"HTTP","method":"PUT","ret":"obj","paytoqs":true,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":370,"y":640,"wires":[["4a6a20f0.caf74"]]},{"id":"e8ed3c1b.9584a","type":"function","z":"d4438f0d.e6d41","name":"Prep call","func":"var url = \"http://127.0.0.1:8080\";\nmsg.url = url + \"/json.htm?type=command&param=getuservariables\";\nreturn msg;","outputs":1,"noerr":0,"x":240,"y":640,"wires":[["af38569e.7abaf8"]]},{"id":"3b67fafa.29ff56","type":"ui_button","z":"d4438f0d.e6d41","name":"","group":"d000ac8b.ffab1","order":6,"width":0,"height":0,"passthru":false,"label":"Refresh data","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":90,"y":640,"wires":[["e8ed3c1b.9584a"]]},{"id":"698d3ae2.89ac94","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"1e7e61e2.24feee","type":"ui_group","z":"","name":"achter","tab":"bcff787c.41b6b8","order":1,"disp":true,"width":"3","collapse":false},{"id":"d000ac8b.ffab1","type":"ui_group","z":"","name":"besturing","tab":"bcff787c.41b6b8","order":3,"disp":true,"width":"3","collapse":false},{"id":"bcff787c.41b6b8","type":"ui_tab","z":"","name":"Sproeisysteem","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

to make things more readable, I removed parts of the flows that are not relevant.

What is the http request node suppose to do? As is your flow doesn't run because it gives an ECONNREFUSED

The HTTP node sends a json request to Domoticz and returns all uservariables as an array of objects.
That array is then examined and the required value is pulled. This all works OK, I used log nodes to check.
The value is fed into the time picker as prefill, but that does not always work.

Please put a debug node (set to display the complete msg object) on the output of the 'select' function node and run it. Then, in the debug sidebar, open all the objects and copy it and paste it to a reply,

Not knowing what the data is makes it hard to determine what is happening.

I can't reliably reproduce it, it happens at random, debug node shows the right value. So I added a UI control node, and trigger the refresh based on that.
Will see what happens over the next days.

OK, it happened again. I opened the page and there is no value. pushed the refresh button, and still no value. But now I captured the input to the time picker node:

75600000

Looks like a valid value.
Went back to the dash and clicked the time picker input, nothing happened. Then clicked another field on the page, and voila: value is shown!

I created a small flow that should demonstrate. It starts with an inject node to insert a value of 75600000, which is 21:00 in time notation. It also has a debug node and the time picker.
How this can be demonstrated:

  1. install and deploy.
  2. go to the dash with the demo
  3. time picker is empty. Click on the input field, nothing.
  4. go back to Node Red page, click the insert node.
  5. go back to the dash, still no value.
  6. click on the input field, nothing.
  7. click on another input field, time picker now shows 21:00
[{"id":"3783e40d.66420c","type":"debug","z":"d4438f0d.e6d41","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":560,"wires":[]},{"id":"161edb90.0bdc24","type":"inject","z":"d4438f0d.e6d41","name":"insert 75600000","topic":"","payload":"75600000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":600,"wires":[["3783e40d.66420c","ae3e380b.5e3128"]]},{"id":"ae3e380b.5e3128","type":"ui_text_input","z":"d4438f0d.e6d41","name":"starttijd achter demo","label":"starttijd demo","tooltip":"formaat hh:mm, 24 hr","group":"1e7e61e2.24feee","order":5,"width":"3","height":"1","passthru":true,"mode":"time","delay":"0","topic":"","x":440,"y":600,"wires":[[]]},{"id":"1e7e61e2.24feee","type":"ui_group","z":"","name":"achter","tab":"bcff787c.41b6b8","order":1,"disp":true,"width":"3","collapse":false},{"id":"bcff787c.41b6b8","type":"ui_tab","z":"","name":"Sproeisysteem","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

Just imported your flow.
At step 2 I see this:
Screen Shot 2020-09-23 at 5.36.14 PM
at step 3 I see this:
Screen Shot 2020-09-23 at 5.37.59 PM
at step 4 I see this:
Screen Shot 2020-09-23 at 5.38.25 PM

That's weird.
I changed the demo flow a little, so it now resides alone on a special demo page of the dash.
When I had the insert-->input flow there, it works as it should.
But I added a second input field, and now it doesn't.

Now, when I initially open the page, the time picker keeps showing "--:--", even after pressing the refresh button.
I can see in the debug node that the value is actually inserted but not displayed.
As soon as I click on the second input field, the value is now suddenly displayed!
It's hard to describe, play around with it a little.
I also noticed that once the value is there, it stays visible even after an update to the flow.
Kill the browser and restart to see the problem again.

[{"id":"cc749dc.f32d26","type":"tab","label":"Demo","disabled":false,"info":""},{"id":"cfa7ed54.416a2","type":"ui_text_input","z":"cc749dc.f32d26","name":"starttijd achter demo","label":"starttijd demo","tooltip":"formaat hh:mm, 24 hr","group":"23cd5fd3.8e88f","order":5,"width":"3","height":"1","passthru":true,"mode":"time","delay":"0","topic":"","x":500,"y":200,"wires":[[]]},{"id":"7bf4b9d7.995df8","type":"inject","z":"cc749dc.f32d26","name":"insert 75600000","topic":"","payload":"75600000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":200,"wires":[["d5c8d4c3.61ec08","cfa7ed54.416a2"]]},{"id":"d5c8d4c3.61ec08","type":"debug","z":"cc749dc.f32d26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":260,"wires":[]},{"id":"48f41260.f5c62c","type":"ui_button","z":"cc749dc.f32d26","name":"refresh","group":"23cd5fd3.8e88f","order":1,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":80,"y":140,"wires":[["687c5045.74479"]]},{"id":"687c5045.74479","type":"function","z":"cc749dc.f32d26","name":"insert 75600000","func":"msg.payload = 75600000;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":140,"wires":[["cfa7ed54.416a2","157bc124.ff2caf"]]},{"id":"157bc124.ff2caf","type":"debug","z":"cc749dc.f32d26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":140,"wires":[]},{"id":"23cd5fd3.8e88f","type":"ui_group","z":"","name":"Demo","tab":"ad94a6c5.c38548","order":1,"disp":true,"width":"3","collapse":false},{"id":"ad94a6c5.c38548","type":"ui_tab","z":"","name":"Demo","icon":"dashboard","order":7,"disabled":false,"hidden":false}]

I’ll play with it in a bit but right now I have a two week old on my chest while my daughter gets a couple hours sleep

This may be a browser issue. With the dashboard open in FireFox, Chrome and Safari, when I first open the browsers this is what I see:


when I press the 'button' this is what I see:

  • What platform is NR running on?
  • what release is NR, node.js and the dashboard (see NR startup log)
  • what browser are you using?
  • what platform are you using the browser on?

Clear case of setting priorities. Enjoy, granddad...

Not sure where to find the NR release info...
edit: I found version 1.0.3 mentioned somewhere... does this help?

It would help even more if you answered all the questions. The current version of Node-Red is v1.1.3 so you are behind a bit but I'd like to see the versions of node.js and the dashboard too. As I said, the versins show up in the node-red startup log.

24 Sep 23:05:34 - [info]
Welcome to Node-RED
===================
24 Sep 23:05:34 - [info] Node-RED version: v1.0.3
24 Sep 23:05:34 - [info] Node.js  version: v10.22.1
24 Sep 23:05:34 - [info] Linux 5.4.51-v7l+ arm LE
24 Sep 23:05:35 - [info] Loading palette nodes
24 Sep 23:05:38 - [info] Dashboard version 2.19.4 started at /ui
24 Sep 23:05:38 - [info] Settings file  : /home/pi/.node-red/settings.js
24 Sep 23:05:38 - [info] Context store  : 'default' [module=memory]
24 Sep 23:05:38 - [info] User directory : /home/pi/.node-red
24 Sep 23:05:38 - [warn] Projects disabled : editorTheme.projects.enabled=false
24 Sep 23:05:38 - [info] Flows file     : /home/pi/.node-red/flows_Utrecht.json
24 Sep 23:05:38 - [info] Server now running at http://127.0.0.1:1880/

OK, got it. I did a node-res-stop, and then node-red-start.
This is part of what came out... does this help?

I would update both no and the dashboard to see if that helps. You can update the dashboard using the palette manager in the editor.

did an apt-get update and upgrade, also upgraded all nodes in the palette. Still same result.... I am beginning to think I'll have to live with it. :unamused:

So dashboard is now 2.23.4 ? and you did a flush of your browser cache to ensure it got latest at browser end also ?

Correct, it is now on 2.23.4. And yes, I flushed the cache and tested again.

[{"id":"cc749dc.f32d26","type":"tab","label":"Demo","disabled":false,"info":""},{"id":"cfa7ed54.416a2","type":"ui_text_input","z":"cc749dc.f32d26","name":"starttijd achter demo","label":"starttijd demo","tooltip":"formaat hh:mm, 24 hr","group":"23cd5fd3.8e88f","order":5,"width":"3","height":"1","passthru":true,"mode":"time","delay":"0","topic":"","x":500,"y":200,"wires":[[]]},{"id":"7bf4b9d7.995df8","type":"inject","z":"cc749dc.f32d26","name":"insert 75600000","topic":"","payload":"75600000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":200,"wires":[["d5c8d4c3.61ec08","cfa7ed54.416a2"]]},{"id":"d5c8d4c3.61ec08","type":"debug","z":"cc749dc.f32d26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":260,"wires":[]},{"id":"48f41260.f5c62c","type":"ui_button","z":"cc749dc.f32d26","name":"refresh","group":"23cd5fd3.8e88f","order":1,"width":0,"height":0,"passthru":false,"label":"Insert 75600000","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":80,"y":140,"wires":[["687c5045.74479"]]},{"id":"687c5045.74479","type":"function","z":"cc749dc.f32d26","name":"insert 75600000","func":"msg.payload = 75600000;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":140,"wires":[["cfa7ed54.416a2","157bc124.ff2caf"]]},{"id":"157bc124.ff2caf","type":"debug","z":"cc749dc.f32d26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":140,"wires":[]},{"id":"23cd5fd3.8e88f","type":"ui_group","z":"","name":"Demo","tab":"ad94a6c5.c38548","order":1,"disp":true,"width":"3","collapse":false},{"id":"ad94a6c5.c38548","type":"ui_tab","z":"","name":"Demo","icon":"dashboard","order":8,"disabled":false,"hidden":false}]

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.