I think it must be simple, but I’m not succeeding.
I know how to add a variable to a string, but now I like to add the payload to a string and send this to Telegram
I tried a lot off combinations but didn’t succeed.
The last try, giving “object” as result instead of the string, was:
I assume it’s the incoming payload you want to add. On line 1 you have overwritten the incoming msg.payload
as an object, so when you use it on line 4 you’re not getting what you want. To fix it, before line 1, save off the original payload and use that instead…
var original = msg.payload;
...existing code...
msg.payload.content = 'Batterij is: ' + original;
Thanks very much for the clear answer.
I understand now what I’m doing wrong