-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telegram message notification support #8619
Comments
That would be Awesome! |
https://github.com/ArduinoHannover/Pushover |
Duplicated #1456 |
Been working on this yesterday but failed to get a https connection to api.telegram.org All mentionend libraries fail in this case as is also reported by their different issues. Tried a very basic approach using all SSL provided libraries but still fail to make a connection. If anyone manages to make a https connection using the current core version I'll be interessted to dig in it again. |
Theo, I know very well the SSL part. I can try. |
This is the driver code currently not using any library other than the available BearSSL. |
You'll need this too |
And define USE_TELEGRAM in user_config_overrid.h |
I am excited to see the result. Even we can send special format messages to Tasmota to enable or disable functions or rules over internet without the need for an IOT account. Also we can collect some sensor values periodically with another Telegram bot and setup our own IOT dashboard for free. |
@ademirci well a plain XMPP/Jabber client would be enougth to reach public or private XMPP/Jabber chat server. And, furthermore, the desired function could be performed by the MQTT servers instead of overloading the client. |
Telegram api is HTTP not XMPP which makes it far easier to integrate in Tasmota. What do you mean by "open federal platform"? |
@s-hadinger wrote:
Anyone can run a server and you do not need to have an account on the same server where the chat partner has one. Classic examples are Email and XMPP/Jabber, but also Mastodon. |
At first glance, This is all good news, apart from adding the CA in Flash, it should run smoothly. Stay tuned. If you're curious about this, try |
Just did. Nice find! |
And here is the CA ready to be munched by BearSSL (added at the end of
The downside is that the certificate is valid until May 2022, so we will need to update regularly. |
I will not be available this afternoon to test the whole, but here is how it should work:
Then pass Edit: it would be interesting to print If connection failed, |
Thx I'll give it a try today |
Oh I forgot, you need to set |
I'm trying now, actually here is the CA:
|
I'm progressing. Call is done, I'm now getting error 296 which is I will continue tomorrow. The current code is here: https://github.com/s-hadinger/Tasmota/tree/telegram_dev |
I got a first version working by disabling CA validation, otherwise it seems to hang. First good news is TLS was indeed connected, second good news is that Telegram supports MFLN so we can keep 1KB buffers. Bad news is it crashed in the destructor of HTTPClient, but I know why. Fun fact: after doing lots of tests by IP address got black-listed. I needed to switch to mobile.
|
Crash fixed. It seems to connect correctly, since I get a 404 error because of a fake bot token. Theo, the code shouldn't retry automatically when there is an error, because it ends up hammering the api endpoint and makes the ip address black-listed. Log is very verbose for now. You need for now to |
Progressing. Connection works well and I need to clean up code. However the current logic reconnects every second, which is problematic: the actual SSL connection takes around 1 second and freezes the entire Tasmota. Is long polling possible? Or should me relax the frequency? Also send does not seem to work (yet).
|
Hi have a dilemma, for TLS server validation:
I propose to implement both 1 and 2, it will depend on |
Done. The TLS is fully working, both with CA validation or Fingerprint validation. If the fingerprint is wrong, the new one is shown in logs. @arendst You can now work on the fun part :) All needed changes are in this branch: https://github.com/s-hadinger/Tasmota/tree/telegram_dev |
Thx for the basics. Will see tomorrow. |
You may check the status of your bot via typing the api commands You should receive this on your browser if you have no queued/unread messages: For more details: https://core.telegram.org/bots/api |
Hello, I have some questions. |
First of all a big thank you to everyone contributing to this feature, I have been really looking forward to this and have been testing a lot with The use case I have in mind is regarding my washing machine. I would like to monitor the power consumption and once it is done send a telegram message. Within the the message it would be great to include some status information such as required ,time consumed energy etc. Is it possible to achieve something like this using |
Big Thanks also from me for this nice feature. This helps to let Tasmota device run as standalone devices. There are so many use cases for this where you just need a state update instantly on your device when a rule is executed. I've just tested it with a self compiled and a binary from ota page and both works perfectly. Thank you so much. Great Work |
Is there a step by step guide on how to enable Telegram on a newly flashed Tasmota deive? That would be extremely helpful. Many thanks! |
Hello, there is no documentation at all but here are stepts to get telegram running on a Tasmota device. Prerequisites: Checkout the code with git somewhere on your disk with: git checkout https://github.com/arendst/Tasmota.git Then Open VsCode and click on File -> Open Folder (Choose the Folder where Tasmota was checked out) Then compile by choosing Platform.io (The little alien picture at the bottom of the left bar) and choose a project task for your needs (Best would be to choose env:tasmota-YOUR-LANGUAGE) After the task has completed you have a Telegram enabled binary and gzipped binary in your tasmota folder under build_output/firmware. You can then use this to flash your Tasmota device manually. If your device don't have Tasmota, erase the flash and flash it with Tasmotizer. To enable Telegram you have to chat to the Botfather and get an own Telegram Bot with a token and a chatId. How you can achieve this -> here: https://www.toptal.com/python/telegram-bot-tutorial-python Then you have to navigate to your Tasmota device and type the following into your console: tmstate 0, tmstate 2 and tmstate 4 is for disabling the above features if everything works right then you are able to use the command Example tmtoken sofdih98we:099we000weß0we8ru09uew08zrehfjc I Hope this helps also others to get their devices into telgram. Again Thanks Theo for this great feature - feel to take all or parts of this little tutorial for your documentation ;) |
Wow, thank you so much for the detailed information! |
I'v seen that my quoted variables were not visible to you - so I've updated the post. Please reread it and if you have any further questions -> just ask. |
Hi to All! |
hi, just tested again and the problem for me is always the same... i can "tmsend something" from tasmota to the bot, but getting something back is rare if not unique... i send from the bot "status 2" for example, wait for 30 seconds, and i never get back anything... if i continue to write "status 2" repeatdly and i get the correct timing when the console is doing "checking connection", i randomly succeed to get the answer... but it's RARE... |
Hi, that could be an issue because the polling interval Tasmota polls the Telegram service defaults to 10 seconds and cannot be less than 10 secs. So I guess you have to wait for an answer almost 10 seconds. But you can check if everything is configured the right way by typing the following commands: tmtoken tmchatid tmstate |
@scheilch yup, all configured good, just checked your commands... if you scroll you'll see these are issues i had already, i know about that polling time, as said i waited even 30 seconds, but getting something back is rare... i'll go for nodered without using these, it's easier and VERY fast... |
Is it possible to completely disable the ssl checking for this and if so how, I need to be able to pass this through a MITM proxy and the cert changes often, I understand the risks of no validation? |
That's probably doable. But I'm reluctant to add it in the mainstream version. Can't you have a more stable proxy certificate? |
Proxy certificate is out of my control on this one sadly.I believe MQTT tls already supports the disabling the check maybe we could have the same thing here?MqttFingerprint2 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
|
Shall I open a new issue regarding the certificate check disable option as this one has been closed? |
Yes please. As a feature request. It will be easier to track |
Universal Arduino Telegram Bot library has been updated by including a certificate to connect to https://..telegram... |
The issue is closed but what is the actual status of implementation? I can't find it in the docs. |
Driver source code does have a bit of docs at the start |
I created an issue to track the docs status: |
Have you looked for this feature in other issues and in the docs?
Thank you for this great software. Yes, I searched in the repsitory and can not see related result.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
No, it is not a problem
Describe the solution you'd like
A clear and concise description of what you want to happen.
I want to send a notification as Telegram message so that I can recieve to my phone anywhere.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
There are IOT MQTT alternatives for notification but they are not straightforward.
Additional context
Add any other context or screenshots about the feature request here.
I noticed following arduino library in the github and maybe it is easy to integrate it to Tasmota
https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: