Using Telegram.org (WhatsApp alternative) with WinCC OA

Find and share HowTos to various installations / configurations!
8 posts • Page 1 of 1
agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by agruber »

You eventually remember my last entry about WhatsApp integration in WinCC OA, it can be found here:
https://portal.etm.at/index.php?option= ... 16&id=3765

The major downside to WhatsApp is that there is no Api from WhatsApp themselves. So any change must be maintained in the open source yowsup framework afterwards. This could mean days of outages after a change from WhatsApp.

Recently I came across a similar messenger from telegram.org . It has already over 100 million downloads and is available for all major desktop and mobile operating systems.

And there is a free API. Even better, they already provide an HTTP interface for so called Bot APIs which can easily be used in WinCC OA.

So for setup:
1. Get an account from telegram.org via the mobile app
2. Create a telegram Bot https://core.telegram.org/bots#3-how-do-i-create-a-bot
3. Enter the data in the script at the top in the variable restUrl
4. Import the ASCII file and start the CTRL manager with the script from the attachment here, telegram_bridge.ctl
5. Send a message once from the user to the bot, only afterwards the bot can send to the user

Usage:
See the example panel. Like in this example, send and receive messages can be done client side. Only the server does the connection to the telegram servers.

ImageImage

What is missing:
- a heartbeat from WinCC OA to the interface
- check what other features the Bot API provides, I have already found the possibility to request a button input (think of alarm ack)
- redundancy is not taken care of at the moment

Do you like it?

BR,
Andreas Gruber https://www.winccoa.com/fileadmin/image ... 170317.zip
Attachments
telegramMessaging-20170317.zip
(4.59 KiB) Downloaded 175 times
telegramMessaging.zip
(4.04 KiB) Downloaded 177 times
Screenshot_20170227_225903.jpg
oa_telegram_panel.png
RESTmessage-20161112.zip
(1.93 KiB) Downloaded 184 times
Unbenannt.jpg
Screenshot_20161112_010818.jpg

agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by agruber »

I did a small update for the telegram messaging service, see above.

Whats changed:
  • DPT changed, added some elements necessary to send return values to a client
  • renamed the DP to _telegramMessage to make it specific to this service
  • added a lib with predefined send an receive functions for Telegram, this can be extended for other REST services
  • the sending function will now return the result of the server (even on client side), dpSetAndWaitForValue() is really a great function
  • there is now an example panel
Hope you enjoy it. Feedback appreciated.

vogler
Posts:122
Joined: Thu Oct 28, 2010 8:32 am

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by vogler »

Like that idea... so, I implemented a simple Bot for my WinCC OA at home, just find the contact "WinCCOAbot" in Telegram.org....

agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by agruber »

Andreas V, thanks for the input about the long polling. I have updated the code in the top post.

Whats changed:
  • webhook and thus a connection from outside is not necessary anymore, long polling is now used by default (much easier usage)
  • DPT changed, added a DPE for the time the telegram service reports upon receiving a message
Hope you enjoy it. Feedback appreciated.

vogler
Posts:122
Joined: Thu Oct 28, 2010 8:32 am

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by vogler »

btw.: as a next step you may want to talk to WinCC OA, i did some exercise with Amazon Echo and Alexa:
YouTube
...Alexa works fine!

agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by agruber »

Argh, what I wanted to do next, ordered an Echo Dot today morning. Maybe it will save me some work.

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by kilianvp »

maybe put the telegram part on a different machine with a websocket server and emit the events over websocket from the closed wincc oa server?
this way you dont need no open ports (incomming)

Image
Attachments
scheme.png

agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Re: Using Telegram.org (WhatsApp alternative) with WinCC OA

Post by agruber »

You are right, that would be one way. Thanks.

In the meantime I have changed the implementation to support longpoll. So no port opening is necessary anymore. I forgot to change parts of the top post, will do that right now.

8 posts • Page 1 of 1