X-Git-Url: https://wylark.com/src/infoex-autowx.git/blobdiff_plain/638c4f11d29b685bc7c485c10ce62f2c61ae4a54..8048b2995f83e3a148fcd86e60801927b87b4a65:/examples/custom-wx.example.py?ds=sidebyside diff --git a/examples/custom-wx.example.py b/examples/custom-wx.example.py new file mode 100644 index 0000000..565e71f --- /dev/null +++ b/examples/custom-wx.example.py @@ -0,0 +1,31 @@ +# reference implementation for an infoex-autowx custom Wx data provider + +# global variable which will hold the Wx data to be uploaded to InfoEx +wx_data = {} + +# the following data types are supported by infoex-autowx +wx_data['precipitationGauge'] = None +wx_data['tempPres'] = None +wx_data['tempMaxHour'] = None +wx_data['tempMinHour'] = None +wx_data['hS'] = None +wx_data['baro'] = None +wx_data['rH'] = None +wx_data['windSpeedNum'] = None +wx_data['windDirectionNum'] = None +wx_data['windGustSpeedNum'] = None + +def get_custom_data(): + # This function will be called by infoex-autowx, and the `wx_data` + # variable (a global variable within this program) will be returned. + # + # For example, maybe you will `import psycopg2` and grab your data + # from a local PostgreSQL database. Or maybe you will use the + # requests library to fetch a remote web page and parse out the data + # that's meaningful to your operation. + # + # Whatever your program needs to do to get its data can be done + # either here in this function directly, or elsewhere with + # modification to the global variable `wx_data`. + + return wx_data