Is there a tutorial or description of how to send the data collected in this project to my own web page for display? I'd like to share the data with the neighbors on our local website. I was thinking of sending the data as parameters and having a php file receive the data and display it. For example
my.website.com?temp=arg1&humid=arg2&part=arg3
Not sure how to encode that with the library routines. I searched through current examples I couldn't find an exact project
Thanks!
Question on Air Quality Project
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_carter
- Posts: 29179
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question on Air Quality Project
Which specific project are you working with? Can you link the the guide.
In general, you'd need something that could connect to wifi and the internet. Then you could use something like MQTT to send out the data. Could also use Adafruit IO.
In general, you'd need something that could connect to wifi and the internet. Then you could use something like MQTT to send out the data. Could also use Adafruit IO.
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
Hi!
I have successful built this project:
https://learn.adafruit.com/air-quality- ... silo-house
And the the dashboard on IO reflects temp, humidity, particle and long, lat values. What I'd like to do is send those values from the feather to another site. I looked at the code in the project that help set up Wi-Fi and I wondered if added that to the code now running on the feather I could send to both sites.
In the file "first-wifi-test.py" there are a couple of "GET" requests to Adafruit. Could I use that syntax with a "PUT" to my website?
<<Code snippets>>
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
.
.
.
.
print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
<end of code snippet>>
Would using the feather with two different HTTP methods one to adafruit IO and one to http site cause issues?
for example:
TEXT_URL = "http://mysite.com/data.php?parm0=temp&p ... parm2=part"
Thanks for getting back to me so quickly.
Cheers
Dave
I have successful built this project:
https://learn.adafruit.com/air-quality- ... silo-house
And the the dashboard on IO reflects temp, humidity, particle and long, lat values. What I'd like to do is send those values from the feather to another site. I looked at the code in the project that help set up Wi-Fi and I wondered if added that to the code now running on the feather I could send to both sites.
In the file "first-wifi-test.py" there are a couple of "GET" requests to Adafruit. Could I use that syntax with a "PUT" to my website?
<<Code snippets>>
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
.
.
.
.
print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
<end of code snippet>>
Would using the feather with two different HTTP methods one to adafruit IO and one to http site cause issues?
for example:
TEXT_URL = "http://mysite.com/data.php?parm0=temp&p ... parm2=part"
Thanks for getting back to me so quickly.
Cheers
Dave
- adafruit_support_carter
- Posts: 29179
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question on Air Quality Project
Something like that should be doable. Look at some of the examples in the ESP32SPI library:
https://github.com/adafruit/Adafruit_Ci ... n/examples
That's the library that interfaces with the ESP32 on the AirLift FeatherWing. Checkout the TCP and UDP examples as possible approaches. You'll have to know how to set things up on the server side, on whatever is hosting your webpage.
https://github.com/adafruit/Adafruit_Ci ... n/examples
That's the library that interfaces with the ESP32 on the AirLift FeatherWing. Checkout the TCP and UDP examples as possible approaches. You'll have to know how to set things up on the server side, on whatever is hosting your webpage.
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
Thanks I'll check that out. I have the server side understood OK, it was just the sending of the data.
Thanks again
Thanks again
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
Thanks the example link, that was just what I needed. I now have the values posted to my web site as well as the IO dashboard.
Thanks for the continued great support!
Cheers
Dave
Thanks for the continued great support!
Cheers
Dave
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
I get this error when I try to publish to my site hosted at Yahoo:
411
and of course data is not written to the server. Dumping out the full return code I get this:
{'_remaining': 277, '_headers': {'Server': 'ATS', 'Date': 'Mon, 02 Aug 2021 21:32:52 GMT', 'Content-Type': 'text/html', 'Content-Language': 'en', 'Connection': 'keep-alive', 'Cache-Control': 'no-store', 'Content-Length': '277'}, '_received_length': 9, '_chunked': False, '_cached': None, '_backwards_compatible': True, 'encoding': 'utf-8', 'socket': <_FakeSSLSocket object at 20008fb0>, '_session': <Session object at 200039f0>, 'status_code': 411, '_raw': None, '_receive_buffer': bytearray(b'<HTML>\n<H<HL>\n<H277\r\n\r\n<HTML>\n<H'), 'reason': bytearray(b'Content Length Required')}
Is the "Content_Length" is this message the return from Yahoo? If yes, how do I encode the content length in my outgoing message?
Is it the length of my php parameters (?temp=100 etc)? In which case I can calculate the length of the string and then append a header field containing the
headers={"Content-Length": "25"}
If not how do I work out the content length?
As I said earlier it is working on my local Pi Apache2 implementation just fine.
Thanks
411
and of course data is not written to the server. Dumping out the full return code I get this:
{'_remaining': 277, '_headers': {'Server': 'ATS', 'Date': 'Mon, 02 Aug 2021 21:32:52 GMT', 'Content-Type': 'text/html', 'Content-Language': 'en', 'Connection': 'keep-alive', 'Cache-Control': 'no-store', 'Content-Length': '277'}, '_received_length': 9, '_chunked': False, '_cached': None, '_backwards_compatible': True, 'encoding': 'utf-8', 'socket': <_FakeSSLSocket object at 20008fb0>, '_session': <Session object at 200039f0>, 'status_code': 411, '_raw': None, '_receive_buffer': bytearray(b'<HTML>\n<H<HL>\n<H277\r\n\r\n<HTML>\n<H'), 'reason': bytearray(b'Content Length Required')}
Is the "Content_Length" is this message the return from Yahoo? If yes, how do I encode the content length in my outgoing message?
Is it the length of my php parameters (?temp=100 etc)? In which case I can calculate the length of the string and then append a header field containing the
headers={"Content-Length": "25"}
If not how do I work out the content length?
As I said earlier it is working on my local Pi Apache2 implementation just fine.
Thanks
- adafruit_support_carter
- Posts: 29179
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question on Air Quality Project
Error code 411 = Length Required.
You need to add "Content-Length" to the headers you're sending to Yahoo.
You need to add "Content-Length" to the headers you're sending to Yahoo.
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
But how do I calculate it in circuitpython?
Thanks
Thanks
- adafruit_support_carter
- Posts: 29179
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Question on Air Quality Project
It's the size of the message body in bytes. Depends on how you are building up the message body. But could maybe try len()?
Code: Select all
>>> msg = "hello world"
>>> len(msg)
11
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
Thanks I worked that bit out :-)
But what is the message content. Is it:
1) https://mywebsite/test.php?parm=1&parm2=2
or
2) ?parm=1&parm2=2
I'm still searching through the internet to find an answer I can use.
Cheers
But what is the message content. Is it:
1) https://mywebsite/test.php?parm=1&parm2=2
or
2) ?parm=1&parm2=2
I'm still searching through the internet to find an answer I can use.
Cheers
- robboz4
- Posts: 69
- Joined: Tue Nov 20, 2012 7:01 pm
Re: Question on Air Quality Project
I solved it a different way. I used
r = wifi.get("myweb_site" + payload)
The server does not do a "content_length" check on a GET only on a POST.
Cheers
Dave
r = wifi.get("myweb_site" + payload)
The server does not do a "content_length" check on a GET only on a POST.
Cheers
Dave
Please be positive and constructive with your questions and comments.