# Time control using a switch

**URL:** <https://discourse.nodered.org/t/time-control-using-a-switch/8118>\
**Category:** General\
**Created:** [18 February 2019 19:16 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118 "2019-02-18T19:16:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lenny](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@Lenny](https://discourse.nodered.org/u/Lenny)\
**Post date:** [18 February 2019 19:16 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118/1 "2019-02-18T19:16:31Z")

</div>

hello, I'm just changing from pilight to nodered. There I have set, that at certain times z.b sockets are switched. but if an "absent" button is pressed, other schedules will apply. this is exactly what I do not get implemented in node red.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [18 February 2019 20:33 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118/2 "2019-02-18T20:33:00Z")

</div>

I’ve moved this to #general as I assume this is a problem you are having rather than core development

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [18 February 2019 20:37 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118/3 "2019-02-18T20:37:02Z")

</div>

See this thread where a switch can be switched based on another condition [How do I only pass a motion sensor change between dusk and dawn?](https://discourse.nodered.org/t/how-do-i-only-pass-a-motion-sensor-change-between-dusk-and-dawn/8067?u=ukmoose)

---

<div class="post-metadata">

**Author:** ![Lenny](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@Lenny](https://discourse.nodered.org/u/Lenny)\
**Post date:** [20 February 2019 16:13 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118/4 "2019-02-20T16:13:19Z")

</div>

I ask differently. I use schedex. with msg.payload.suspended you can set this active and not active. if I try this via a "switch", I get an error message (unsupported input). what am I doing wrong? unfortunately you're newbie ☹

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [20 February 2019 16:17 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118/5 "2019-02-20T16:17:35Z")

</div>

It would be easier to know where you are going wrong if you post your flow. Please read the following post [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506?u=ukmoose) and then post your flow

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [20 February 2019 16:50 UTC](https://discourse.nodered.org/t/time-control-using-a-switch/8118/6 "2019-02-20T16:50:58Z")

</div>

> [@Lenny](#):
>
> I use schedex. with msg.payload.suspended you can set this active and not active.

This way works:

Function

```auto
msg.payload = {};
msg.payload.suspended = true;
return msg;

```

or using a `change` node

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