andrewshilliday / garage-door-controller

Software to monitor and control garage doors via a raspberry pi
MIT License
327 stars 132 forks source link

Add telegram as an alert destination / added multi alert support #119

Closed ijaron closed 4 years ago

ijaron commented 4 years ago

Added telegram as an alert destination via telegram bot. To use, get api_token from botfather on telegram. chat_id can be found by adding rawdatabot to the chat you wish to have alerts go to if a group chat, or start a chat with rawdatabot to get your user_id which will be your chat_id for single user chat. Can also get chat_id by reguesting https://api.telegram.org/bot/getUpdates after starting a chat with your bot

Gilles94500 commented 4 years ago

I have downloaded the android telegram appli. I have created a telegram account . I have created a bot with botfather, so I have now the api_token and I have also got the chat_id.

I have amended the python code (controller.py and config.json)

To make it work, I have had to add : import urllib

Now, I get the message : “May 15 11:49:14 raspberrypi garage_controller: Sending Telegram message”

But I don’t receive any telegram msg.

Did I miss something ? (I have never used telegram messenger before)

Thanks

Gilles

From: ijaron [mailto:notifications@github.com] Sent: jeudi 14 mai 2020 23:13 To: andrewshilliday/garage-door-controller garage-door-controller@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [andrewshilliday/garage-door-controller] Add telegram as an alert destination (#119)

Added telegram as an alert destination via telegram bot. To use, get api_token from botfather on telegram. chat_id can be found by adding rawdatabot to the chat you wish to have alerts go to if a group chat, or start a chat with rawdatabot to get your user_id which will be your chat_id for single user chat. Can also get chat_id by reguesting https://api.telegram.org/bot/getUpdates after starting a chat with your bot


You can view, comment on, or merge this pull request online at:

https://github.com/andrewshilliday/garage-door-controller/pull/119

Commit Summary

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andrewshilliday/garage-door-controller/pull/119 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AEA4RAPPXWZPC4PWC7ORPR3RRRNEVANCNFSM4NBBEJNQ . https://github.com/notifications/beacon/AEA4RAKN4BD5WF76P5PXJ4LRRRNEVA5CNFSM4NBBEJN2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JG6E4OA.gif

ijaron commented 4 years ago

It is likely that you have to start a chat with your bot before it will send messages. I haven't tested it without starting a chat first. To start a chat just send your bot "/start"

Gilles94500 commented 4 years ago

You were right. It works now when I have first started the chat with “/start”.

Thanks a lot.

Regards,

Gilles

From: ijaron [mailto:notifications@github.com] Sent: vendredi 15 mai 2020 12:28 To: andrewshilliday/garage-door-controller garage-door-controller@noreply.github.com Cc: Gilles94500 gilles.sapene@laposte.net; Comment comment@noreply.github.com Subject: Re: [andrewshilliday/garage-door-controller] Add telegram as an alert destination (#119)

It is likely that you have to start a chat with your bot before it will send messages. I haven't tested it without starting a chat first. To start a chat just send your bot "/start"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andrewshilliday/garage-door-controller/pull/119#issuecomment-629159694 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AEA4RALRLME6KG55OG32AXLRRUKLXANCNFSM4NBBEJNQ . https://github.com/notifications/beacon/AEA4RAPHEFWKOKVXDI4SHSTRRUKLXA5CNFSM4NBBEJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEWADODQ.gif

andrewshilliday commented 4 years ago

Thanks for the contribution. I will merge this in now.