Sending email when temp. crosses threshold

When I execute my python code of 'send email when temp. crosses threshold then it is showing an error
“Expecting value:Line 1 column 1 (char 0)”
Anyone please help me

Can you provide a screenshot of your code?

import email_conf
from boltiot import Email, Bolt
import json, time

minimum_limit = 300 #the minimum threshold of light value
maximum_limit = 600 #the maximum threshold of light value

mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID)
mailer = Email(email_conf.MAILGUN_API_KEY, email_conf.SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL)

while True:
print (“Reading sensor value”)
response = mybolt.analogRead(‘A0’)
data = json.loads(response)
print ("Sensor value is: " + str(data[‘value’]))
try:
sensor_value = int(data[‘value’])
if sensor_value > maximum_limit or sensor_value < minimum_limit:
print(“Making request to Mailgun to send an email”)
response = mailer.send_email(“Alert”, "The Current temperature sensor value is " +str(sensor_value))
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text[‘message’]))
except Exception as e:
print (“Error occured: Below are the details”)
print (e)
time.sleep(10)

Try running the program after removing the lines
"response = mailer.send_email(“Alert”, "The Current temperature sensor value is " +str(sensor_value))
response_text = json.loads(response.text)
print(“Response received from Mailgun is: " + str(response_text[‘message’]))”.

Change the minimum_limit to 500 and run the program. Check if you get an email about the alert.

now it is showing "Reading sensor value "but not showing any value while my wifi module is on

Ohh! it is showing sensor value but i did not get any email alert

But in this case I am not getting the above error (“Line1 column1(char0)”)

Now add "response = mailer.send_email(“Alert”, “The Current temperature sensor value is " +str(sensor_value))”.
You should receive email alerts now.

I too got the same issue. But the problem is not solved. I didn’t get a mail regarding the ALERT

@rahulsaran542,

Can you share the screenshot of your code and screenshot of the output?

Also, add a print statement after json.loads and check the response from Bolt Cloud.

response_text = json.loads(response.text)
print (response_text)

check the apikey of mailgun you may have writen it wrongly check your conf file

same issue here; still not solved.

Same issue, not able to figure it out

I think I also faced the same issue. Check your email_conf.py file.
check if you correctly typed sender_email as test@sandbox_url

Hi @mabhijit.ec17,

Please share the screenshot of your conf file and blur some part of the credentials.