Post payload to Telegram

Hi Everyone,

Looking for some assistance please as I am a noob.

I am retrieving battery voltage data from a node called "EMONCMS IN". I am able to see the data in debug however posting to telegram I am battling to get the voltage value retrieved "27.44" as per pic.

Kindly assist

[{"id":"a18af6ac.cdf178","type":"tab","label":"Inverter","disabled":false,"info":""},{"id":"95c07f00.dc397","type":"emoncms in","z":"a18af6ac.cdf178","name":"Battery SC","emonServer":"782c6d40.0670c4","feedid":"10","x":870,"y":120,"wires":[["fb6e5141.c7348"]]},{"id":"5cc72ee2.a6c71","type":"debug","z":"a18af6ac.cdf178","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1310,"y":180,"wires":[]},{"id":"3ad6b467.659eac","type":"inject","z":"a18af6ac.cdf178","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":580,"y":240,"wires":[["95c07f00.dc397","5c06d83e.9096b8","782dcb86.77eac4","ca14e5b4.b94fb8","a5ce1ba7.25db28"]]},{"id":"5c06d83e.9096b8","type":"emoncms in","z":"a18af6ac.cdf178","name":"Line Mode","emonServer":"782c6d40.0670c4","feedid":"8","x":870,"y":180,"wires":[[]]},{"id":"782dcb86.77eac4","type":"emoncms in","z":"a18af6ac.cdf178","name":"AC In V","emonServer":"782c6d40.0670c4","feedid":"18","x":860,"y":240,"wires":[[]]},{"id":"ca14e5b4.b94fb8","type":"emoncms in","z":"a18af6ac.cdf178","name":"AC_OUT_W","emonServer":"782c6d40.0670c4","feedid":"5","x":870,"y":300,"wires":[[]]},{"id":"a5ce1ba7.25db28","type":"emoncms in","z":"a18af6ac.cdf178","name":"BATT_DISCHRG_I","emonServer":"782c6d40.0670c4","feedid":"7","x":870,"y":360,"wires":[[]]},{"id":"c9a67f2e.b4d34","type":"telegram sender","z":"a18af6ac.cdf178","name":"","bot":"","haserroroutput":false,"outputs":1,"x":1330,"y":120,"wires":[[]]},{"id":"fb6e5141.c7348","type":"function","z":"a18af6ac.cdf178","name":"Format Telegram","func":"msg.payload = {\"chatId\": \"xxxxx\", \"type\":\"message\", \"content\":\"Battery SC\"};\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1110,"y":120,"wires":[["5cc72ee2.a6c71","c9a67f2e.b4d34"]]},{"id":"782c6d40.0670c4","type":"emoncms-server","server":"http://192.168.1.250","name":""}]

admin edit - surrounded code with backticks to make it importable

change your function from this...

msg.payload = {
    "chatId": "xxxxx",
    "type": "message", 
    "content": "Battery SC"
}
return msg;

to this ...

msg.payload = {
    "chatId": -123456, // << set to chat id
    "type": "message", 
    "content": "Battery SC = " + msg.payload + "v"
}
return msg;

& try again

1 Like

Wow, thank you so much!!! that worked 100% :trophy:

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