i couldn’t get telegram message,first i am getting output as ,current sensor value:268
and then sensor value exceeded threshold
and error as :{“ok”:false,“error code”:401,“description”:“unauthorized”}
please let me know whats going wrong with my code…
@chandu
Check your conf.py file check for your bot_id and chat_id may be they have typing mistakes even i had faced the same error during execution of my code just double check your chat id that is your channel id and check if you have used@first in your chat id and check for any typing mistakes in your botid and have you used bot in starting of your bot id
Hope this information helps you.
@vaibhavshanbhag467 thank you.i checked it.and there was typing mistake .but again i am getting some other error.help me out in solving this problem:frowning_face.
i am trying this project from long time…help me if anyone get to know whats wrong with my code…
i have checked my conf.py file…chat id ,bot id,device id and api are correct.
but i donno why am i getting error.
Try writing one piece code in a single line in the virtual box.
instead of : response=requests.request(
“POST”,
url,
params=data
)
try writing as : response=requests.request( “POST” , url , params=data )
same for data and message in last para.
Try this and respond here.
its showing error for last line.time.sleep(10).i have imported time and written within while loop as shown in training.but i couldn’t find what’s going wrong.
@Xxanthis10.thank you.i will try it.but i couldn’t edit previous files,it says written permission denied whenever i try to save edited file.what should i do?
@chandu, You are getting telegram error, which is “error_code”:401, “description” : 'Unauthorized" which means your telegram bot id is wrong.
Please check you telegram bot id and try again, make sure you are importing right conf.py file with correct credentials, or you can try putting ids in same file as well.
@chandu I had the same error and I read somewhere on the forum that it could be due to a space between the “:” during the generation of the telegram bolt id.
I solved the issue by deleting and creating a new bot and using the new telegram bot id.
Hope this works.
Tc.