Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork and add air quality? #10

Open
ytmytm opened this issue May 28, 2017 · 2 comments
Open

Fork and add air quality? #10

ytmytm opened this issue May 28, 2017 · 2 comments

Comments

@ytmytm
Copy link
Owner

ytmytm commented May 28, 2017

Official API: http://powietrze.gios.gov.pl/pjp/content/api

Wielkopolska:

const request=require('request')
const moment=require('moment')

// polanka
var options = {"measType":"Auto","viewType":"Station","dateRange":"Day","date":"28.05.2017","viewTypeEntityId":1,"channels":[8,5,12,3,11,9,10,13,4,1,6,15]}
// dabrowskiego
var options = {"measType":"Auto","viewType":"Station","dateRange":"Day","date":"28.05.2017","viewTypeEntityId":2,"channels":[16,27,23,30,20,25,29,28,31,22,17,34]}

var params = {url:"https://powietrze.poznan.wios.gov.pl/dane-pomiarowe/pobierz",form:{query:JSON.stringify(options)}}

x = request.post(params, (error,response,body) => { console.log(response.statusCode); console.log(body); } )

data = JSON.parse(x.responseContent.body)

if (data.success) {
	console.log(data.data.title)
	for (i=0;i<data.data.series.length;i++) {
		console.log(data.data.series[i].label + " " + data.data.series[i].unitLabel)
		console.log(data.data.series[i].decimals)
		console.log(data.data.series[i].paramCode + " " + console.log(data.data.series[i].paramId))
		j = data.data.series[i].data.length
		console.log(moment.unix(data.data.series[i].data[j-1][0]).format("HH:mm")) // add 1h?
		console.log(data.data.series[i].data[j-1][1])
	}
}
@ytmytm
Copy link
Owner Author

ytmytm commented Jul 20, 2017

See: https://github.com/Santanachia/MMM-SmokedMirror

@ytmytm
Copy link
Owner Author

ytmytm commented Jul 22, 2017

A tu się wyszukuje ID stacji http://powietrze.gios.gov.pl/pjp/station/search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant