From 8048b2995f83e3a148fcd86e60801927b87b4a65 Mon Sep 17 00:00:00 2001 From: Alexander Vasarab Date: Sun, 29 Nov 2020 13:16:52 -0800 Subject: [PATCH] Add examples/ dir and add a custom Wx example --- .../config.example.ini | 0 examples/custom-wx.example.py | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+) rename config.ini.example => examples/config.example.ini (100%) create mode 100644 examples/custom-wx.example.py diff --git a/config.ini.example b/examples/config.example.ini similarity index 100% rename from config.ini.example rename to examples/config.example.ini 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 -- 2.30.2