@tehmilcho did you install telepot?
sudo pip install telepot
Also interesting to know if the script runs from commandline?
Use Telegram for notifications
@tehmilcho did you install telepot?
sudo pip install telepot
Also interesting to know if the script runs from commandline?
@Stokstaart said in Use Telegram for notifications:
@tehmilcho did you install telepot?
sudo pip install telepot
Also interesting to know if the script runs from commandline?
oh i found the Problem from a frist test there wars a “telepot.pyc” in my folder “/home/pi” so he used this … i deleted now and now it works…
@tehmilcho Good to hear you got it working!
@Stokstaart :
Just as a remark: This is about the telegram bot system/api using the python telepot program on your system.
It does not require telegram itself at all on your raspberry pi. Of course you need telegram on your phone, pc or as webclient to inform all subscribed users.
Maybe it is good to mention this in the first topic as that starts with "For my system I use Telegram messenger for notifications."
Actually that is not correct. You use it to receive messages and you use a bot to send messages.
Another addition to your top mentioned script I made 2-3 weekends ago is the option to send a message to a variable number of users (and it will never be more than a few of course).
#!/usr/bin/python
import sys, re, telepot
message=(sys.argv)[1]
#print message
bot=telepot.Bot('MYBOT-ID')
for arg in sys.argv:
#print arg
if (arg == "Harry"):
# The 123456789 is my personal telegram id coupled to my mobile
bot.sendMessage(123456789,str(message))
if (arg == "Margreet"):
# The 987654321 is the personal telegram id coupled to wife's mobile
bot.sendMessage(987654321,str(message))
Of course the chat ids are fake.
The first argument is always the message. Other arguments are users. I named my script “telepot-send.py”.
I can send for example:
/usr/local/bin/telepot-send.py "Motion sensor triggered in garage" Harry Margreet
or
/usr/local/bin/telepot-send.py "Freezer too warm." Margreet
or
/usr/local/bin/telepot-send.py "Central heating espimatic seems off line." Harry
The script simply loops through the arguments. If it finds a user it sends the message to that user. If I use “harry” instead of “Harry” it will not send as linux is case-sensitive.
It is an extremely simple script which can easilby be extended with another if-statement.
Edit: What I forgot to mention, because I don’t use it, is the use of a channel as user. A channel is the telegram equivalent of a whatsapp group.
So something like:
if (arg == "MyBotChannel"):
bot.sendMessage(111111111,str(message))
Hi, you can also use MQTT Warn (not only for telegram) - https://github.com/jpmens/mqttwarn#telegram
http://jpmens.net/2014/02/17/introducing-mqttwarn-a-pluggable-mqtt-notifier/
Pimatic = Smart Home
That’s a nice one too, but not as simple as telepot. And I completely stopped using MQTT
hi,
just a litte Tipp… maybe all of you know this already but for me wars new.
If you want the send a Message like this:
Weather::
Temp: X c
Humdity x %
You can do this with the Script, you must use a “\n” in your Message.
Example:
execute "python /home/pi/YOURSCRIPT.py "Weather: \n Temp; $your_value \n Humdity: $your_value " "
Did anyone already discovered this library for the esp8266?
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !