How to send an API query to Netatmo

marpelto
Posts: 2
Joined: Thu Sep 28, 2017 2:41 pm

How to send an API query to Netatmo

Postby marpelto » Thu Sep 28, 2017 2:53 pm

Hi...I'm trying to create a system with esp32 that controls home central air ventilation based on CO2 value from Netatmo.

I need to send is a API quesry to https://api.netatmo.com/api/getstationsdata?

I have tested this on my laptop with CUTL, and it works

>curl -X GET https://api.netatmo.com/api/getstations ... 0:12:xx:xx"

The response is something like this...
{"AbsolutePressure":1003.6,"time_utc":1506610078,"Noise":55,"Temperature":24.1,"temp_trend":"stable","Humidity":61,"Pressure":1020.6,"pressure_trend":"up","CO2":668,"date_max_temp":1506574864,"date_min_temp":1506595032,"min_temp":23.9,"max_temp":25},"data_type":

How can I send the same quesry via ESP32 ?
It would be easy to pick the "CO2":668 from response and control OUT pin if this value exceedes say 1000ppm



Thanks!

marpelto
Posts: 2
Joined: Thu Sep 28, 2017 2:41 pm

Re: How to send an API query to Netatmo

Postby marpelto » Sun Oct 01, 2017 2:26 pm

Nevermind, I figured out a way to do the API request without HTTPS.
I simply run PHP script to free webserver (like 000webhost.com) that supports HTTPS . The scipt sends HTTPS GET API request and returns the CO2 value which in turn I can read with HTTP (no "S") GET request on esp32 HTTPClient.h

Who is online

Users browsing this forum: Bing [Bot] and 86 guests