# This should be easy

**URL:** <https://discourse.nodered.org/t/this-should-be-easy/31018>\
**Category:** General\
**Created:** [1 August 2020 17:50 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018 "2020-08-01T17:50:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RASelkirk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/raselkirk/32/57425_2.png) [@RASelkirk](https://discourse.nodered.org/u/RASelkirk)\
**Post date:** [1 August 2020 17:50 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/1 "2020-08-01T17:50:11Z")

</div>

I'm using a "simpletime" node after an inject (timestamp) to get a seconds reading that I want to send to a gauge. The output, no matter what, is always a string. I've tried using a change node to force it to a number, but debug always shows it as a string and gauge does not recognize strings. Like I said, this _should_ be easy but I'm stuck...

Russ

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [1 August 2020 17:58 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/2 "2020-08-01T17:58:49Z")

</div>

You should be able to cast to a number with a jsonata expression like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d16aa7cdb05c0c5e7644d12f8894448626e0c6cf.jpeg)  
of course change the argument in `$number()` to the simple time seconds property.

Johannes

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 August 2020 18:08 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/3 "2020-08-01T18:08:39Z")

</div>

> [@RASelkirk](#):
>
> The output, no matter what, is always a string

Have you looked at the full msg output of that node? I dont use it but remember seeing it recently had a bunch of stuff added to the msg object

Attach a debug node to the simpletime node and show us a screenshot of the debug output (ensure the debug node is set to show complete message & expand all properties for the screen shot)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 August 2020 18:28 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/4 "2020-08-01T18:28:28Z")

</div>

the gauge does recognise strings just fine - so what are you actually trying to do ?

```auto
[{"id":"a0401ee5.dd31e","type":"inject","z":"126218e7.066447","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"str","x":200,"y":460,"wires":[["18914ef3.940061"]]},{"id":"18914ef3.940061","type":"ui_gauge","z":"126218e7.066447","name":"","group":"13b35473.20565c","order":4,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":380,"y":460,"wires":[]},{"id":"80034693.4f3fc8","type":"inject","z":"126218e7.066447","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"str","x":210,"y":500,"wires":[["18914ef3.940061"]]},{"id":"13b35473.20565c","type":"ui_group","z":"","name":"Default","tab":"de4df751.046f08","order":3,"disp":false,"width":"6","collapse":false},{"id":"de4df751.046f08","type":"ui_tab","z":"","name":"Home","icon":"track_changes","order":1,"disabled":false,"hidden":false}]

```

PS - you might try to think of a title that mentions approximately the area or node you are struggling with so that folk can filter.

---

<div class="post-metadata">

**Author:** ![RASelkirk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/raselkirk/32/57425_2.png) [@RASelkirk](https://discourse.nodered.org/u/RASelkirk)\
**Post date:** [1 August 2020 18:29 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/5 "2020-08-01T18:29:46Z")

</div>

I found had an article similar to what Johannes posted, it's exactly what I'm trying to use. I got it working by changing "payload" to "mysecond" in the change node. Have to be perfect on programming!

Russ

---

<div class="post-metadata">

**Author:** ![RASelkirk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/raselkirk/32/57425_2.png) [@RASelkirk](https://discourse.nodered.org/u/RASelkirk)\
**Post date:** [1 August 2020 18:33 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/6 "2020-08-01T18:33:52Z")

</div>

I've got some learning to do on gauges. I have my range set 0 to 60, thinking the output from the change node in seconds would "operate" the gauge, but it just pegs to 60 all the time. If I take out the change node and send a string, it does nothing.

Russ

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 August 2020 18:36 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/7 "2020-08-01T18:36:48Z")

</div>

well we will need to see a debug from before the change node and also after in order to help further.

Here's a seconds display gauge

```auto
[{"id":"18914ef3.940061","type":"ui_gauge","z":"126218e7.066447","name":"","group":"13b35473.20565c","order":4,"width":0,"height":0,"gtype":"compass","title":"gauge","label":"secs","format":"{{value}}","min":0,"max":"60","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":470,"y":640,"wires":[]},{"id":"d115ed97.c622a","type":"range","z":"126218e7.066447","minin":"0","maxin":"59999","minout":"0","maxout":"59.9","action":"roll","round":true,"property":"payload","name":"","x":330,"y":640,"wires":[["18914ef3.940061"]]},{"id":"73b0e950.ab3bd8","type":"inject","z":"126218e7.066447","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":640,"wires":[["d115ed97.c622a"]]},{"id":"13b35473.20565c","type":"ui_group","z":"","name":"Default","tab":"de4df751.046f08","order":3,"disp":false,"width":"6","collapse":false},{"id":"de4df751.046f08","type":"ui_tab","z":"","name":"Home","icon":"track_changes","order":1,"disabled":false,"hidden":false}]

```

---

<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 September 2020 18:37 UTC](https://discourse.nodered.org/t/this-should-be-easy/31018/8 "2020-09-30T18:37:00Z")

</div>

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