0

Feed Interruped
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feed Interruped

by lostcity on Thu Sep 20, 2018 7:59 pm

I have a feed running that sends a temperature reading from a db1820b sensor every two minutes. I have had the feed up a couple of years now and periodically it seems to stop. it will run for several days and the feed website shows no more updates. The time intervals appear to be random. I am usually able to start the feed again which will for few days. I am using a Pi Zero W
.

Thanks

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by brubell on Sun Sep 23, 2018 4:53 pm

Are you running the Adafruit IO Python Client on your Raspberry Pi Zero W? Do you know which version of the library you're using?

brubell
 
Posts: 185
Joined: Fri Jul 17, 2015 10:33 pm

Re: Feed Interruped

by lostcity on Wed Sep 26, 2018 6:59 am

According to pip list I am running 9.0.1

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by brubell on Wed Sep 26, 2018 10:15 am

The latest release is of this library is 2.0.17.
Try updating the library by running:

Code: Select all | TOGGLE FULL SIZE
sudo pip install adafruit-io --upgrade

brubell
 
Posts: 185
Joined: Fri Jul 17, 2015 10:33 pm

Re: Feed Interruped

by lostcity on Wed Sep 26, 2018 11:13 am

Thanks Brubell, will see how this works.

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by lostcity on Wed Sep 26, 2018 11:38 am

Oh well... updated pip as noted and now get this error. A new one for me.

Traceback (most recent call last):
File "Thermometer.py", line 5, in <module>
aio = Client('a352cc95b65b43fdb28bac009b505379')
TypeError: __init__() takes at least 3 arguments (2 given)

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by brubell on Wed Sep 26, 2018 2:08 pm

lostcity wrote:Oh well... updated pip as noted and now get this error. A new one for me.

Traceback (most recent call last):
File "Thermometer.py", line 5, in <module>
aio = Client('a352cc95b65b43fdb28bac009b505379')
TypeError: __init__() takes at least 3 arguments (2 given)


You're including your key only. As of the Adafruit IO API v2, Client() expects both your username and the key
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)


For a full example of this, check: https://github.com/adafruit/io-client-p ... alog_in.py

brubell
 
Posts: 185
Joined: Fri Jul 17, 2015 10:33 pm

Re: Feed Interruped

by lostcity on Wed Sep 26, 2018 2:32 pm

Ok then this is a change I was unaware of. I will update the code, thanks once again.

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by lostcity on Wed Sep 26, 2018 2:53 pm

That did not go well...... looks like I may have to start over and rebuild the program. Latest error:
19.375 {temperature readout in degrees Celsius}
Traceback (most recent call last):
File "/home/pi/Thermometer.py", line 34, in <module>
aio.send('MyGarage',read_temp())
File "/usr/local/lib/python2.7/dist-packages/Adafruit_IO/client.py", line 120, in send_data
return self.create_data(feed, Data(value=value))
File "/usr/local/lib/python2.7/dist-packages/Adafruit_IO/client.py", line 206, in create_data
return Data.from_dict(self._post(path, data._asdict()))
File "/usr/local/lib/python2.7/dist-packages/Adafruit_IO/client.py", line 103, in _post
self._handle_error(response)
File "/usr/local/lib/python2.7/dist-packages/Adafruit_IO/client.py", line 79, in _handle_error
raise RequestError(response)
Adafruit_IO.errors.RequestError: Adafruit IO request failed: 404 Not Found - not found - API documentation can be found at https://io.adafruit.com/api/docs

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by lostcity on Sun Nov 11, 2018 6:28 pm

Think I am on the way to getting this running again after rebuilding it. So far it is running.
Code: Select all | TOGGLE FULL SIZE
import glob, time
#the following are variables used by adafruit
from Adafruit_IO import *
ADAFRUIT_IO_KEY = 'a352xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ADAFRUIT_IO_USERNAME = 'lostcity'
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

 
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
 
def read_temp_raw():
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines
 
def read_temp():
    lines = read_temp_raw()
    while lines[0].strip()[-3:] != 'YES':
        time.sleep(0.2)
        lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
        temp_string = lines[1][equals_pos+2:]
        temp_c = float(temp_string) / 1000.0
        temp_f = temp_c * 9.0 / 5.0 + 32.0
        return temp_c
   
while True:
   #print("temp C=%f\ttemp F=%f" % read_temp())
   #print limited to just temp in Celsius for the aio feed
   print(read_temp())
   aio.send('MyGarage',read_temp())
   time.sleep(126)


Hopefully I can get it to run by itself and not have a terminal window open to have it execute

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by brubell on Tue Nov 13, 2018 10:40 am

lostcity wrote:Think I am on the way to getting this running again after rebuilding it.

Huzzah!

Hopefully I can get it to run by itself and not have a terminal window open to have it execute

You can run this script in the background (it won't be executing in the terminal window, it'll run in the background) by adding & to the end of the command.

Code: Select all | TOGGLE FULL SIZE
Python3 myAdafruitIOFeed.py &

brubell
 
Posts: 185
Joined: Fri Jul 17, 2015 10:33 pm

Re: Feed Interruped

by lostcity on Tue Nov 13, 2018 1:00 pm

Actually, it is up and running for the last 24 hours without my having to restart it. Found some direction on how to set it up to run on boot up via chron. So far so good. Thanks. If this fails, then I will use chron to just restart the program every 24 hrs.

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by brubell on Wed Nov 14, 2018 11:21 am

lostcity wrote:Actually, it is up and running for the last 24 hours without my having to restart it. Found some direction on how to set it up to run on boot up via chron. So far so good. Thanks. If this fails, then I will use chron to just restart the program every 24 hrs.

Perfect (I was going to suggest using chron, but didn't know if you wanted it on bootup).

brubell
 
Posts: 185
Joined: Fri Jul 17, 2015 10:33 pm

Re: Feed Interruped

by lostcity on Wed Nov 14, 2018 12:03 pm

I should probably document this as I am sure I will forget how I did it.... Maybe Github
thanks much.

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Re: Feed Interruped

by lostcity on Tue Nov 27, 2018 4:51 pm

My feed MyGarage has been running for a couple of weeks now without issue. This morning about 1am it stopped apparently according to https://io.adafruit.com/lostcity/feeds/mygarage. However feed history shows it still has "several seconds of data..." dating back to the time I composed this. Attached is a screen shot. So what now?
a. Is the issue at my router and internet feed
b. Has the pi failed in running the program
c. Is the issue with Adafruit.IO and their server
d. Where to begin tracking this down.
e, Would a logging program or script help track down the issue?

Any help would be appreciated
Capture.JPG
Capture.JPG (24.72 KiB) Viewed 44 times

lostcity
 
Posts: 28
Joined: Mon Dec 07, 2009 7:02 pm

Please be positive and constructive with your questions and comments.