Rule with Telegram notification sends 3 messages

Hi everybody,

I wrote a rule to send a notification to my wife and myself every morning at 7 o’clock to give us the actual outdoor temperature.

rule "Aktuelle Temperatur 7 Uhr"
Time cron "0 0 07 1/1 * ? *"
logInfo("rules", "Die aktuelle Außentemperatur beträgt "+String.format("%.2f",(HK_WEATHER1Aussen_Temperature.state as DecimalType).floatValue())+" °C")
sendTelegram("johannes","Die aktuelle Außentemperatur beträgt "+String.format("%.2f",(HK_WEATHER1Aussen_Temperature.state as DecimalType).floatValue())+" °C")
sendTelegram("luam","Die aktuelle Außentemperatur beträgt "+String.format("%.2f",(HK_WEATHER1Aussen_Temperature.state as DecimalType).floatValue())+" °C")

The problem is, that both of us receive the message three times. I have tried some thing with Thread::sleep expressions (several combinations, see uncommented lines inside the rule). The log shows the logInfo message only one time. Does somebody have an idea how to solve this?

Thank you for your help in advanced

Have a nice weekend!

There were some reports about the same problem and mostly it was resolved using another editor or trying to find some special/hidden characters in the code or duplicate files.
Which editor are you using?

Since your log entry only occurs once, it points to a potential issue with sendTelegram. Try it with a very simple message (there was older bug with extended unicode - like an umlaut) as a test.

@johannesbonn sometimes I notice similar behaviour with my washing machine sending sometimes twice the same message. But it seems to be fixed after OH has been running for a while e.g. everything is initialized. To send Telegrams to more than 1 person I created a group within Telegram that is used to send important messages. This way you just need to send them once - maybe this can be used as workaround ?


How do you send Telegram messages to a group with openhab?

If you create a group within Telegram you can join your openHAB Bot into this group. This is a Telegram functionality.


Short Info:

I created a new rule file and copy the existing rule inside the new file. Voila… Everybody receives only one Telegram message. The telegram binding seems to be a little bit picky.

Thanks for your support!

@bernd_d, Sorry for reviving this old topic but I wanted to reach out to @bernd_d regarding using groups within Telegram. I created a bot and I receive notifications from openhab but others in my household do not. I tried creating a group chat where the bot is a member but they don’t receive messages. I tried sharing the bot to them and no notifications despite entering /start. I converted the group to super group and added bot as admin and again no luck. I changed the privacy setting and nothing. I’m at wits end. Can you help?

@tdlr this sounds a bit strange…:face_with_raised_eyebrow:
So you have a Telegram openhab group configured in openhab telegram.cfg with bot chatid and token?
For example I have 2 bots, one for telegrams I receive only, one house telegram channel for general openhab communication.

Telegram.cfg looks like this:

#Bot Nachrichten

#Bernds Handy

#Telegram Group

If you have this it should work if you create a Telegram group within Telegram (name it as you like). Join the group configured in openhab (myhome) to the Telegram group as member. Add other native personal telegram IDs of your household members (phone number or ID, not openhab configured bots) to the same Telegram group.
Every member of the group should now see everything that’s posted by the openhab bot “myhome” within this Telegram group. I used a regular group, not a supergroup.

Hope this helps.
Regards, Bernd

@bernd_d, thanks for sharing your configuration. So I found the discrepancy. The instructions for Telegram Action states to get the from “result[0]” I followed the instructions and the closest match was "{“message_id”:3,“from” but this ID was for the bot. This time I continue looking at the Jason messages and I found a ““chat”:{“id”:-2277234” for the group chat. Your second bot had a negative number and that was my clue. I entered that chat ID with the token from bot and voila, I am now able to send messages to the group. Thank you very much for your help.

Who should we speak to about clarifying the instructions for the telegram action.

@tdlr - glad it works for you now!

I don’t know when this started but I’m getting now two telegram notifications for each event in a particular rule. I am using the same syntax for a different rule and I’m only getting one notification. I suspect the duplicate notifications happened after I upgraded to snapshot 2.2. How can I go about checking if there are two instances of that rule?