OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Builduing a linux service that gets weather data › Re: Re: Builduing a linux service that gets weather data
aleatorvb
Sample output for current weather
weather_current
timestamp - 1370932571
values
forecastio
humidity - 0.76
precip_intensity - 0.03
precip_probability - 0.02
pressure - 1009.86
temperature - 20.82
openweather
humidity - 0.4
pressure - 1011
temperature - 29.497
worldweatheronline
humidity - 0.83
pressure - 1009
temperature - 20
hamweather
humidity - 0.83
pressure - 1009
temperature - 20
wunderground
humidity - 0.78
pressure - 1010
temperature - 21
separated_values
humidity
0 - 0.76
1 - 0.4
2 - 0.83
3 - 0.83
4 - 0.78
precip_intensity
0 - 0.03
precip_probability
0 - 0.02
pressure
0 - 1009.86
1 - 1011
2 - 1009
3 - 1009
4 - 1010
temperature
0 - 20.82
1 - 29.497
2 - 20
3 - 20
4 - 21
median
humidity - 0.78
precip_intensity - 0.03
precip_probability - 0.02
pressure - 1009.86
temperature - 20.82
averages
humidity - 0.72
precip_intensity - 0.03
precip_probability - 0.02
pressure - 1009.772
temperature - 22.2634
One should use $[
Sample output for forecasting
weather_forecast
timestamp - 1370932571
values
forecastio
hourly
2013061106
humidity - 0.78
precip_intensity - 0.826
precip_probability - 0.87
pressure - 1008.86
temperature - 21.72
2013061107
humidity - 0.81
precip_intensity - 0.846
precip_probability - 0.89
pressure - 1008.99
temperature - 20.74
2013061108
humidity - 0.85
precip_intensity - 0.848
precip_probability - 0.92
pressure - 1009.15
temperature - 19.75
2013061109
humidity - 0.87
precip_intensity - 0.832
precip_probability - 0.93
pressure - 1009.32
temperature - 18.73
2013061110
humidity - 0.89
precip_intensity - 0.811
precip_probability - 0.95
pressure - 1009.51
temperature - 17.72
2013061111
humidity - 0.91
precip_intensity - 0.775
precip_probability - 0.95
pressure - 1009.7
temperature - 16.86
2013061112
humidity - 0.62
precip_intensity - 0.363
precip_probability - 0.87
pressure - 1008.92
temperature - 25.55
2013061101
humidity - 0.63
precip_intensity - 0.465
precip_probability - 0.92
pressure - 1008.8
temperature - 25.68
2013061102
humidity - 0.63
precip_intensity - 0.567
precip_probability - 0.91
pressure - 1008.71
temperature - 25.68
2013061103
humidity - 0.65
precip_intensity - 0.655
precip_probability - 0.88
pressure - 1008.67
temperature - 25.25
2013061104
humidity - 0.69
precip_intensity - 0.726
precip_probability - 0.88
pressure - 1008.68
temperature - 24.21
2013061105
humidity - 0.74
precip_intensity - 0.785
precip_probability - 0.87
pressure - 1008.76
temperature - 22.89
2013061212
humidity - 0.51
precip_intensity - 0.089
precip_probability - 0.09
pressure - 1010.63
temperature - 27.05
2013061201
humidity - 0.5
precip_intensity - 0.084
precip_probability - 0.07
pressure - 1010.61
temperature - 26.87
2013061202
humidity - 0.52
precip_intensity - 0.073
precip_probability - 0.06
pressure - 1010.63
temperature - 26.32
2013061203
humidity - 0.55
precip_intensity - 0.073
precip_probability - 0.1
pressure - 1010.73
temperature - 25.43
2013061204
humidity - 0.61
precip_intensity - 0.094
precip_probability - 0.22
pressure - 1010.97
temperature - 24.19
2013061205
humidity - 0.68
precip_intensity - 0.125
precip_probability - 0.39
pressure - 1011.29
temperature - 22.78
2013061206
humidity - 0.75
precip_intensity - 0.15
precip_probability - 0.51
pressure - 1011.64
temperature - 21.52
2013061207
humidity - 0.79
precip_intensity - 0.162
precip_probability - 0.54
pressure - 1012.03
temperature - 20.42
2013061208
humidity - 0.83
precip_intensity - 0.168
precip_probability - 0.53
pressure - 1012.45
temperature - 19.33
2013061209
humidity - 0.86
precip_intensity - 0.167
precip_probability - 0.49
pressure - 1012.84
temperature - 18.34
2013061210
humidity - 0.88
precip_intensity - 0.152
precip_probability - 0.44
pressure - 1013.13
temperature - 17.62
2013061211
humidity - 0.89
precip_intensity - 0.132
precip_probability - 0.36
pressure - 1013.36
temperature - 17.15
2013061312
humidity - 0.9
precip_intensity - 0.131
precip_probability - 0.33
pressure - 1013.6
temperature - 16.79
2013061301
humidity - 0.91
precip_intensity - 0.165
precip_probability - 0.35
pressure - 1013.86
temperature - 16.37
2013061302
humidity - 0.92
precip_intensity - 0.216
precip_probability - 0.4
pressure - 1014.14
temperature - 16.04
2013061303
humidity - 0.91
precip_intensity - 0.248
precip_probability - 0.44
pressure - 1014.41
temperature - 16.13
2013061304
humidity - 0.89
precip_intensity - 0.244
precip_probability - 0.43
pressure - 1014.67
temperature - 16.79
2013061305
humidity - 0.86
precip_intensity - 0.222
precip_probability - 0.41
pressure - 1014.91
temperature - 17.78
2013061306
humidity - 0.82
precip_intensity - 0.208
precip_probability - 0.39
pressure - 1015.09
temperature - 18.9
20130610
humidity - 0.74
precipProbability -
precip_intensity - 0.283
pressure - 1009.39
temperature -
20130611
humidity - 0.73
precipProbability -
precip_intensity - 0.229
pressure - 1010.66
temperature -
20130612
humidity - 0.77
precipProbability -
precip_intensity - 0.291
pressure - 1014.67
temperature -
20130613
humidity - 0.7
precipProbability -
precip_intensity - 0.105
pressure - 1015.74
temperature -
20130614
humidity - 0.72
precipProbability -
precip_intensity - 0.16
pressure - 1014.96
temperature -
20130615
humidity - 0.71
precipProbability -
precip_intensity - 0.043
pressure - 1014.68
temperature -
20130616
humidity - 0.67
precipProbability -
precip_intensity - 0.02
pressure - 1014.82
temperature -
20130617
humidity - 0.64
precipProbability -
precip_intensity - 0
pressure - 1013.81
temperature -
daily
openweather
daily
20130611
pressure - 1008.96
humidity - 0.99
temperature - 29.141
temperature_min - 28.9814
temperature_max - 29.141
20130612
pressure - 1010.92
humidity - 0.86
temperature - 29.344
temperature_min - 29.2699
temperature_max - 29.344
20130613
pressure - 1014.94
humidity - 0.67
temperature - 29.3299
temperature_min - 29.3299
temperature_max - 29.3299
20130614
pressure - 1014.54
humidity - 0.72
temperature - 29.4487
temperature_min - 29.4487
temperature_max - 29.4487
20130615
pressure - 1014.85
humidity - 0.81
temperature - 29.3464
temperature_min - 29.3464
temperature_max - 29.3464
20130616
pressure - 1016.27
humidity - 1
temperature - 29.1586
temperature_min - 29.1586
temperature_max - 29.1586
worldweatheronline
hamweather
wunderground
daily
20130611
precip_probability - 0.8
humidity - 0.69
temperature_min - 15
temperature_max - 27
temperature - 21
20130612
precip_probability - 0.8
humidity - 0.71
temperature_min - 16
temperature_max - 25
temperature - 20.5
20130613
precip_probability - 0.8
humidity - 0.79
temperature_min - 16
temperature_max - 25
temperature - 20.5
20130614
precip_probability - 0.8
humidity - 0.8
temperature_min - 16
temperature_max - 25
temperature - 20.5
separated_values
20130611
pressure
0 - 1008.96
humidity
0 - 0.99
1 - 0.69
temperature
0 - 29.141
1 - 21
temperature_min
0 - 28.9814
1 - 15
temperature_max
0 - 29.141
1 - 27
precip_probability
0 - 0.8
20130612
pressure
0 - 1010.92
humidity
0 - 0.86
1 - 0.71
temperature
0 - 29.344
1 - 20.5
temperature_min
0 - 29.2699
1 - 16
temperature_max
0 - 29.344
1 - 25
precip_probability
0 - 0.8
20130613
pressure
0 - 1014.94
humidity
0 - 0.67
1 - 0.79
temperature
0 - 29.3299
1 - 20.5
temperature_min
0 - 29.3299
1 - 16
temperature_max
0 - 29.3299
1 - 25
precip_probability
0 - 0.8
20130614
pressure
0 - 1014.54
humidity
0 - 0.72
1 - 0.8
temperature
0 - 29.4487
1 - 20.5
temperature_min
0 - 29.4487
1 - 16
temperature_max
0 - 29.4487
1 - 25
precip_probability
0 - 0.8
20130615
pressure
0 - 1014.85
humidity
0 - 0.81
temperature
0 - 29.3464
temperature_min
0 - 29.3464
temperature_max
0 - 29.3464
20130616
pressure
0 - 1016.27
humidity
0 - 1
temperature
0 - 29.1586
temperature_min
0 - 29.1586
temperature_max
0 - 29.1586
median
20130611
pressure - 1008.96
humidity - 0.84
temperature - 25.0705
temperature_min - 21.9907
temperature_max - 28.0705
precip_probability - 0.8
20130612
pressure - 1010.92
humidity - 0.785
temperature - 24.922
temperature_min - 22.63495
temperature_max - 27.172
precip_probability - 0.8
20130613
pressure - 1014.94
humidity - 0.73
temperature - 24.91495
temperature_min - 22.66495
temperature_max - 27.16495
precip_probability - 0.8
20130614
pressure - 1014.54
humidity - 0.76
temperature - 24.97435
temperature_min - 22.72435
temperature_max - 27.22435
precip_probability - 0.8
20130615
pressure - 1014.85
humidity - 0.81
temperature - 29.3464
temperature_min - 29.3464
temperature_max - 29.3464
20130616
pressure - 1016.27
humidity - 1
temperature - 29.1586
temperature_min - 29.1586
temperature_max - 29.1586
averages
20130611
pressure - 1008.96
humidity - 0.84
temperature - 25.0705
temperature_min - 21.9907
temperature_max - 28.0705
precip_probability - 0.8
20130612
pressure - 1010.92
humidity - 0.785
temperature - 24.922
temperature_min - 22.63495
temperature_max - 27.172
precip_probability - 0.8
20130613
pressure - 1014.94
humidity - 0.73
temperature - 24.91495
temperature_min - 22.66495
temperature_max - 27.16495
precip_probability - 0.8
20130614
pressure - 1014.54
humidity - 0.76
temperature - 24.97435
temperature_min - 22.72435
temperature_max - 27.22435
precip_probability - 0.8
20130615
pressure - 1014.85
humidity - 0.81
temperature - 29.3464
temperature_min - 29.3464
temperature_max - 29.3464
20130616
pressure - 1016.27
humidity - 1
temperature - 29.1586
temperature_min - 29.1586
temperature_max - 29.1586
One should use $[
I prefer using median to get a better value instead of average because it removes values that are way different than the others in the set.
I am optimising the code right now. It has multiple output classes – mysql, file and echo right now but i want to add memcached support. Give me a day or two to clean up the code.
I have done a number of services for pi and found a great option to be to store temporary data in memcache because it’s low footprint – a few megabytes of ram and very little cpu usage.
What kind of storage would you want to use in your project?