当前位置: 首页 > 软件库 > 其他开源 > 物联网 >

homebridge-telegram

授权协议 MIT License
开发语言 JavaScript
所属分类 其他开源、 物联网
软件类型 开源软件
地区 不详
投 递 者 秋和雅
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Homebridge Plugin for Telegram Bots

A platform that provides configurable Telegram Bots and integratesthem with HomeKit via Homebridge.

Status

Why a Telegram Bot?

This plugin enables you to send Telegram messages upon certain HomeKit events. The plugin providesa toggle switch for groups of notifications, which will send out one of the predefined notifications via Telegram to a configured chat. For example, youcould set up a rule to send out a message via Telegram when a window is opened. And with homebridge-automation-switches you could even repeat that process until the window is closed.

You can also add a little fun to it, by providing many different messages in a group, which the plugin selectsrandomly.

The bots are non-interactive, e.g. they do not provide commands to trigger things and willnot listen for messages sent to them.

Changelog

All changes to homebridge-telegram are documented in the changelog.

Installation instructions

After Homebridge has been installed:

sudo npm install -g homebridge-telegram

Example config.json:

{
 "bridge": {
     ...
 },
 "platforms": [
   {
     "platform": "Telegram",
     "bots": [
       {
         "name": "Bot name as seen in HomeKit",
         "token": "TELEGRAM BOT TOKEN",
         "chat": "TELEGRAM CHAT ID",
         "error": "Something broken. I'm shutting down.",
         "notifications": {
           "Hello": {
             "mode": "Markdown",
             "randomize": true,
             "messages": [
               "*Hi!*",
               "_Hello!_",
               "Hey mate!"
             ]
           },
           "Bye": {
             "mode": "HTML",
             "randomize": false,
             "messages": [
               "<b>Good bye!</b>",
               "<i>I'm sad to see you leave.</i>"
             ]
           }
         }
       }
     ]
   }
 ]
}

Simple style configuration will still work and can be mixed with the advanced configuration modes:

"Hello": [
  "Hi!",
  "Hello!",
  "Hey mate!"
]

The platform can provide any number of bots that have to be predefined in the homebridge config.json. Each bot supports the following attributes:

Attributes Usage
name A unique name for the bot. Will be used as the accessory name.
token The Telegram Bot API token provided when you registered the bot.
chat The chat ID used to send the notification to.
error The message to send if something fails. If you do not want an error message visible in Telegram, keep this undefined.
notifications An object providing notifications in named groups.

A switch is created for each notification group.

Configuring notification groups

Notification groups have additional configuration options if the new style configuration is used:

Attributes Usage
mode Specify the format of the notifications. Do not specify this for plain text notifications. Use Markdown for markdown notifications and HTML for HTML notifications.
randomize If true, will select a message randomly. The default value is true. If you do not want random messages, select false.
messages An array of messages to use for the button.

Creating a bot

The folks at Telegram created better documentation, than I could ever do.

Once you've created the bot you'll need to find a chat ID that this plugin should send messages to. The easiestway is to message the bot and look for the JSON dumps in the homebridge log. This also supports group chats.

Formatting Options

Please read the formatting options in the Telegram Bot API forthe supported HTML and Markdown formatting options.

Accessory Services

Each bot will expose two services:

  • Accessory Information Service
  • Bot Service

BotService Characteristics

The exposed switch service supports the following characteristics:

Characteristic UUID Permissions Type Usage
Quiet 9799244D-7E74-471F-B672-C41C262F7337 READ, WRITE BOOL Stops the bot from sending messages, while this is enabled.

See HomeKitTypes.js for details.

Supported clients

This platform and the bots it drives have been verified to work with the following apps on iOS 11

  • Elgato Eve

Some asks for friendly gestures

If you use this and like it - please leave a note by staring this package here or on GitHub.

If you use it and have aproblem, file an issue at GitHub - I'll tryto help.

If you tried this, but don't like it: tell me about it in an issue too. I'll try my bestto address these in my spare time.

If you fork this, go ahead - I'll accept pull requests for enhancements.

License

MIT License

Copyright (c) 2017 Michael Fröhlich

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

 相关资料
  • Homebridge 是一个轻量级 NodeJS 服务器,它模拟 iOS HomeKit API,提供从 HomeKit 到“智能家居”设备制造商提供的各种第三方 API 的基本桥接。通过 Homebridge 的桥接,可以让 Siri 控制完全不支持 HomeKit 的设备。 此外 Homebridge 支持插件。

  • homebridge-vsx homebridge-vsx is a plugin made for homebridge,which allows switching on and off your Pioneer AV receiver. All AV receivers (VSX and SC),which work with the iControl AV5 App are support

  • homebridge-sesame Control and monitor your Sesame smart lock with HomeKit integration. Prerequisites Installation of Homebridge iOS 11 or later Sesame lock with enabled cloud integration Sesame Wifi A

  • homebridge-panasonictv A homebridge plugin for turning on and off your Panasonic Viera TV. The plugin also has experimental support for changing the volume and channel. These characteristics are not r

  • Quick Start | Contribute A Wake on Lan plugin for Homebridge Turn your PCs, laptops, servers and more on and off through Siri Quick Start To install the plugin, head over to the machine with Homebridg

  • Docker Homebridge This Alpine/Ubuntu Linux based Docker image allows you to run Nfarina's Homebridge on your home network which emulates the iOS HomeKit API. This is a multi-arch image and will also r