Merge branch 'release-3.0.0' into develop
[infoex-autowx.git] / examples / custom-wx.example.py
1 # reference implementation for an infoex-autowx custom Wx data provider
2
3 # global variable which will hold the Wx data to be uploaded to InfoEx
4 wx_data = {}
5
6 # the following data types are supported by infoex-autowx
7 wx_data['precipitationGauge'] = None
8 wx_data['tempPres'] = None
9 wx_data['tempMaxHour'] = None
10 wx_data['tempMinHour'] = None
11 wx_data['hS'] = None
12 wx_data['baro'] = None
13 wx_data['rH'] = None
14 wx_data['windSpeedNum'] = None
15 wx_data['windDirectionNum'] = None
16 wx_data['windGustSpeedNum'] = None
17
18 def get_custom_data():
19 # This function will be called by infoex-autowx, and the `wx_data`
20 # variable (a global variable within this program) will be returned.
21 #
22 # For example, maybe you will `import psycopg2` and grab your data
23 # from a local PostgreSQL database. Or maybe you will use the
24 # requests library to fetch a remote web page and parse out the data
25 # that's meaningful to your operation.
26 #
27 # Whatever your program needs to do to get its data can be done
28 # either here in this function directly, or elsewhere with
29 # modification to the global variable `wx_data`.
30 #
31 # NOTE: The LOG class from infoex-autowx is available, so you may
32 # issue e.g. LOG.info('some helpful information') in your
33 # program.
34
35 return wx_data