Project 11 telegram alert

hello sir, i am getting partial output that is only one single line current sensor value is displayed it isnt sending any messages to telegram channel




Try changing your threshold value in the conf.py file to something like 245, So that whenever the sensor reads value greater than 245 it’ll call the send_telegram_message function().
I’m guessing your threshold value will be same as that given in the tutorial(250) , since the temperature detected by the sensor is less than that , Its not calling the function.
Hope this helps :slight_smile: .

1 Like

i have changed the threshold value and output remains the same

Hi @bhuvankarthik180,

Please share the screenshot of the output and also send screenshot of the your threshold value.

Hi @bhuvankarthik180,

Try making the following changes (shown in Bold ):

  1. except Exception as e:

Capitalize ‘exception’ in both the function definitions i.e. in get_sensor_value_from_pin(pin) as well as in send_telegram_message(message).

  1. url = “https://api.telegram.org/” + conf.telegram_bot_id + “/sendMessage

In send_telegram_message(message) function definition, in the very first line i.e. ‘url’, correct the spelling of ‘Message’.

  1. response = requests.request(

" POST ",

url,

params=data

)

In send_telegram_message(message) function definition, write “post” in upper case.

  1. return False

In send_telegram_message(message) function definition, in the last line, capitalize ‘false’.

if sensor_value == -999:

    print("Request was unsuccessful. Skipping.")

(here) time.sleep(10)

(here) continue

In the while loop, inside the first if condition block, add indentation before the commands ‘time.sleep(10)’ and ‘continue’.

Remember, Python is case-sensitive and recognizes code blocks via indentation. So, do write the code meticulously keeping these two in mind.

Hope this helps!

1 Like


this is the conf file sceenshot
below are the corrected indentation and capitalisation then also i am getting “chat not found” i also checked [Error 404 Not Found for Telegram chat bot] (Error 404 Not Found for Telegram chat bot) but i dint any solution can anyone help me to debug this


Hi
To remove the error [Error 404 Not Found for Telegram chat bot] just change the telegram_chat_id to “@Temp_Monitor_Sys” and then run the program again.
I also had this same problem and it got rectified by removing this “t.me/

1 Like