# Show Schedex Time on Dashboard

**URL:** <https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414>\
**Category:** Dashboard\
**Created:** [25 March 2019 19:37 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414 "2019-03-25T19:37:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aufruf](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@aufruf](https://discourse.nodered.org/u/aufruf)\
**Post date:** [25 March 2019 19:37 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414/1 "2019-03-25T19:37:21Z")

</div>

Hi all,

I am trying to show the on and off time of a timer on my Dashboard similar to the little tooltip you have below the Schedex node.

My current flow can be seen below:

![13](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2f2f2b646ce4792064438001e2a081ca5c977eb0.png)

Idea was: On the basis of my configuration (e.g on: sunset) I get a true or false from Schedex at the specified time which is changed to a bool to switch lights on and off. To show the respective time I inject a recurring info string that should emit the info object from where I can show the on and off time on the Dashboard. So far so good. However, as soon as I infect the info node also the "ToBool" function triggers and puts out "false". Is there any way how I can separate between external injection and push from the node? How have you realized this?

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [25 March 2019 20:08 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414/2 "2019-03-25T20:08:55Z")

</div>

I use a `status` node to catch the status text from the `schedex` node and send it to a `ui_text` node in the dashboard. This eliminates the need for an `inject` node.

---

<div class="post-metadata">

**Author:** ![aufruf](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@aufruf](https://discourse.nodered.org/u/aufruf)\
**Post date:** [25 March 2019 20:33 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414/3 "2019-03-25T20:33:00Z")

</div>

Hm that's interesting. I tried it but didn't get it to work 🙂 Would you mind showing an example flow? Is it really just the status node (configured to selected node and there you ticked Schedex) or is there more around it?

Many thanks in advance

---

<div class="post-metadata">

**Author:** ![igrowing](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/igrowing/32/663_2.png) [@igrowing](https://discourse.nodered.org/u/igrowing)\
**Post date:** [25 March 2019 21:03 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414/4 "2019-03-25T21:03:51Z")

</div>

I used the function below to extract/parse time from Schedex:

```auto
/* Output:
on_hrs, on_mins, off_hrs, off_mins
*/
// {"on":"Wed, 20 Mar 2019 15:10:13 GMT","off":"Tue, 19 Mar 2019 21:58:12 GMT","state":"on"}
if (msg.topic != 'info') return;

var re = "\\d+:\\d+";
var on = msg.payload.on.match(re);
var off = msg.payload.off.match(re);
var all = on[0] + ':' + off[0]; // simplify further processing
var nums = all.split(':');
// Get time zone offset
var d = new Date();
var n = (-d.getTimezoneOffset())/60;
// Restore UTC hours into local hours
nums[0] = (parseInt(nums[0]) + n) % 24;
nums[2] = (parseInt(nums[2]) + n) % 24;

return [{payload:nums[0]},{payload:parseInt(nums[1])},{payload:nums[2]},{payload:parseInt(nums[3])}];

```

The idea was to add UI controls to change the Schedex settings. I gave up the idea of UI control for Schedex because if the "random offset" is true then all the settings make no sense. I.e. the idea of UI control is applicable only if offset isn't set.

---

<div class="post-metadata">

**Author:** ![aufruf](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@aufruf](https://discourse.nodered.org/u/aufruf)\
**Post date:** [25 March 2019 22:01 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414/5 "2019-03-25T22:01:32Z")

</div>

Thanks. It's strange sometimes - now got my initial flow working. The key thing was to add another switch node that checks the input type to be an object. Still would be nice without the recurring injection but can live with this for the time being 🙂

Thanks for your input.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [25 March 2019 23:06 UTC](https://discourse.nodered.org/t/show-schedex-time-on-dashboard/9414/6 "2019-03-25T23:06:55Z")

</div>

@aufruf You could try this flow:

```auto
[{"id":"a1743981.9668a","type":"status","z":"2190ec65.0a5c6c","name":"","scope":["167e4a09.e16596"],"x":460,"y":240,"wires":[["340245c2.df088a","ab8afb68.12d9a"]]},{"id":"167e4a09.e16596","type":"schedex","z":"2190ec65.0a5c6c","name":"","suspended":false,"lat":"","lon":"","ontime":"07:28","ontopic":"","onpayload":"on","onoffset":0,"onrandomoffset":0,"offtime":"goldenHour","offtopic":"","offpayload":"off","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":480,"y":180,"wires":[["f580fb61.db8dc8"]]},{"id":"340245c2.df088a","type":"ui_text","z":"2190ec65.0a5c6c","group":"409c9c1e.fbbbe4","order":0,"width":0,"height":0,"name":"","label":"Status","format":"{{status.text}}","layout":"row-spread","x":610,"y":240,"wires":[]},{"id":"7fdd6dbb.39066c","type":"inject","z":"2190ec65.0a5c6c","name":"","topic":"","payload":"info","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":180,"wires":[["167e4a09.e16596"]]},{"id":"fc9c6bcc.2d71e8","type":"inject","z":"2190ec65.0a5c6c","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":220,"wires":[["167e4a09.e16596"]]},{"id":"ab8afb68.12d9a","type":"debug","z":"2190ec65.0a5c6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":280,"wires":[]},{"id":"9245161.12389e8","type":"inject","z":"2190ec65.0a5c6c","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":260,"wires":[["167e4a09.e16596"]]},{"id":"b2fc1a5c.db82e8","type":"inject","z":"2190ec65.0a5c6c","name":"","topic":"","payload":"toggle","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":300,"wires":[["167e4a09.e16596"]]},{"id":"f580fb61.db8dc8","type":"debug","z":"2190ec65.0a5c6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":670,"y":180,"wires":[]},{"id":"32c2d5e4.803ee2","type":"inject","z":"2190ec65.0a5c6c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":140,"wires":[["8590a270.9af608"]]},{"id":"8590a270.9af608","type":"change","z":"2190ec65.0a5c6c","name":"set ontime","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"ontime\":\"sunrise\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":140,"wires":[["167e4a09.e16596"]]},{"id":"409c9c1e.fbbbe4","type":"ui_group","z":"","name":"Timer","tab":"32fae57a.692b52","disp":true,"width":"6","collapse":false},{"id":"32fae57a.692b52","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

Have you taken account of the fact that the `status` node does not send a payload, so the dashboard node has to use `msg.status.text`? It seems that `schedex` sends an incorrect status when first deployed, but if you change its state (on/off/toggle) or change its program, it starts to behave properly. I did not run into this with earlier versions (my production systems are at least a year old and run v1.1.0), so I will raise an issue on GitHub.
