# Ui-time-scheduler pre-select device from dropdown

**URL:** <https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874>\
**Category:** Dashboard\
**Created:** [17 November 2021 08:26 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874 "2021-11-17T08:26:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [17 November 2021 08:26 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/1 "2021-11-17T08:26:56Z")

</div>

Can anybody help me change ui-time-scheduler dashboard to be able to pre-select a required device ?

Similar to its enableDevice option that enables/disables the device.  
And similar to the standard dropdown dashboard widget that accepts input number from msg.payload to preselect it.

I am displaying all the values in a table that has a callback click function.

Thanks

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2021 20:22 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/2 "2021-11-17T20:22:02Z")

</div>

I am not sure this is what you mean, but here is an extract of something I have.

You will also need this file:  
(plants.txt)

```auto
{"timers":[{"starttime":1606528500000,"days":[1,1,1,1,1,1,1],"output":"0","endtime":1606529100000},{"starttime":1616723700000,"days":[0,0,1,0,1,0,1],"output":"1","endtime":1616724300000}]}

```

Nodes:  
You will have to edit the path to the file.

```auto
[{"id":"b5a97d4f.84ed58","type":"function","z":"6dd5ca4d.d1958c","name":"build message","func":"var path = global.get(\"event_paths\");\nmsg.filename = path + \"plants.txt\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":880,"y":4680,"wires":[["82e4dfc5.1ba768"]]},{"id":"82e4dfc5.1ba768","type":"file in","z":"6dd5ca4d.d1958c","name":"Plants","filename":"","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":850,"y":4730,"wires":[["46e58700.dc6b38"]]},{"id":"46e58700.dc6b38","type":"ui_time_scheduler","z":"6dd5ca4d.d1958c","group":"c0eea23d.14fd5","name":"Plants","refresh":"60","devices":["Daily","Away"],"customPayload":false,"eventMode":false,"outputs":3,"order":11,"width":"6","height":"1","x":1040,"y":4730,"wires":[["39958344.67685c"],["4e17f8ac.78c5c8","8a49b79e.e2e9d"],["4e17f8ac.78c5c8","c133b660.f9987"]]},{"id":"c0eea23d.14fd5","type":"ui_group","name":"Automatic plant watering","tab":"e92ac76d.c24e7","order":12,"disp":true,"width":"6","collapse":false},{"id":"e92ac76d.c24e7","type":"ui_tab","name":"Real_World_Control","icon":"dashboard","order":14,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [17 November 2021 20:28 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/3 "2021-11-17T20:28:48Z")

</div>

Oh. Thats not really what i mean. you are selecting different schedule time files for it right ?

I would like to do the selection of the dropdown of ui-time-scheduler (the place where it displays 'Overview') from an outside function.  
Something like msg.select = id sent to it

This is possible on the standard dropdown widget of the ui-dashboard, but i would like it to work on ui-time-scheduler as well..

any ideea how to make this happen ?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2021 22:28 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/4 "2021-11-17T22:28:28Z")

</div>

In that example, yes. But that is an **example**.

Once, loaded you can change the schedule from the drop down list.  
So rather than select `overview` select `daily` and that is what you will see.

Does that help?  
(Sorry if I am not good just now. I have a few problems at my end just now too)

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [20 November 2021 07:29 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/5 "2021-11-20T07:29:04Z")

</div>

yes. I know how to use it. I am just trying to trigger the selection of 'daily' in your case from an external button.  
I have other places that display data about each item, and it would be nice if the time scheduler widget updates all at once.

Nobody can help ?  
thanks

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [21 November 2021 07:39 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/6 "2021-11-21T07:39:06Z")

</div>

(Sorry, been busy with other stuff.)

So you want to select (in the example I posted) `daily` from an input to it?

I don't think that is possible.

The `input` to the node is a schedule.  
The `output` is determined on the schedule and what time it is _now_.

You may need to ask the person who made the node.  
Or: this isn't the node for the job you are wanting to do.

Could you elaborate a bit more on what you want to do?

No promises of an answer though. Sorry. 😉

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [21 November 2021 07:56 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/7 "2021-11-21T07:56:04Z")

</div>

exactly, the node needs a tweak to make this happen.  
I couldnt figure out how to do it yet 😉 i asked him, no reply yet

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 November 2021 04:50 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/9 "2021-11-22T04:50:06Z")

</div>

I posted something which I thought was going to work, but I realised it wouldn't. So I deleted it.

It isn't anything else. Sorry.

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [22 November 2021 06:59 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/10 "2021-11-22T06:59:15Z")

</div>

yep. there is some angular js trickery needed here

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 November 2021 23:03 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/11 "2021-11-22T23:03:38Z")

</div>

I am thinking you may do better with a different node.

`cron-plus` may do what you want easier. Not sure. Just _putting it out there_

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [25 November 2021 13:58 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/12 "2021-11-25T13:58:04Z")

</div>

I figured it out how to add this feature to the scheduler 🙂

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [6 December 2021 01:14 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/13 "2021-12-06T01:14:24Z")

</div>

Care to share? Seems I may be needing it too.

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [7 December 2021 04:19 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/14 "2021-12-07T04:19:43Z")

</div>

sure

> <https://github.com/xjustbmw/node-red-contrib-ui-time-scheduler/blob/master/time-scheduler.js>

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [7 December 2021 04:23 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/15 "2021-12-07T04:23:28Z")

</div>

Um, but.....

Where does that code _go_?

Is it a flow, or code for a `function` node?

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [7 December 2021 04:41 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/16 "2021-12-07T04:41:38Z")

</div>

change the file in .node-red/node\_modules/node-red-contrib-ui-time-scheduler and restart nodered

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [7 December 2021 04:47 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/17 "2021-12-07T04:47:43Z")

</div>

there are a couple there..... `.js` or the `.html` one?

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [7 December 2021 04:49 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/18 "2021-12-07T04:49:55Z")

</div>

js  
just the same filename i sent you

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [7 December 2021 04:50 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/19 "2021-12-07T04:50:27Z")

</div>

Sorry. Having a bad day understanding things.

---

<div class="post-metadata">

**Author:** ![xjust](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xjust/32/39096_2.png) [@xjust](https://discourse.nodered.org/u/xjust)\
**Post date:** [7 December 2021 04:51 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/20 "2021-12-07T04:51:07Z")

</div>

you then send the node msg.selectdevice=0 to it to select the first device  
or "overview" to get back to the default summary

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [7 December 2021 05:00 UTC](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874/21 "2021-12-07T05:00:35Z")

</div>

> [@xjust](#):
>
> msg.selectdevice=0

Can I use an `inject` node and is that a `0` or `O`?

I tried with  
`[{"id":"01213c2ee34b5b8c","type":"inject","z":"65c9b63cb09879a0","name":"","props":[{"p":"selectdevice","v":"0","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1440,"y":640,"wires":[["46e58700.dc6b38"]]}] `  
Doesn't work.

[Next page](https://discourse.nodered.org/t/ui-time-scheduler-pre-select-device-from-dropdown/53874.md?page=2)
