Can somebody let me know the error please i couldnt understand the error
Plz somebody let me know the error i had written code correctly without error
Can somebody let me know the error please i couldnt understand the error
Plz somebody let me know the error i had written code correctly without error
@yashdadi872 you must have encountered a syntactical error while printing the statement in Line 58. In your code you can see that you have written after " the current value is" and the sign $ also tells that the line is not ending here, so you might have written something wring at the end. You have also used â/â in that print statement which is not necessary. You must have copied the code directly from the training content. There the / was just an intimation that the line is in continuity.
So, I suggest you to write two statements so that you can see the syntax of both. Write in this following manner:
print("Alert! Sensor value has exceeded " + str(conf.threshold))
print(âThe current value isâ + str(temp))
This will solve your problem
but here i should not print it rgtâŚinstead i need to store it in message na
Okay. I missed that thing.
part1 = "Alert! Sensor value has exceeded " + str(conf.threshold)
part 2 = â The current value isâ + str(temp)
Then in the next statement, concat the 02 strings and pass them in the send_tel_msg() in this manner:
telegram_status = send_tel_msg(part1,part2)
Okay then just remove the / in your message string.
The message string should look like this:
message = "Alert! Sensor value has exceeded " + str(conf.threshold) + â. The current value isâ + str(temp)
Okay. This error is due to the incorrect telegram credentials. Re check those
i checked it they r rgt but i have a doubt
can u tell me clearly that what comes under telegram chat id and what comes under telegram bot id
like if my bot username is for eg: âab_botââŚthen my bot id shud be âbotabt_botâ right
and if my telegram channel name is âabc defâ then its id shud be â@abc defâ is that crct
In the conf file, you should have the following parameters:
bolt_api_key = âXXXXXâ
device_id = âBOLTXXXXXâ
telegram_chat_id = â@XXXâ
telegram_bot_id = âbotXXXâ
threshold = 250
The telegram_bot id is generally the string having bot keyword and then the token id of the bot
telegram_chat_id can be in the channel info:
In this case, telegram_chat_id is @temperature_alert
yeah got it bro but now its error 401âŚ
@yashdadi872 just replace the line 58 with this:
message = "Alert! Sensor value has exceeded " + str(conf.threshold) + â. The current value isâ + str(temp)
You have unnecessarily used a back slash there
Brother as after correcting the statement you are not getting the previous error. It means that the problem is solved.
Now you are getting 404 error which implies you have some error in the telegram credentials.
Do share the ss of conf file and just hide the api key and device id
The HTTP 401 Unauthorized client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource.
I can only tell you to confirm the Token because authentication is not able to be formed.
The telegram chat id is presented in the link after t.me/
The chat id is @verstaile_bolt
@yashdadi872 in the config file use the double quotes for every variable string. This might solve the problem
no bro not yet solved