Sending data to io feed but does not show

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Sending data to io feed but does not show

Post by paulskpt »

Hi, I use the following function to send data to an Adafruit IO feed:

Code: Select all

"""
    Send data to io.adadruit.com feeds
"""
def send_to_aio_feed():
    TAG="send_to_aio_feed(): "
    my_debug = my_dat.read(_debug)
    aio_username = my_dat.read(_aio_username)
    aio_key = my_dat.read(_aio_key)
    aio_feed_name = "rtc-bi-sync-data"
    resp_lst = my_dat.read(_resp_lst)
    response = None
    network = magtag.network
    msg_sent = my_dat.read(_msg_sent)
    dteData = resp_lst[0]  # pr_dt(DATE_ONLY)
    timData = resp_lst[1][:7]  # pr_dt(TIME_ONLY)
    rtcSyncedData = my_dat.read(_rtc_bi_synced)
    msg = ""
    msg_sent += 1  # increase the messages sent count
    my_dat.write(_msg_sent, msg_sent)
    if my_debug:
        print(TAG+dteData)
        print(". Sending Data message nr: ", end='')
        print(msg_sent, end='')
        print(" to Adafruit IO feed: {}".format(aio_feed_name, end='\n'))
        
    msg = "https://io.adafruit.com/<aio_username>/feeds/rtc-bi-sync-data/"
    msg += "&date=" + dteData
    msg += "&time=" + timData
    msg += "&rtcSynced=" + "1" if rtcSyncedData else "0"
    print(TAG+"going to send to aio: \"{}\"".format(msg))
    msg_nr = str(msg_sent)
    response = network.fetch(msg)  # Send the msg
    if response is not None:
        print()
        if not my_debug:
            print(TAG+"response.status_code=", response.status_code)
            # print(TAG+"reponse.text=\"{}\"".format(response.text))
        response.close()

The REPL output is:

Code: Select all

send_to_aio_feed(): going to send to aio: "https://io.adafruit.com/<aio_username>/feeds/rtc-bi-sync-data/&date=2022-08-04&time=17:01:1&rtcSynced=1"
Retrieving data...
send_to_aio_feed(): response.status_code= 200
However, when I visit the io.adafruit.com feeds page, I do not see the sent data. What do I do wrong?

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Sending data to io feed but does not show

Post by mikeysklar »

The 200 response is good "everything is okay".

Are you using the same "aio_username" as the account that you are checking via web browser? Is it possible that you have multiple accounts and are checking a different one?

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Sending data to io feed but does not show

Post by paulskpt »

Hi mikeysklar, thank you for your reply. I have only one account.

User avatar
DJDevon3
 
Posts: 210
Joined: Wed Mar 06, 2019 11:02 am

Re: Sending data to io feed but does not show

Post by DJDevon3 »

is the use of <aio_username> literal or forum obfuscation? You make no explicit reference in your first post, although it might be implied and implicit it's best to be explicit with obfuscations such as <username_obfuscated>. Because if it's not explicit in this case well, that could be the cause of your issue.

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Sending data to io feed but does not show

Post by paulskpt »

@DJDevon3 The values for aio_username and aio_key are stored in the file secrets.py. They are strings. In the script these are read into variables.
So no obfuscation used. However, in the REPL output example above, I replaced the real values by obfuscations.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Sending data to io feed but does not show

Post by mikeysklar »

Check the AIO monitor page for clues:

https://io.adafruit.com/monitor

If there are no clues let's get into the details of your hardware setup and just confirm you libraries / firmware are up to date.

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Sending data to io feed but does not show

Post by paulskpt »

Here an edited screenshot of the Monitor page:

Image


Device info on AIO:

Image

In 2021 I used the service of a 'man-in-the-middle' called 'PushingBox.com'. That worked OK The data from AIO - via PushingBox was pushed into the Google sheets spreadsheet,
using a Google Apps Script macro. Since the created 'scenario' recently stopped to work (it reports on the webpage that the action has been executed) but the Google Apps Script macro obviously didn't receive the data. I asked customer service for help, but I didn't receive response (via Twitter), Reason for me to cancel my subscribtion and stop monthly payments to Patreon.

Between 5 and 7 August I tried the service of IFTTT. To my experience: unreliable. So I quickly cancelled my account. Next I tried the free trial of Zapier. This works, but they put you automatically into forteen days of unlimited options. That is nice but I want to experience how it works with the normal 'free' tier. So, I have to wait until the free trial period is superseeded. The paid tiers of Zapier are very expensive. For the intermittent (hobby) use it is useless to go for a paid subscription with Zapier.

I am now trying a new, different approach:
The past few days I created a CPY script that runs on an Adafruit MAGTAG with CPY v8.0.0-Alpha1.
The goals of this script:
- receive AIO Time Service and set the built-in RTC.Next use time.time() to timely controlled actions -- Done - Status: working
- sync the built-in RTC hourly with datetime from AIO Time Service -- Done - Status: working.
- receive AIO feed data from the Feather Huzzah 8266 with AHT20 Temp/Hum sensor. every 15 minutes - Done - Status: working
- modifiy the received feed data for CPY (e.g.: 'null' > 'None'; 'false' > 'False'; 'true' > 'True'. -- Done - Status: working
- send the AIO feed datetime stamp 'updated_at', the feed Temperature value and the feed Humidity value to a Google spreadsheet. -- Done: Status: fail. After a successful Google device signin (initiated from within this CPY script) and receiving a token; using this token. The response on the data sent is a Google 'signin' page instead of triggering the Google Apps Script, handing this macro the data so that it can update the spreadsheet.


Image

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Sending data to io feed but does not show

Post by mikeysklar »

Okay, it look like several things have changed.

You were using a MagTag with CP8-alpha, but have now switch to using WipperSnapper with a Feather Huzzah ESP8266?

The initial code you had shared a snapshot of that was getting a 200 response from the server is now correctly working and your data is visible on the AIO server, correct?

The current unsolved problem is connection to Google spreadsheet to log the successful timestamp from the Feather Huzzah ESP8266 running wippersnapper. Is that correct?

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: Sending data to io feed but does not show

Post by brubell »

Code: Select all

- send the AIO feed datetime stamp 'updated_at', the feed Temperature value and the feed Humidity value to a Google spreadsheet. -- Done: Status: fail. After a successful Google device signin (initiated from within this CPY script) and receiving a token; using this token. The response on the data sent is a Google 'signin' page instead of triggering the Google Apps Script, handing this macro the data so that it can update the spreadsheet.
Are you able to post this script/code here?

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Sending data to io feed but does not show

Post by paulskpt »

Regarding Pushingbox.com I was maybe impatient. A day ago I discovered that Pushingbox.com's webpage is back to 'normal'. So I changed my script into using Pushingbox.com.
On the Google Apps Script side I created a new Deployment. The Web App link of that new Deployment I added in the Pushingbox.com Service string. Problem Solved. Data pushed arrived in the Google Sheets spreadsheet. Case closed.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Sending data to io feed but does not show

Post by mikeysklar »

Thank you for the followup.

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”