110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
is required for defining a working telegram bot in fhem.
+ sudo apt-get install libjson-perl
) or the correct method for the underlying platform/system.Contacts
) and also internally in the module in a hashed list to allow the usage
+ of contact ids and also full names and usernames. Contact ids are made up from only digits, user names are prefixed with a @, group names are prefixed with a #.
+ All other names will be considered as full names of contacts. Here any spaces in the name need to be replaced by underscores (_).
+ Each contact is considered a triple of contact id, full name (spaces replaced by underscores) and username or groupname prefixed by @ respectively #.
+ The three parts are separated by a colon (:).
+ define <name> TelegramBot <token>
+ define teleBot TelegramBot 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
set <name> <what> [<value>]
+ message|msg [@<peer>] <text>
set aTelegramBotDevice message @@someusername a message to be sent
set aTelegramBotDevice message @Ralf_Mustermann another message
set aTelegramBotDevice message @#justchatting Hello
set aTelegramBotDevice message @1234567 Bye
sendImage [@<peer>] <file> [<caption>]
replaceContacts <text>
reset
sendImageTo <peer> <file> [<caption>]
sendPhoto
messageTo <peer> <text>
defaultPeer <name>
defaultPeerCopy <1 (default) or 0>
cmdKeyword <keyword>
ok fhem
then a message starting with this string will be executed as fhem command
+ (see also cmdTriggerOnly).ok fhem
a message of ok fhem attr telegram room IM
+ send to the bot would execute the command attr telegram room IM
and set a device called telegram into room IM.
+ The result of the cmd is sent to the requestor and in addition (if different) always sent also as message to the defaultPeer
+ cmdSentCommands <keyword>
last cmd
a message of last cmd
+ woud lead to a reply with the list of the last sent fhem commands will be sent back.cmdFavorites <keyword>
favorites
).
+ favorite
a message of favorite
to the bot will return a list of defined favorite commands and their index number. In the same case the message favorite <n>
(with n being a number) would execute the command that is the n-th command in the favorites list. The result of the command will be returned as in other command executions.
+ Please also consider cmdRestrictedPeer for restricting access to this feature!favorites <list of commands>
cmdRestrictedPeer <peername(s)>
cmdTriggerOnly <0 or 1>
ok fhem
and cmdTriggerOnly is set, then a message of ok fhem someMacro
would execute the fhem command trigger someMacro
.
+ pollingTimeout <number>
maxFileSize <number of bytes>
+ define notify_fhem_reload notify global:INITIALIZED set <telegrambot> message fhem newly started - just now !
+
cmdSentCommands
is set to /History
. Then you can initiate the communication with the botfather, select the right bot and then with the command /setcommands
define one or more commands like
+
+ History-Show a history of the last 10 executed commands
+