Chart-Issue: Timestamp seems to be null

Good morning everybody,

I am currently trying to feed a line chart with the values from an iobroker device. It is either true or false. I want to display the state in the line chart so I can see if the device was turned on to a specified time or not.

So I inject with an interval every minute, read the value from the iobroker object. I receive true or false and pass it through a switch. Case true: change payload to "Number": 1, case false: "Number" 0.
These numbers get passed into the line chart. Debug node shows 1 or 0 is arriving fine. Unfortunately there is no time in the line chart. It always shows that the values are arriving at: 00:00:00

When I inject the "change" nodes and just send 1 or 0 the times get passed correctly.
Anything I can do about it?

I already created a function node and tried setting the timestamp as shown in the documentation.

{topic: "Heat ground floor", payload: 1,timestamp: timestamp }
This also shows all the values at timestamp 0.

Any hints about that?

Best regards

If you just want to add data points one at a time as you get them, then you don't need a timestamp, the chart will use the current time. Feed the values you are adding, after the node that changes then into 1 and 0, into a debug node and show us what you see. You wat msg.payload set to 1/0.

You need to change the payload to 1 or 0 not "Number": 1. If that is not the issue we will need to see the flow.json to see how you are setting the configs.

Here is a simple trick to change a true false to a number using a change node and JSONata J:. The inject randomly outputs true/false for testing.
e.g.

[{"id":"a2f10dcd.4ec86","type":"inject","z":"20bb0f7f9fab47a8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"$round($random()*1) = 1 ? true : false","payloadType":"jsonata","x":190,"y":1540,"wires":[["999ce868.891228"]]},{"id":"999ce868.891228","type":"change","z":"20bb0f7f9fab47a8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number($$.payload)","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Heat Ground Floor","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1540,"wires":[["c83b62de.34fb7","717daaf1.0e4c24"]]},{"id":"c83b62de.34fb7","type":"debug","z":"20bb0f7f9fab47a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":1520,"wires":[]},{"id":"717daaf1.0e4c24","type":"ui_chart","z":"20bb0f7f9fab47a8","name":"","group":"2d4fe667.28f8ba","order":15,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":1,"removeOlderPoints":"100","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":400,"y":1580,"wires":[[]]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Thanks for feedback guys.
I solved it with a workarround.
Now I am saving the values of the element in a global and request it from there afterwards. This means the value gets sent from a change node and not from an iobroker-node. I guess thats where the error comes from. Maybe it sends its own timestamp value or something like that.

The Debug node was empty but the payload value, which was fine. (int value 1 or 0)
However, this workarround is fine aswell.

Thanks guys!

You really would be better to get the direct simple solution working. Otherwise you will never know why it didn't work.
Show us a screenshot of what you see in the debug node. Set it to output complete message.

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