Netatmo Weather Station/Getting data via URL
Posted: Sat Oct 29, 2016 2:10 pm
Over the last couple of years I've had a great learning experience developing my home control app using Demopad. Picking things up as I go along, and with great help from the patient guys at Demopad support and this forum, I've now got it set up to control LightwaveRF lighting and sockets, Philips Hue lights, Owl Intuition heating controls and electricity monitor, TiVo box, Yamaha Amp and the TV
I've just received my Centro-8m and my next step is to have a wall mounted iPad for whole house control!
The next device I'd like to add is to capture data from my Netatmo weather station. The big challenge here is that they don't have a local API. The data has to be picked up from their servers. Now, I've got lots of two-way feedback set up in my app, but I've never done it via a URL so not sure how to do it - or even if it's possible! So I'd be really grateful for some advice on how to get some of the following into Demopad speak!
First, I need to get an access token and refresh token by posting the following to the website:
POST /oauth2/token HTTP/1.1 Host: api.netatmo.com Content-Type: application/x-www-form-urlencoded;charset=UTF-8 grant_type=password client_id=[YOUR_APP_ID] client_secret=[YOUR_CLIENT_SECRET] username=[USER_MAIL] password=[USER_PASSWORD] scope=[SCOPES_SPACE_SEPARATED]
This will return the following - how do I configure this in two-way feedback? (I should be able to do the Regex bit)
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"2YotnFZFEjr1zCsicMWpAA", "expires_in":10800, "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA", }
I should then be able to save the tokens to a label and, following what I learn from the above, I should then be able to send other commands to get the weather data back on temperature, rainfall etc...
...I just need some pointers to get me started .... please!!
I've just received my Centro-8m and my next step is to have a wall mounted iPad for whole house control!
The next device I'd like to add is to capture data from my Netatmo weather station. The big challenge here is that they don't have a local API. The data has to be picked up from their servers. Now, I've got lots of two-way feedback set up in my app, but I've never done it via a URL so not sure how to do it - or even if it's possible! So I'd be really grateful for some advice on how to get some of the following into Demopad speak!
First, I need to get an access token and refresh token by posting the following to the website:
POST /oauth2/token HTTP/1.1 Host: api.netatmo.com Content-Type: application/x-www-form-urlencoded;charset=UTF-8 grant_type=password client_id=[YOUR_APP_ID] client_secret=[YOUR_CLIENT_SECRET] username=[USER_MAIL] password=[USER_PASSWORD] scope=[SCOPES_SPACE_SEPARATED]
This will return the following - how do I configure this in two-way feedback? (I should be able to do the Regex bit)
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"2YotnFZFEjr1zCsicMWpAA", "expires_in":10800, "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA", }
I should then be able to save the tokens to a label and, following what I learn from the above, I should then be able to send other commands to get the weather data back on temperature, rainfall etc...
...I just need some pointers to get me started .... please!!