Project 9: Number received not satisfying the range

The number 324 is not following the range of less than 300 or more than 600.
How much time does twillio take to send the sms since its been almost 30 mins the sms got queued.!

I have tried to implement the temperature formula yet I dont think the temp variable thing is converting and doing the job.

import confy, json, time

from boltiot import Sms, Bolt

min = 300
max = 600

mybolt= Bolt(confy.api, confy.id)

sms = Sms(confy.SID, confy.token, confy.ton, confy.fromn)

while True :

   print ("Readding............")

   response= mybolt.analogRead('A0')
   data = json.loads(response)
   print("Sensor value is :" + str(data['value']))

   try:
         temp =  int(data['value'])

        sesnor = (temp*100)/ 1024
         if sensor > max or sensor < min:
             print ("MAking request to twillo")
             response = sms.send_sms("The current sensor value is"  + str(sensor))
             print ("Response received from twillo "+  str(response))
             print ("Status of sms twilo " + str(response.status) )
   except Exception as e:
          print("Error Occures")
          print(e)
   time.sleep(10)

Try to send the message again.
Twilio approximately takes 5 mins.
I have received the alert message within a minute.
Try to resend the message again.

Hi @ghoshg401,

I too faced a similar problem. I solved it by following these steps,

  1. https://www.twilio.com/console/sms/logs
    visit this link to check the SMS log of your twilio account. For me it displayed “sent” whereas it should show “delivered”.
  2. https://www.twilio.com/console/support/tickets/create
    visit this link to send a ticket( i.e message) to the customer support. They’ll contact you through email and solve your problem.

I too didn’t get the twilio sms for a long time (several hours to be more precise), but it came eventually after many many hours. (But in another project of using twilio for it’s SMS service the SMS came to me in a minute)

In the email i reveived from the customer support it said:

Possible causes:

  • There is congestion on downstream carrier networks. These types of problems should resolve themselves when downstream traffic starts to clear. Twilio does not have the ability to troubleshoot these issues. However, if you are noticing reproducible message delays on multiple phones over the course of several days, please let us know so that we can alert the affected carrier(s).

  • There are a large number of queued messages on the “From” number you are using. If the “From” number already has a large number of messages queued, additional messages you try to send are added to the queue rather than being sent immediately. Click the following for more information on Twilio’s rate limits. You can check to see if this is the issue by looking at the SMS insights to see if there were a large number of messages sent at the same time you tried to send the test message.

It looks like you are sending your messages from a single FROM number which can cause your messages to be queued if sending high volume in short time period.

So i’d suggest just wait. Even if you dont get the message in a day, then i suggest checking the to and from number in conf.py file and if your code is fine with no mistakes, then contact the customer support of twilio.

Also, here there is a spelling mistake. Here when using the temp conversion formula you have named it as “sesnor” but when comparing the value with max and min you have written it as “sensor”.

If you want to change the temperature value to celsius and you’re using the temperature conversion formula, change the max and min values to celsius values like for example, 20 for min and 30 for max.

3 Likes

Thanks for the suggestion!

@ghoshg401 The answer which @hibafatima24 has mentioned is the correct one.