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 .
i have changed the threshold value and output remains the same
Please share the screenshot of the output and also send screenshot of the your threshold value.
Try making the following changes (shown in Bold ):
- 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).
- 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’.
- response = requests.request(
" POST ",
In send_telegram_message(message) function definition, write “post” in upper case.
- return False
In send_telegram_message(message) function definition, in the last line, capitalize ‘false’.
if sensor_value == -999:
print("Request was unsuccessful. Skipping.")
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!
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
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/”