HOW TO SEND MULTIPLE TYPE OF TELEGRAM MESSAGES WITH ILEVIA
In this part of the guide it is explain how to set up multiple kind of messages that can be sent to the recipient. The messages can be sent as multiple selection messages (require a selection from the recipient), as image with description (send a message with an image attached) or as video message (send a video),
Multiple selection messages
The multiple selection messages allows the use to receive a messages that suggest multiple action such as: turn off certain light because no one is detected in a specific room for energy management or suggest to recharge the battery if the energy produced from the sun panel exced on the one consumed.
In this example it is explained how to set up the Telegram messages in order to suggest 3 possible energy management ways to manage the exceded energy produced by the sun panels.
In this example the sun panel will be replaced with a simple copy value logic that will copy a fake value into a info component that will simulate the energy production. Add the following components:
Set up the telegram component with your own Telegram ID. Refer to the How to get the Telegram ID part of this guide for further information about getting your telegram ID.
var consumed= getValueAsBoolean(17);
return “ok, i will ” +res;
sendTelegramRequest(“Your_telegram_id”,”You are making a lot of energy, do you want to use it for:”,”Boiler|Charge battery|Make the swimming pool warmer”,”Exceded energy”);
Basically the script will send a message to the specified Telegram ID once the value reaches the set threshold displaying the 3 possibilities set within the parameter sendTelegramRequest.
Add the Changeable value component and the Info component into the user interface.
This is the visual result within the Telegram app once the threshold is reached by the Energy meter. As you can see from the picture below, the message will display 3 possible choices that once pressed can trigger other logic setup inside the Ilevia server.
Message with image attached
This part of the guide will explain how to set up the telegram message to send an image attached once a component is triggered.
Now add the script that will link the triggering of the Doorbell with the sending of the image to the Recipient.
var doorBell= getValueAsBoolean(19);
sendTelegramImage(“Your_telegram_id”,”Someone rang the doorbell”,”Http URL or Http string of the ip camera image”);