Created At

Nov 30, 2023

Last Update

Dec 01, 2023

Platforms

Yubii Home Pro, HC 3

Views

592

Download

27

Type Scene

A Lua script for the Fibaro HC3 system that automates sending messages to a Telegram chat. Ideal for smart home notifications, automated responses, or status updates.

Description

This script facilitates the sending of predefined messages to a Telegram chat, be it public or private. It leverages a Telegram bot for dispatching messages based on specific events or conditions.

Requirements

  • A set up and configured Fibaro HC3 smart home system.
  • A Telegram bot token, created as per instructions on Medium.
  • The chat ID of the target chat in Telegram. For public channels, this is the channel name. For private channels, the chat ID is found in the URL in Telegram Web (e.g., -100YYYYYYYYYY).

Script Functionality

  1. Message Management: The script contains a table with predefined messages, each identified by a unique ID.
  2. Variable Management: A function for managing global variables in Fibaro HC3, ensuring TelegramMessageId is updated or created as needed.
  3. Message Dispatch: A function to send messages to the defined Telegram chat.

Usage Instructions

  1. Replace accessToken with your personal Telegram bot token.
  2. Replace chatId with the ID of the desired Telegram chat.
  3. Execute the script e.g. by a Blockszenario to send the message based on the TelegramMessageId.

In this script:

  • The section where accessToken and chatId are defined should be replaced with your own data.
  • It is assumed that TelegramMessageId is a valid ID from the messages table.
  • The sendTelegramMessage function uses the Telegram Bot API to send the message.

Scenario can looks like:

Step by Step:

1. Create LUA Szenario like:

2. Create a Blockszenario for Trigger Event like: 

3. Use the Variable for your Text in the Script:

 

 

1 Comment,  Want to add comment please login
3621d3ec58e907bbe97c33e5aa254ab6

czy komuś udało się to uruchomić?

Load more comments
© 2024. Nice-Polska Sp. z o.o.Privacy policyTerms & ConditionsFeedback