var new_data = datasources["datasource"];
if (new_data["topic"] == "mytopic/something")
{
return new_data["msg"];
}
And nothing....
If i put console.log there to identify what it returns, it works ok, it returns same "string" which works if i just statically past in the value field....
Would be nice to see that you add proper instructions...
I return same data as you used in the example, trying to push any data to be shown and it doesn't work...
Only time it works is if i copy paste values structure directly into the form...
for example, i push to mqtt server this data:
[{label: 'one', data: [[0,2],[1,3],[2,5]] }, { label: 'two', data: [[0,1.3],[1,3.5],[2,4]] }]
with key:
"something"
and i try to fetch it like this:
var new_data = datasources["datasource"]; if (new_data["topic"] == "mytopic/something") {
return new_data["msg"]; }
And nothing....
If i put console.log there to identify what it returns, it works ok, it returns same "string" which works if i just statically past in the value field....
Even this would not work:
return "[{label: 'one', data: [[0,2],[1,3],[2,5]]}]";
but this would work:
[{label: 'one', data: [[0,2],[1,3],[2,5]]}]