Nodered - Send Sensor Status to Telegram

Hi Guys,

I am new to home assistant and NodeRed.

Currently I have having a door sensor installed,

Here is my flow. However I able to get pass to call service, but no message is send out. Able to assist me?


At the same time, how are we going to plug the binary sensor status and send through telegram?

You have to include “chatId”, which is the id of the Telegram user you want to send the message to.

Also, if you want to respond to the gate being opened, you should use a events: state or trigger: state node. From what you’ve posted it’s not clear what is triggering this flow. Or what the “Both Gate Open” service call does.

If you use one of the nodes I mentioned, subsequent nodes can access msg.data.old_state and msg.data.new_state, so a function node could then do something like:

msg.payload.content = "The gate is " + msg.data.new_state.state

However, note that these nodes (among others) set the payload to a string, and therefore your code should reset the whole of payload to an object, along the lines of:

msg.payload = {
    chatId: 12345678,
    content: "Gate is opening... Please wait a moment",
    type: "message"
}