Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Mostly minor layout changes. Implemented error handling with the tren…
…d data in wc_getTrend. Expanded the EXAMPLES file by a few examples showing how to use the -s und -e options of wc_getTrend.
  • Loading branch information
weiher committed May 31, 2017
1 parent ea8f1c8 commit e353ea4
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 11 deletions.
42 changes: 40 additions & 2 deletions EXAMPLES
Expand Up @@ -79,5 +79,43 @@ End time is undefined. Use -e to define date and time.
05/30/2017 04:27:00 PM 63.783897
05/30/2017 04:28:00 PM 63.783897



### The usage of the date+time options -s and -e are examplified. -l ist not specified, thus, the last ten values are returned:
$ python wc_getTrend.py -u wsdl -n /trees/geographic/#geb_g/#g_luft/#primzuluft_1_2_stm/#g_primzuluft_trend/m006 -s '05/30/2017 03:00:00 AM' -e '05/30/2017 06:00:00 AM'
No password specified via -p. Please enter your WebCTRL login password:
05/30/2017 05:51:00 AM 59.97419
05/30/2017 05:52:00 AM 59.97419
05/30/2017 05:53:00 AM 59.97419
05/30/2017 05:54:00 AM 59.97419
05/30/2017 05:55:00 AM 59.97419
05/30/2017 05:56:00 AM 59.97419
05/30/2017 05:57:00 AM 59.97419
05/30/2017 05:58:00 AM 59.97419
05/30/2017 05:59:00 AM 59.97419
05/30/2017 06:00:00 AM 59.97419

### -l is specified, thus, the first ten values starting from the time given in -s are returned:
$ python wc_getTrend.py -u wsdl -n /trees/geographic/#geb_g/#g_luft/#primzuluft_1_2_stm/#g_primzuluft_trend/m006 -s '05/30/2017 03:00:00 AM' -e '05/30/2017 06:00:00 AM' -l
No password specified via -p. Please enter your WebCTRL login password:
05/30/2017 03:01:00 AM 63.87936
05/30/2017 03:02:00 AM 63.87936
05/30/2017 03:03:00 AM 63.87936
05/30/2017 03:04:00 AM 64.26652
05/30/2017 03:05:00 AM 64.26652
05/30/2017 03:06:00 AM 64.26652
05/30/2017 03:07:00 AM 64.26652
05/30/2017 03:08:00 AM 64.26652
05/30/2017 03:09:00 AM 64.26652
05/30/2017 03:10:00 AM 64.26652

### Get all values (-m 0) between the times given in -s and -e:
$ python wc_getTrend.py -u wsdl -n /trees/geographic/#geb_g/#g_luft/#primzuluft_1_2_stm/#g_primzuluft_trend/m006 -s '05/30/2017 03:00:00 AM' -e '05/30/2017 04:00:00 AM' -l -m 0
No password specified via -p. Please enter your WebCTRL login password:
05/30/2017 03:01:00 AM 63.87936
05/30/2017 03:02:00 AM 63.87936
05/30/2017 03:03:00 AM 63.87936
05/30/2017 03:04:00 AM 64.26652
...
05/30/2017 03:57:00 AM 60.07319
05/30/2017 03:58:00 AM 60.07319
05/30/2017 03:59:00 AM 60.07319
05/30/2017 04:00:00 AM 60.07319
5 changes: 3 additions & 2 deletions README
Expand Up @@ -17,8 +17,9 @@ webctrl$ ./build_project.sh

The executables can be found in ./dist/wc_*/wc_*

Add the directory to the PATH environment variable (in your ~/.bashrc in order to be able to execute the wc_* commands
everywhere: PATH=$PATH:$HOME/.../webctrl/dist/wc_query:$HOME/.../webctrl/dist/wc_getValue:...
Add the directory to the PATH environment variable (in your ~/.bashrc) in order to be able to
execute the wc_* commands everywhere:
PATH=$PATH:$HOME/.../webctrl/dist/wc_query:$HOME/.../webctrl/dist/wc_getValue:...

Running the tools
-----------------
Expand Down
3 changes: 2 additions & 1 deletion wc_getReport.py
Expand Up @@ -11,7 +11,7 @@


parser = argparse.ArgumentParser()
parser.add_argument('--username', '-u', type=str, default=None, help='User name for the login to the WebCTRL server')
parser.add_argument('--username', '-u', type=str, default=None, help='Username for the login to the WebCTRL server')
parser.add_argument('--password', '-p', type=str, default=None, help='Password for the login to the WebCTRL server')
parser.add_argument('--node', '-n', type=str, default=None,
help='Path to the point or node for which you want to retrieve a report.')
Expand Down Expand Up @@ -98,5 +98,6 @@
c = c + n * '-' + '---'
print c


sys.exit(0)

13 changes: 9 additions & 4 deletions wc_getTrend.py
Expand Up @@ -10,7 +10,7 @@


parser = argparse.ArgumentParser()
parser.add_argument('--username', '-u', type=str, default=None, help='User name for the login to the WebCTRL server')
parser.add_argument('--username', '-u', type=str, default=None, help='Username for the login to the WebCTRL server')
parser.add_argument('--password', '-p', type=str, default=None, help='Password for the login to the WebCTRL server')
parser.add_argument('--node', '-n', type=str, default=None,
help='The full path to the point or trend log node whose trend data is desired.')
Expand All @@ -21,7 +21,7 @@
parser.add_argument('--eTime', '-e', type=str, default=None,
help="End Time. Returns trend data values until this time. Like this: 'MM/DD/YYYY HH:MM:SS PM'.")
parser.add_argument('--limit', '-l', action='store_true', default=False,
help='If specified maxRecords are retrieved from the start or maxRecords are retrieved from the end.')
help='If specified maxRecords are retrieved from the start. If not specified maxRecords are retrieved from the end.')
parser.add_argument('--maxRec', '-m', type=int, default=10,
help='Maximum number of records desired. Use a number >0 to limit records; use 0 to retrieve unlimited records.')
args = parser.parse_args()
Expand Down Expand Up @@ -68,8 +68,13 @@
print fault
sys.exit(1)

for x in range(0, len(trendData)-1, 2):
print trendData[x] + ' ' + trendData[x+1]

if trendData:
for x in range(0, len(trendData) - 1, 2):
print trendData[x] + ' ' + trendData[x + 1]
else:
print 'No data caught. Check your -s and -e time specifications. Perhaps the end time is before the start time.'
sys.exit(1)


sys.exit(0)
2 changes: 1 addition & 1 deletion wc_getValue.py
Expand Up @@ -10,7 +10,7 @@


parser = argparse.ArgumentParser()
parser.add_argument('--username', '-u', type=str, default=None, help='User name for the login to the WebCTRL server')
parser.add_argument('--username', '-u', type=str, default=None, help='Username for the login to the WebCTRL server')
parser.add_argument('--password', '-p', type=str, default=None, help='Password for the login to the WebCTRL server')
parser.add_argument('--node', '-n', type=str, default=None,
help='Path to the point or node for which you want to retrieve the present value.')
Expand Down
2 changes: 1 addition & 1 deletion wc_query.py
Expand Up @@ -11,7 +11,7 @@


parser = argparse.ArgumentParser()
parser.add_argument('--username', '-u', type=str, default=None, help='User name for the login to the WebCTRL server')
parser.add_argument('--username', '-u', type=str, default=None, help='Username for the login to the WebCTRL server')
parser.add_argument('--password', '-p', type=str, default=None, help='Password for the login to the WebCTRL server')
parser.add_argument('--node', '-n', type=str, default=None,
help='Path to the point or node whose children you want to retrieve. Start querying at the lowest level with "-n /trees/geographic"')
Expand Down

0 comments on commit e353ea4

Please sign in to comment.