Telegram: connection refused

Hi, everyone.

I’ve begun to use OH2 at my OrangePi with Ubuntu.
I have some items and no proplems with it, but i want to use notification via Telegram,

I’ve been created bot by instruction Telegram - Actions | openHAB, of course add Telegram action. And i can sent to my bot message over api.telegram.com use the chatid and token. Also added nessesary command in the .rules file to rule, which i need. But. When condition is met, in console appeared message:

[WARN ] [hab.action.telegram.internal.Telegram] - Transport error: {}
java.net.ConnectException: Connection refused

chatid and token in config same as i use in api.
What its may be?

Please post you telegram.cfg

#
# Read http://www.instructables.com/id/Telegram-Bots-for-beginners/
# to see how to set up bots and find your chat ids
#

bots=my_bot

my_bot.chatId=chatidhere
my_bot.token=tokenhere


# bot2.chatId=654321
# bot2.token=yyyyyyyyyyy

It looks ok
Try removing the _ and use mybot instead and then restart openHAB
Monitor the logs when it restarts for telegram log messages

i’ve renamed bot to mybot and now telegram.cfg looks like this:

#
# Read http://www.instructables.com/id/Telegram-Bots-for-beginners/
# to see how to set up bots and find your chat ids
#

bots=mybot

mybot.chatId=chatidhere
mybot.token=tokenhere


# bot2.chatId=654321
# bot2.token=yyyyyyyyyyy

after restart OH i have same message. Nothing changed.

And the logs?

and logs said me;

 [WARN ] [hab.action.telegram.internal.Telegram] - Transport error: {}

java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
at java.net.Socket.connect(Socket.java:589) ~[?:?]
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666) ~[?:?]
at sun.security.ssl.SSLSocketImpl.(SSLSocketImpl.java:471) ~[?:?]
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:153) ~[?:?]
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:82) ~[?:?]
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:127) ~[?:?]
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) ~[?:?]
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) ~[?:?]
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) ~[?:?]
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) ~[?:?]
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) ~[?:?]
at org.openhab.action.telegram.internal.Telegram.sendTelegram(Telegram.java:96) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1085) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1060) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:143) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:219) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) ~[?:?]
at org.eclipse.smarthome.model.script.runtime.internal.engine.ScriptImpl.execute(ScriptImpl.java:82) ~[?:?]
at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl.lambda$2(RuleEngineImpl.java:345) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

Double check your token
If it is a group chat, you need to add - infront. For eg. -654321

i’ve inserted token and chatid in this string:

https://api.telegram.org/bot<mytoken>/sendMessage?chat_id=<chatid>&text=testing123

w/o “<…>” from telegram.cfg and recieved message “testing123” on my phone.

Try clearing the cache

Think, i know what’s the matter.
from OrangePI trying:

orangepi@OrangePI:~$ wget -O /dev/null "https://api.telegram.org/bot<token>/sendMessage?chat_id=<chatid>&text=testing"
--2018-12-17 00:37:46--  https://api.telegram.org/bot<token>/sendMessage?chat_id=<chatid>&text=testing
Resolving api.telegram.org (api.telegram.org)... 149.154.167.220, 2001:67c:4e8:f004::9
Connecting to api.telegram.org (api.telegram.org)|149.154.167.220|:443... failed: Connection timed out.
Connecting to api.telegram.org (api.telegram.org)|2001:67c:4e8:f004::9|:443... failed: Connection timed out.

and from PC it works, because i’m using VPN (w/o VPN OpenHab community working bad). If i turn off VPN, from PC link doe not work too. Most likely, IP was bannet by Telegram :disappointed_relieved:

Daer Vladimir,

sorry,
Did you decide problem with VPN on OrangePI and Telegram?