- LightBlue Bean
- Windows or OS X computer with Bluetooth LE
For setting up a Telegram Bot you need a account. After that, you need to start and write
/newbot to @BotFather and follow the steps to create your bot.
Node-RED is a visual programming interface for the Internet of things. If you haven’t used Node-RED with the LightBlue Bean before, you need to set it up before following this tutorial. Here is Node-Red website: http://nodered.org
- /setcolor: Uses the Telegram Bot API to receive setcolor command from the bot.
- /help: Uses the Telegram Bot API to receive help command from the bot.
- confirmation message: When you send
setcolorcommand, it sends a reply and makes a custom keyboard.
- create response: Make a response with the color you pick.
- setcolor: Send the color in RGB to Bean.
- help: Make a response for help command.
- Telegram Sender: Uses the Telegram Bot API to send responses.
- Bean LED: Sets the Bean’s LED to the given RGB value.
Copy the JSON data below to your clipboard.
Open your terminal. Navigate to your Node-RED folder and type node red.
Go to http://localhost:1880 in your browser. Click the menu in the top right corner and choose import > clipboard.
Double click the Bean LED node and click on the pen to edit the Bean settings. Update the name to be the name of your Bean. It is important you write the exact name as it’s the only way for Node-RED to find and connect to the correct Bean.
Double click in one Telegram node, choose “add new telegram bot ” and click on the pen to edit the Telegram settings to connect to the Telegram Bot API. You need to configure all Telegram's nodes with this bot.
- Bot-Name: is the name of your Telegram bot.
- Token: is the token you get from BotFather when you create your bot.
- Users: list of allowed users (without )
- ChatIds: For getting this, you can connect a node telegram to two debug nodes:
Then, send a message to the bot and in one output you get the chatId (without ).
Click deploy in the top right corner and you’re done!