Skip to content

Commit

Permalink
Mostly changes in the argument handling: now, almost all arguments ca…
Browse files Browse the repository at this point in the history
…n be passed via command line and via the settings file; established default values; tested the correct functionality of all tools and created new examples; updated the README file
  • Loading branch information
weiher committed Aug 1, 2017
1 parent 666cbd9 commit 4c9acce
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 224 deletions.
197 changes: 112 additions & 85 deletions EXAMPLES
Original file line number Diff line number Diff line change
Expand Up @@ -3,157 +3,184 @@ Example(s) for each of the webctrl command line tools

### wc_query - Query the children of a node

$ ./wc_query -u wsdl -n /trees/geographic
webctrl/bin$ ./wc_query -u wsdl -f ../SETTINGS -n /trees/geographic
No password specified via -p. Please enter your WebCTRL login password:
Children of "/trees/geographic":
[#verbrauchszaehlung, #geb_a, #geb_b, #geb_c, #geb_d, #geb_e, #geb_f, #geb_g, #geb_k, #geb_l, #geb_m, #geb_pnq, ...]

$ ./wc_query -u wsdl -n /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel
webctrl/bin$ ./wc_query -u wsdl -f ../SETTINGS -n /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel
No password specified via -p. Please enter your WebCTRL login password:
Children of "/trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel":
[m032, m007, m008, m034, m033, m001, m005, m004, m003, m002, m006, ...]
[m032, m007, m008, m034, m033, m001, m005, m004, m003, m002, m006, m019, m020, m017, m018, m012, m013, m014, m015, ...]

ODER:

/webctrl/bin$ ./wc_query -u wsdl -f ../SETTINGS -n '#km_speicher_fel'
No password specified via -p. Please enter your WebCTRL login password:
Children of "#km_speicher_fel":
[m032, m007, m008, m034, m033, m001, m005, m004, m003, m002, m006, m019, m020, m017, m018, m012, m013, m014, m015, ...]



### wc_getValue - get the present value (the present_value attribute) of a m??? controller

$ ./wc_getValue -u wsdl -n /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel/m001
webctrl/bin$ ./wc_getValue -u wsdl -f ../SETTINGS -n '#km_speicher_fel/m001'
No password specified via -p. Please enter your WebCTRL login password:
Present value of #km_speicher_fel/m001 is: 15.187662

OR with WC_NODE='#km_speicher_fel/m001' in the SETTINGS file:

webctrl/bin$ ./wc_getValue -u wsdl -f ../SETTINGS
No password specified via -p. Please enter your WebCTRL login password:
Present value of /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel/m001 is: 15.600924
Present value of #km_speicher_fel/m001 is: 15.342966



### wc_monitor - monitor a specific controller

$ ./wc_monitor -u wsdl -n /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel/m003
# with WC_NODE='#km_speicher_fel/m001' in the SETTINGS file:
webctrl/bin$ ./wc_monitor -u wsdl -f ../SETTINGS
No password specified via -p. Please enter your WebCTRL login password:
16:48:09 9.033137
16:48:17 8.982448
16:48:39 8.931475
09:54:49 15.342966
09:54:51 15.290968
09:55:38 15.342427
09:56:18 15.393141
^CExiting due to keyboard interupt...



### wc_getReport - get a report for a node (one level lower than m???)

$ ./wc_getReport -u wsdl -n /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel/m001
webctrl/bin$ ./wc_getReport -u wsdl -f ../SETTINGS -n '#km_speicher_fel/m001'
No password specified via -p. Please enter your WebCTRL login password:
| Standort |
|---------------------------------------------------------------
| Fr die aktuellen Optionen wurden keine Ergebnisse gefunden.x |

$ ./wc_getReport -u wsdl -n /trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel
webctrl/bin$ ./wc_getReport -u wsdl -f ../SETTINGS -n '#km_speicher_fel'
No password specified via -p. Please enter your WebCTRL login password:
| Standort | Regelungsprogramm | Name | Wert | Typ | Objekt-ID | Gerte-ID | Objektname | Offset/Polaritt | Pfad |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| /Fritz-Haber-Institut/Bauteil E/Kaltwassererzeuger | Kaltwassererzeuger | FEL Kaltwasser Durchflussmenge Verteiler | 6.5 m3/Std. | BMAI | AI:315818 | DEV:34157 | m032_5 | | #km_speicher_fel/m032 |
| /Fritz-Haber-Institut/Bauteil E/Kaltwassererzeuger | Kaltwassererzeuger | FEL Kaltwasser Kltemaschine Rcklauftemperatur x | 9.724116 C | BMAI | AI:2796280 | DEV:34157 | m007_5 | | #km_speicher_fel/m007 |
| /Fritz-Haber-Institut/Bauteil E/Kaltwassererzeuger | Kaltwassererzeuger | FEL Kaltwasser Kltemaschine Vorlauftemperatur | 8.348758 C | BMAI | AI:2796279 | DEV:34157 | m008_5 | | #km_speicher_fel/m008 |
| /Fritz-Haber-Institut/Bauteil E/Kaltwassererzeuger | Kaltwassererzeuger | FEL Kaltwasser Durchflussmenge Verteiler | 6.0 m3/Std. | BMAI | AI:315818 | DEV:34157 | m032_5 | | #km_speicher_fel/m032 |
| /Fritz-Haber-Institut/Bauteil E/Kaltwassererzeuger | Kaltwassererzeuger | FEL Kaltwasser Kltemaschine Rcklauftemperatur x | 9.684903 C | BMAI | AI:2796280 | DEV:34157 | m007_5 | | #km_speicher_fel/m007 |
| /Fritz-Haber-Institut/Bauteil E/Kaltwassererzeuger | Kaltwassererzeuger | FEL Kaltwasser Kltemaschine Vorlauftemperatur | 9.069413 C | BMAI | AI:2796279 | DEV:34157 | m008_5 | | #km_speicher_fel/m008 |
| ...



### wc_getTrend - get timestamps and data values of a specific controller for a specific time period

### If no time period and number of values to retrieve are specified you'll get the last ten values
$ python wc_getTrend.py -u wsdl -n /trees/geographic/#geb_g/#g_luft/#primzuluft_1_2_stm/#g_primzuluft_trend/m006
webctrl/bin$ ./wc_getTrend -u wsdl -f ../SETTINGS -n '#g_primzuluft_trend/m006'
No password specified via -p. Please enter your WebCTRL login password:
Start time is undefined. Use -s to define date and time.
End time is undefined. Use -e to define date and time.
05/30/2017 02:19:00 PM 63.292435
05/30/2017 02:20:00 PM 63.292435
05/30/2017 02:21:00 PM 63.292435
05/30/2017 02:22:00 PM 63.292435
05/30/2017 02:23:00 PM 63.292435
05/30/2017 02:24:00 PM 63.292435
05/30/2017 02:25:00 PM 63.292435
05/30/2017 02:26:00 PM 63.292435
05/30/2017 02:27:00 PM 63.292435
05/30/2017 02:28:00 PM 63.292435
No start time specified. ...
No end time specified. ...
No parameter 'limit' specified. ...
No parameter 'maxRec' specified. ...
08/01/2017 09:30:00 AM 49.748962
08/01/2017 09:45:00 AM 49.74543
08/01/2017 10:00:00 AM 49.6482
08/01/2017 10:15:00 AM 50.137894
08/01/2017 10:30:00 AM 51.30997
08/01/2017 10:45:00 AM 51.014744
08/01/2017 11:00:00 AM 51.01651
08/01/2017 11:15:00 AM 51.205673
08/01/2017 11:30:00 AM 51.209206
08/01/2017 11:45:00 AM 51.01651

### Specify the amount of values you want to retrieve starting from the time of retrieval
$ python wc_getTrend.py -u wsdl -n /trees/geographic/#geb_g/#g_luft/#primzuluft_1_2_stm/#g_primzuluft_trend/m006 -m 5
webctrl/bin$ ./wc_getTrend -u wsdl -f ../SETTINGS -n '#g_primzuluft_trend/m006'
No password specified via -p. Please enter your WebCTRL login password:
Start time is undefined. Use -s to define date and time.
End time is undefined. Use -e to define date and time.
05/30/2017 04:25:00 PM 63.783897
05/30/2017 04:26:00 PM 63.783897
05/30/2017 04:27:00 PM 63.783897
05/30/2017 04:28:00 PM 63.783897
05/30/2017 04:29:00 PM 63.783897
No start time specified. ...
No end time specified. ...
No parameter 'limit' specified. ...
No parameter 'maxRec' specified. ...
08/01/2017 10:45:00 AM 51.014744
08/01/2017 11:00:00 AM 51.01651
08/01/2017 11:15:00 AM 51.205673
08/01/2017 11:30:00 AM 51.209206
08/01/2017 11:45:00 AM 51.01651

### Specify the amount of values you want to retrieve starting from the beginning of recording the specified controller
$ python wc_getTrend.py -u wsdl -n /trees/geographic/#geb_g/#g_luft/#primzuluft_1_2_stm/#g_primzuluft_trend/m006 -m 5 -l
### by using the -l switch
webctrl/bin$ ./wc_getTrend -u wsdl -f ../SETTINGS -n '#g_primzuluft_trend/m006' -m 5 -l
No password specified via -p. Please enter your WebCTRL login password:
Start time is undefined. Use -s to define date and time.
End time is undefined. Use -e to define date and time.
03/15/2017 04:10:48 PM 0.0
03/15/2017 04:10:48 PM 0.0
03/15/2017 04:12:21 PM 33.726974
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 start time specified. ...
No end time specified. ...
05/03/2017 12:13:27 AM 45.4478
05/03/2017 05:43:32 AM 44.273945
05/03/2017 06:23:31 AM 43.200867
05/03/2017 07:13:32 AM 42.028778
05/03/2017 08:26:02 AM 47.01764

### The usage of the date+time options -s and -e as well as in connection to -l are examplified:
webctrl/bin$ ./wc_getTrend -u wsdl -f ../SETTINGS -n '#g_primzuluft_trend/m006' -m 5 -s '07/30/2017 03:00:00 AM' -e '07/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 parameter 'limit' specified. ...
07/30/2017 05:00:00 AM 49.358273
07/30/2017 05:15:00 AM 49.358273
07/30/2017 05:30:00 AM 49.360043
07/30/2017 05:45:00 AM 49.25927
07/30/2017 06:00:00 AM 49.26281
stefan@muonio: ~/PycharmProjects/webctrl/bin$ ./wc_getTrend -u wsdl -f ../SETTINGS -n '#g_primzuluft_trend/m006' -m 5 -s '07/30/2017 03:00:00 AM' -e '07/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
07/30/2017 03:15:00 AM 49.361805
07/30/2017 03:30:00 AM 49.55097
07/30/2017 03:45:00 AM 49.55627
07/30/2017 04:00:00 AM 49.459038
07/30/2017 04:15:00 AM 49.552734

### Get all values (-m 0) between the times given in -s and -e. Notice the difference when using -l:
webctrl/bin$ ./wc_getTrend -u wsdl -f SETTINGS -n '#g_primzuluft_trend/m006' -m 5 -s '07/30/2017 03:00:00 AM' -e '07/30/2017 06:00:00 AM' -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
No parameter 'limit' specified. ...
07/30/2017 03:15:00 AM 49.361805
07/30/2017 03:30:00 AM 49.55097
07/30/2017 03:45:00 AM 49.55627
...
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
07/30/2017 05:30:00 AM 49.360043
07/30/2017 05:45:00 AM 49.25927
07/30/2017 06:00:00 AM 49.26281
webctrl/bin$ ./wc_getTrend -u wsdl -f SETTINGS -n '#g_primzuluft_trend/m006' -m 5 -s '07/30/2017 03:00:00 AM' -e '07/30/2017 06:00:00 AM' -m 0 -l
No password specified via -p. Please enter your WebCTRL login password:
07/30/2017 03:00:00 AM 49.552734
07/30/2017 03:15:00 AM 49.361805
07/30/2017 03:30:00 AM 49.55097
...
07/30/2017 05:15:00 AM 49.358273
07/30/2017 05:30:00 AM 49.360043
07/30/2017 05:45:00 AM 49.25927



### wc_checkAlarms - check all alarms of a specified node
$ python wc_checkAlarms.py -u wsdl -n /trees/geographic -i 1 -a 1
No password specified via -p. Please enter your WebCTRL login password:
webctrl/bin$ ./wc_checkAlarms -u wsdl -f SETTINGS -i 1 -t 1
No password specified via -p. Please enter your WebCTRL login password now:
No verbosity specified. ...
No interval specified. ...
No time to take action specified. ...

# You don't see anything if there are no unhandled/unchecked alarms. So, switch on the verbose output to see a bit
# what's happening:

webctrl/bin$ ./wc_checkAlarms -u wsdl -f SETTINGS -i 1 -t 1 -v
No password specified via -p. Please enter your WebCTRL login password now:
Appending alarm 2017-07-25 12:24:25 Geb.G KKUK Sekundr Pumpe Ansteuerung Strung to alarmsActive
Removing alarm 2017-07-25 12:24:37 Geb.G KKUK Sekundr Pumpe Ansteuerung Strung from alarmsActive
Appending alarm 2017-07-25 13:14:21 DI_Wasser_Sensor_Lichtschacht_TZ to alarmsActive
No alarms in list alarmsChecked
(datetime.datetime(2017, 7, 25, 13, 14, 21), '/Fritz-Haber-Institut/Bauteil R/Meldungen/Geb.R Meldungen', 'Geb.R Wasser-Sensor Lichtschacht Technikzentrale Keller ausgelst!', 'DI_Wasser_Sensor_Lichtschacht_TZ', 'Nicht besttigt', 'Heizung, Lftung, Klimatechnik - Allgemein', 'Unnormal')
Age: 0
Age: 0.0
Appending alarm 2017-07-25 12:24:25 Geb.G KKUK Sekundr Pumpe Ansteuerung Strung to alarmsActive
Removing alarm 2017-07-25 12:24:37 Geb.G KKUK Sekundr Pumpe Ansteuerung Strung from alarmsActive
No alarms in list alarmsChecked
(datetime.datetime(2017, 7, 25, 13, 14, 21), '/Fritz-Haber-Institut/Bauteil R/Meldungen/Geb.R Meldungen', 'Geb.R Wasser-Sensor Lichtschacht Technikzentrale Keller ausgelst!', 'DI_Wasser_Sensor_Lichtschacht_TZ', 'Nicht besttigt', 'Heizung, Lftung, Klimatechnik - Allgemein', 'Unnormal')
Age: 1
Age: 1.0
Sending an e-mail to weiher@fhi-berlin.mpg.de
Appending alarm 2017-07-25 12:24:25 Geb.G KKUK Sekundr Pumpe Ansteuerung Strung to alarmsActive
Removing alarm 2017-07-25 12:24:37 Geb.G KKUK Sekundr Pumpe Ansteuerung Strung from alarmsActive
No alarms in list alarmsChecked
(datetime.datetime(2017, 7, 25, 13, 14, 21), '/Fritz-Haber-Institut/Bauteil R/Meldungen/Geb.R Meldungen', 'Geb.R Wasser-Sensor Lichtschacht Technikzentrale Keller ausgelst!', 'DI_Wasser_Sensor_Lichtschacht_TZ', 'Nicht besttigt', 'Heizung, Lftung, Klimatechnik - Allgemein', 'Unnormal')
Age: 2
Age: 2.0
Sending an e-mail to weiher@fhi-berlin.mpg.de

22 changes: 19 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,23 @@ To be able to import the wc_* tools append to the PYTHONPATH the webctrl directo
2) Set the python path inside the python script before the import statement:
sys.path.append('/path/to/webctrl')

Set the PATH variable to be able to execute the compiled wc tools system-wide: PATH=$PATH:/path/to/webctrl/bin

Argument passing
----------------

There are three ways to pass arguments to the tools:

1) webctrl$ python wc_query.py -n '/trees/geographic' or
webctrl$ ./bin/wc_query -n '/trees/geographic'

2) via a dictonary, myDictionary = {..., 'node':'/trees/geographic', ...}, when using one of the tools in another python
script: wc_query.main(myDictonary)

3) via the SETTINGS file, e.g.: WC_NODE='/trees/geographic'

To see which arguments are required and which ones are optional type: webctrl$ python wc_*.py -h
All required arguments (except the password for the WebCTRL login) need to be passed in any one of the three above ways.
The password cannot be given via the SETTINGS file. If the password is not specified via -p you will be prompted to
type it interactively. All optional arguments have default values which will be shown to you when using one of the tools.

Alle Argumente können via Kommandozeile UND via Env. Var. angegeben werden. Es werden KEINE Defaults gesetzt.
Die URL ist nur über die Env. Var. setzbar.
Das Passwort ist nur via Kommandozeile setzbar.
18 changes: 11 additions & 7 deletions SETTINGS
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
WC_USERNAME = 'wsdl'
#WC_NODE = '/trees/geographic'
WC_NODE = '/trees/geographic/#geb_e/#kaltw_erzeuger_fel/#km_speicher_fel'
WC_NODE = '#km_speicher_fel'
WC_URL = 'https://webctrl.rz-berlin.mpg.de'
WC_VERBOSITY =

# wc_checkAlarms
WC_ALARMS_ALERT_EMAIL = 'weiher@fhi-berlin.mpg.de,weiher@fhi-berlin.mpg.de,weiher@fhi-berlin.mpg.de'
WC_ALARMS_ALERT_PERIODS = '8-16,16-22,22-8'
WC_ALARMS_INTERVAL = 1
WC_ALARMS_TAKEACTION = 1
WC_ALARMS_INTERVAL =
WC_ALARMS_TAKEACTION =

# wc_getReport
WC_REPORT_TYPE = '~point-list-report'

# wc_getTrend
WC_TREND_STIME = ''
WC_TREND_ETIME = ''
WC_TREND_LIMIT = ''
WC_TREND_MAXREC = ''
WC_TREND_STIME =
WC_TREND_ETIME =
WC_TREND_LIMIT =
WC_TREND_MAXREC =
Loading

0 comments on commit 4c9acce

Please sign in to comment.