# Using variables to program Eztimer error: Invalid object (msg.payload) input

**URL:** <https://discourse.nodered.org/t/using-variables-to-program-eztimer-error-invalid-object-msg-payload-input/50452>\
**Category:** General\
**Created:** [31 August 2021 15:45 UTC](https://discourse.nodered.org/t/using-variables-to-program-eztimer-error-invalid-object-msg-payload-input/50452 "2021-08-31T15:45:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smithy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smithy/32/37804_2.png) [@smithy](https://discourse.nodered.org/u/smithy)\
**Post date:** [31 August 2021 15:45 UTC](https://discourse.nodered.org/t/using-variables-to-program-eztimer-error-invalid-object-msg-payload-input/50452/1 "2021-08-31T15:45:44Z")

</div>

Trying to program Eztimer on and off time without success, I assume the problem is with the input to Eztimer not being the right type, I have tried converting object to JSON string with JSON node and also using mustache template but no success?

```auto
[{"id":"f17c9f78.e95ae","type":"change","z":"8c83fae7.330248","name":"","rules":[{"t":"set","p":"arm_start","pt":"global","to":"21:00:00","tot":"str"},{"t":"set","p":"arm_stop","pt":"global","to":"06:00:00","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":80,"wires":[["8b9193ab.d533f"]]},{"id":"32273994.938ff6","type":"inject","z":"8c83fae7.330248","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":80,"wires":[["f17c9f78.e95ae"]]},{"id":"4b03fa7.0c7eb04","type":"eztimer","z":"8c83fae7.330248","name":"","debug":false,"autoname":"","tag":"eztimer","topic":"","suspended":false,"sendEventsOnSuspend":false,"latLongSource":"manual","latLongHaZone":"zone.home","lat":"","lon":"","timerType":"1","startupMessage":true,"ontype":"9","ontimesun":"dawn","ontimetod":"17:00","onpropertytype":"msg","onproperty":"payload","onvaluetype":"str","onvalue":"on","onoffset":0,"onrandomoffset":0,"onsuppressrepeats":true,"offtype":"9","offtimesun":"dusk","offtimetod":"dusk","offduration":"00:01:00","offpropertytype":"msg","offproperty":"payload","offvaluetype":"str","offvalue":"off","offoffset":0,"offrandomoffset":0,"offsuppressrepeats":false,"resend":false,"resendInterval":"0s","mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":780,"y":100,"wires":[["7d383b03.d39b54"]]},{"id":"7d383b03.d39b54","type":"debug","z":"8c83fae7.330248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":950,"y":100,"wires":[]},{"id":"4171f412.05b42c","type":"debug","z":"8c83fae7.330248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":160,"wires":[]},{"id":"8b9193ab.d533f","type":"change","z":"8c83fae7.330248","name":"","rules":[{"t":"set","p":"ontime","pt":"msg","to":"arm_start","tot":"global"},{"t":"set","p":"offtime","pt":"msg","to":"arm_stop","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":160,"wires":[["4171f412.05b42c","4b03fa7.0c7eb04"]]}]

```

![error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bfc4abd4fa01f22f1baeabc3636c52fdaccc9046.jpeg)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 August 2021 16:09 UTC](https://discourse.nodered.org/t/using-variables-to-program-eztimer-error-invalid-object-msg-payload-input/50452/2 "2021-08-31T16:09:24Z")

</div>

According to the read me at [node-red-contrib-eztimer (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-eztimer) , the ontime and offtime should be object properties of msg.payload.  
e.g msg.payload.offtime.

---

<div class="post-metadata">

**Author:** ![smithy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smithy/32/37804_2.png) [@smithy](https://discourse.nodered.org/u/smithy)\
**Post date:** [31 August 2021 16:13 UTC](https://discourse.nodered.org/t/using-variables-to-program-eztimer-error-invalid-object-msg-payload-input/50452/3 "2021-08-31T16:13:44Z")

</div>

Hi E1cid thanks for the reply, I tried that first same error.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 October 2021 16:14 UTC](https://discourse.nodered.org/t/using-variables-to-program-eztimer-error-invalid-object-msg-payload-input/50452/4 "2021-10-30T16:14:38Z")

</div>

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