This should be easy

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

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


of course change the argument in $number() to the simple time seconds property.

Johannes

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)

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

[{"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.

1 Like

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

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

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

[{"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}]