Telegram notifications stopped

Subject of the issue

my telegram integration no longer works, what could be the cause?
from 15 March 2022 no more notifications arrive

Your environment

Version: 1.22.0

Steps to reproduce

run job: Check SMS

and Custom Code: my_forward_sms

import logging
import requests
import os
import re

log = logging.getLogger(__name__)

# Telegram tokens - see https://www.mariansauter.de/2018/01/send-telegram-notifications-to-your-mobile-from-python-opensesame/
#
bot_token = 'censored' 
bot_chatID = 'censored'

def forward():
    """
    Poll for sms and forward to telegram

    Once sent, delete from autopi
    """

    __salt__['ec2x.query']('AT+CMGF=1')

    args = ['AT+CMGL="ALL"']
    res = __salt__['ec2x.query']('AT+CMGL="ALL"')
    if 'data' in res:
        allmessages = parse(res['data'])
        for message in allmessages:
            log.info ("SMS: "+message['message'])
            bot_sendtext('SMS From: '+message['from']+'\nDate: '+message['date']+'\n\n'+message['message'])
            __salt__['ec2x.query']('AT+CMGD='+message['index'])
            
    return {"msg": "Forward finished"}

# parse output to an array of dictionary
#
def parse(x):
    res = []
    i = 0
    while i < len(x):
        m = re.match('\+CMGL: (\d+),\"(.+)\",\"(.+)\",(.*),\"(.+)\"', x[i])
        if m:
            res.append({'index':m.group(1),'from':m.group(3),'date':m.group(5),'message':x[i+1]})
        else:
            log.info ("SMS: No match "+x[i])
        i += 2
        
    return res

# send message to telegram
#
def bot_sendtext(bot_message):
	send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + bot_message
	requests.get(send_text)

Expected behaviour

Tell us what you expect should happen

Actual behaviour

Tell us what happens instead

Output of power.status command

If your issue is in any way related to the device shutting down or behaving in a unexpected way, please provide the output of the power.status command to help us diagnose the issue.

Run the command

power.status

in the terminal on local.autopi.io, and paste the result here.

rpi:
uptime:
users: 1
seconds: 888
since_t: 1660145067
days: 0
since_iso: ‘2022-08-10T15:24:27.744939’
time: ‘0:14’
stn:
battery:
state: discharging
voltage: 12.7
level: 100
last_trigger:
sleep: NONE
wake: NONE
trigger_config:
vl_wake: ’ >13.20V FOR 3 s’
ext_wake: ’ HIGH FOR 2000 ms’
uart_sleep: ’ 900 s’
vl_sleep: ’ <12.20V FOR 240 s’
vchg_wake: ’ +0.50V IN 2000 ms’
uart_wake: ’ 0-30000 us’
spm:
last_state:
down: sleeping
up: ‘on’
sleep_interval: 0
version: 1.1.1.0
last_trigger:
down: rpi
up: modem
port_b: ‘00000111’
port_a: ‘10100011’

Do’s & dont’s

  • Do not write your unit-id anywhere.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.