EPC HTTP Interface: Unterschied zwischen den Versionen

Aus Gude Systems GmbH
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
*Im folgenden finden Sie eine Beschreibung der HTTP-Programmierschnittstelle für die ExpertPowerControl Serie der neueren Generation
+
* Below you will find a description of the HTTP application programming interface for the Expert Power Control series of the newer generation.
*Als Interface wird hier Kombination aus CGI und JSON über HTTP beschrieben
+
* As interface, a combination between CGI and JSON via HTTP is described
*Wenn Ihr Gerät über die Ressource [[FAQ status.html|status.html]] verfügt, so können Sie die folgenden Information anwenden. Falls nicht, so ist Ihr Gerät zu dieser Beschreibung inkompatibel
+
* If your device is equipped with the resource status.html, the following information can be used. If not, your device is unfortunately not compatible to this description.
  
 
+
=Overview=
=Übersicht=
+
* The following section describes how you can send commands to the EPC via HTTP, and how to evaluate dynamic status or configuration values via HTTP.
* Im folgenden wird beschrieben wie Sie ''Kommandos'' an den EPC über HTTP senden können, und wie sie dynamische Status- bzw. Konfigurations-Werte über HTTP auswerten können.
+
** For example, a command can be the instruction to the EPC to turn on an output or to save a configuration value.
** Ein ''Kommando'' kann z.B. die Anweisung an den EPC sein einen Ausgang einzuschalten, oder einen Konfigurationswert zu speichern.
+
** With reports of status or configuration values the question is meant for example: “Is output number 1 switched on?” or “Is Syslog switched on?
** mit Auswertungen von Status- bzw. Konfigurationswerten ist z.B. die Frage gemeint: "Ist Ausgang Nummer-1 eingeschaltet?", oder "Ist Syslog eingeschaltet?"
 
  
  
 
=CGI GET Request=
 
=CGI GET Request=
Kommandos an den EPC werden als HTTP-GET-Request verschickt, im folgenden finden Sie eine Auflistung der Kommandos sowie der jeweils benötigten CGI Paramater.
+
Commands to the EPC are sent as an HTTP-GET-request, the following you will find a list of commands and the respective required CGI parameters.
  
 
+
==Output switching (easy switching command)==
==Ausgang schalten (einfaches Schaltkommando)==
+
  Ex.: http://user:secret@192.168.0.2/ov.html?cmd=1&p=1&s=1
  Bsp: http://user:geheim@192.168.0.2/ov.html?cmd=1&p=1&s=1
 
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 1 || Kommando 1: Ausgang schalten
+
| cmd || 1 || Command 1: switching output
 
|-
 
|-
| p || [1,2, ... , N] || Nummer des zu schaltenden Ausgangs (Powerport)
+
| p || [1,2, ... , N] || Number of the Output (power port) to be switched
 
|-
 
|-
| s || [0,1] || 0: ausschalten, 1: einschalten
+
| s || [0,1] || 0: Switch off, 1: Switch on
 
|}
 
|}
  
  
==Ausgang schalten (Schalten in Serie, Batchmode) ==
+
==Output switching (switching in series, Batch mode) ==
===Batchmode starten===
+
===Start Batch mode===
  Bsp: http://user:geheim@192.168.0.2/?cmd=5&p=1&a1=0&a2=1&s=5
+
  Ex.: http://user:secret@192.168.0.2/?cmd=5&p=1&a1=0&a2=1&s=5
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 5 || Kommando 5: Batchmode
+
| cmd || 5 || Command 5: Batch mode
 
|-
 
|-
| p || [1,2, ... , N] || Nummer des zu schaltenden Ausgangs (Powerport)
+
| p || [1,2, ... , N] || Number of the Output (power port) to be switched
 
|-
 
|-
| a1 || [0,1] || Aktion Nummer1:<br>0: ausschalten, 1: einschalten
+
| a1 || [0,1] || Action number1:<br>0: Switch off, 1: Switch on
 
|-
 
|-
| a2 || [0,1] || Aktion Nummer2:<br>0: ausschalten, 1: einschalten
+
| a2 || [0,1] || Action number2:<br>0: Switch off, 1: Switch on
 
|-
 
|-
| s || [1..65535] || Wartezeit in Sekunden zwischen Aktion1 und Aktion2
+
| s || [1..65535] || Waiting time in seconds between Action1 and Action2
 
|}
 
|}
  
  
===Batchmode abbrechen===
+
===Cancel Batch mode===
  Bsp: http://user:geheim@192.168.0.2/?cmd=2&p=1
+
  Ex.: http://user:secret@192.168.0.2/?cmd=2&p=1
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 2 || Kommando 2: Batchmode abbrechen
+
| cmd || 2 || Command 2: cancel Batch mode
 
|-
 
|-
| p || [1,2, ... , N] || Nummer des zu Ausgangs (Powerport)
+
| p || [1,2, ... , N] || Number of the output (power port) to be switched
 
|}
 
|}
  
  
 
===Reset===
 
===Reset===
Reset ist ein vorkonfigurierter Batchmode, welcher Ausschaltet, und nach einer konfigurierbaren Zeit wieder Einschaltet.
+
Reset is a preconfigured Batch mode, which turns off and turns on again after a configurable time
(siehe : [[#Konfiguration: Ausgänge|Konfiguration: Ausgänge]])
+
(see : [[#Configuration: Outputs|Configuration: Outputs]])
  
  Bsp: http://user:geheim@192.168.0.2/?cmd=12&p=2
+
  Ex.: http://user:secret@192.168.0.2/?cmd=12&p=2
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 12 || Kommando 12: Reset durchführen
+
| cmd || 12 || Command 12: perform reset
 
|-
 
|-
| p || [1,2, ... , N] || Nummer des Ausgangs an dem ein Reset durchgeführt werden soll
+
| p || [1,2, ... , N] || Number of the output (power port) on which a reset should be performed
 
|}
 
|}
  
  
==Konfiguration: Ausgänge==
+
==Configuration: Outputs==
Bsp: http://admin:geheim@192.168.0.2/?cmd=3&p=1&name=Output+1&powup=0&powrem=0&idle=0&on_again=0&reset=0&we=0&wip=&wt=0&wport=80&wint=10&wret=6
+
Ex.: http://admin:secret@192.168.0.2/?cmd=3&p=1&name=Output+1&powup=0&powrem=0&idle=0&on_again=0&reset=0&we=0&wip=&wt=0&wport=80&wint=10&wret=6
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 3 || Kommando 3: Ausgang (Powerport) konfigurieren
+
| cmd || 3 || Command 3: configure Output (Power port)
 
|-
 
|-
| p || [1,2, ... , N] || Nummer des zu konfigurierenden Ausgangs (Powerport)
+
| p || [1,2, ... , N] || Number of the output (power port) to be configured
 
|-
 
|-
| name || Zeichenkette mit maximal 15 Zeichen || Name des Ausgangs
+
| name || Character string with maximum 15 characters || Output name
 
|-
 
|-
| powup || [0, 1] || 0: nach Gerätestart Ausgang ausgeschaltet lassen<br>1: nach Gerätestart Ausgang einschalten
+
| powup || [0, 1] ||  
 +
 
 +
0: leave output switched off after device start<br>1: Switch Output on after device start
 
|-
 
|-
| powrem || [0, 1] || 0: aktuellen Schaltzustand für den nächsten Gerätestart nicht merken<br>1: aktuellen Schaltzustand für den nächsten Gerätestart merken
+
| powrem || [0, 1] || 0: don’t remember actual switching status for next device start<br>1: remember actual switching status for next device start
 
|-
 
|-
| idle || [0 .. N] || Anzahl der Wartezeit in Sekunden nach Gerätestart vor etwaigen Einschalten des Ausgangs<br>0=keine Wartezeit
+
| idle || [0 .. N] || Amount of waiting time in seconds after device start before switching on the output<br>0 = no idle time
 
|-
 
|-
| on_again || [0 .. N] || Anzahl der Wartezeit in Sekunden nach Ausschalten eines Ausgangs vor automatischen Wiedereinschalten, 0=kein automatisches Wiedereinschalten
+
| on_again || [0 .. N] || Amount of waiting time in seconds after switching off one output before automatically switching back on,
 +
0= no automatic switching back on
 
|-
 
|-
| reset || [1 .. N] || Reset duration: Dauer der Power-down Phase in Sekunden beim [[#Reset|Reset Kommando]]
+
| reset || [1 .. N] || Reset duration: duration of power-down phase in seconds by the [[#Reset|reset command]]
 
|-
 
|-
| we || [0, 1] || 0=Watchdog deaktiviert<br>1=Watchdog aktiviert
+
| we || [0, 1] || 0= Watchdog deactivated<br>1= Watchdog activated
 
|-
 
|-
| wip || Zeichenkette || Hostname (FQDN) oder IP Adresse des zu des überwachenden Hosts
+
| wip || Character string || Hostname (FQDN) or IP-address of the host to be monitored
 
|-
 
|-
| wt || [0, 1] || 0=Watchdog verwendet ICMP Pings<br>1=watchdog verwendet TCP handshakes
+
| wt || [0, 1] || 0= Watchdog uses ICMP pings<br>1= Watchdog uses TCP handshakes  
 
|-
 
|-
| wport || [1..65535] || TCP Portnummer falls wt=1
+
| wport || [1..65535] || TCP port number if wt=1
 
|-
 
|-
| wint || [1..65535] || Watchdog Ping Interval in Sekunden
+
| wint || [1..65535] || Watchdog ping interval in seconds
 
|-
 
|-
| wret || [1..65535] || Watchdog Ping Retry: Anzahl der Ping-Signale die unbeantwortet bleiben müssen um den Watchdog Zustand 'Host ausgefallen' einzunehmen
+
| wret || [1..65535] || Watchdog ping retry: amount of ping-signals which has to be unanswered to state the watchdog condition “host failed”
 
|}
 
|}
  
  
==Konfiguration: Eingänge==
+
==Configuration: Inputs==
  Bsp: http://admin:geheim@192.168.0.2/?cmd=13&p=1&name=Input+1&hitext=closed&lowtext=open&inverted=1&msgt=0
+
  Ex.: http://admin:secret@192.168.0.2/?cmd=13&p=1&name=Input+1&hitext=closed&lowtext=open&inverted=1&msgt=0
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 13 || Kommando 13: Eingang konfigurieren
+
| cmd || 13 || Command 13: configure input
 
|-
 
|-
| p || [1,2, ... , N] || Nummer des zu konfigurierenden Eingangs
+
| p || [1,2, ... , N] || Number of the input to be configured
 
|-
 
|-
| name || Zeichenkette mit maximal 15 Zeichen || Name des Eingangs
+
| name || Character string with maximum 15 characters || Input name
 
|-
 
|-
| hitext || Zeichenkette mit maximal 15 Zeichen || Name des logical-1 Zustandes
+
| hitext || Character string with maximum 15 characters || Name of the logical-1 condition
 
|-
 
|-
| lowtext || Zeichenkette mit maximal 15 Zeichen || Name des logical-0 Zustandes
+
| lowtext || Character string with maximum 15 characters || Name of the logical-0 condition
 
|-
 
|-
| inverted || [0,1] || invertiert bei inverted=1 den physical state des Inputs. Bei inverted=0 gilt: physical state = logical state
+
| inverted || [0,1] || Inverts the physical state of the input at inverted=1 . At inverted=0 applies: physical state = logical state
 
|-
 
|-
| msgt || [0,1] || Generate messages: bei msgt=1 werden Nachrichten erzeugt (ggf. Syslog, Mail und SNMP-Trap) bei Input-Zustandsänderungen
+
| msgt || [0,1] || Generate messages: at msgt=1 messages will be generated (possibly Syslog, Mail and SNMP-trap) at input condition changes
 
|}
 
|}
  
  
  
==Konfiguration: IPv4 Netzwerk==
+
==Configuration: IPv4 Network==
  Bsp: http://admin:geheim@192.168.0.2/?cmd=4&host=enc-2i2o-gude&ip=192.168.0.2&nm=255.255.255.0&gw=192.168.0.1dns=192.168.0.1&dhcp=1
+
  Ex.: http://admin:secret@192.168.0.2/?cmd=4&host=enc-2i2o-gude&ip=192.168.0.2&nm=255.255.255.0&gw=192.168.0.1dns=192.168.0.1&dhcp=1
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 4 || Kommando 4: Ipv4 Netzwerk Konfiguration
+
| cmd || 4 || Command 4: IPv4 network configuration
 
|-
 
|-
| host || Zeichenkette mit maximal 15 Zeichen || hostname (fqdn)
+
| host || Character string with maximum 15 characters || Host name (fqdn)
 
|-
 
|-
| ip || Zeichenkette mit maximal 15 Zeichen || IPv4 Adresse
+
| ip || Character string with maximum 15 characters || IPv4 address
 
|-
 
|-
| nm || Zeichenkette mit maximal 15 Zeichen || IPv4 Netzwerkmaske
+
| nm || Character string with maximum 15 characters || IPv4 network mask
 
|-
 
|-
| gw || Zeichenkette mit maximal 15 Zeichen || IPv4 Adresse eines externen Gateways
+
| gw || Character string with maximum 15 characters || IPv4 address of an external Gateway
 
|-
 
|-
| dns || Zeichenkette mit maximal 15 Zeichen || IPv4 Adresse eines externen DNS-Servers
+
| dns || Character string with maximum 15 characters || IPv4 address of an external DNS-server
 
|-
 
|-
| dhcp || [0, 1] || 0: DHCP ausgeschaltete<br>1: nach Gerätestart DHCP Anfrage starten
+
| dhcp || [0, 1] || 0: DHCP switched off<br>1: start DHCP request after device start
 
|}
 
|}
  
  
==Konfiguration: IP Filter (IP-ACL, IP Access Control List)==
+
==Configuration: IP filter (IP-ACL, IP Access Control List)==
  Bsp: http://admin:geheim@192.168.0.2/?cmd=6&ping=1&acl=1&ipsec0=192.168.1.0%2F24&ipsec1=&ipsec2=&ipsec3=&ipsec4=&ipsec5=&ipsec6=&ipsec7=
+
  Ex.: http://admin:secret@192.168.0.2/?cmd=6&ping=1&acl=1&ipsec0=192.168.1.0%2F24&ipsec1=&ipsec2=&ipsec3=&ipsec4=&ipsec5=&ipsec6=&ipsec7=
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 6 || Kommando 6: IP-ACL konfigurieren
+
| cmd || 6 || Command 6: configure IP-ACL
 
|-
 
|-
| ping || [0, 1] || 0: nicht auf ''ICMP Echo-Request'' Anfragen antworten<br>1: auf ''ICMP Echo-Request'' Anfragen mit ''ICMP Echo-Reply'' antworten
+
| ping || [0, 1] || 0: don’t answer on ICMP Echo-Request<br>1: answer on ICMP Echo-Requests with ICMP Echo-Reply
 
|-
 
|-
| acl || [0, 1] || 0: IP-Filter deaktivieren, der IPv4 Zugriff wird nicht eingeschränkt <br>1: IP-Filter aktivieren, nur Geräte oder Netzwerke genannt in ipsec0 bis ipsec7 haben IPv4 Zugriff
+
| acl || [0, 1] || 0: deactivate IP filter, IPv4 access won’t be restricted<br>1: activate IP filter, just devices or networks mentioned in ipsec0 till ipsec7 have IPv4 access
 
|-
 
|-
| ipsec0 || Zeichenkette mit maximal 18 Zeichen || Host- bzw. Netzwerk-Adresse dem der IPv4 Zugriff bei eingeschaltetem IP-Filter gewährt werden soll (CIDR Schreibweise, z.B. 10.0.0.0/24)
+
| ipsec0 || Character string with maximum 18 characters || Host- or Network address which should have IPv4 access when IP filter is switched on (CIDR spelling, e.g. 10.0.0.0/24)  
 
|-
 
|-
| ipsec1 .. ipsec7 || wie ipsec0 || wie ipsec0
+
| ipsec1 .. ipsec7 || like ipsec0 || like ipsec0
 
|}
 
|}
  
  
 
==Konfiguration: HTTP==
 
==Konfiguration: HTTP==
  Bsp: http://admin:geheim@192.168.0.2/cmd=18&apwd=admin&upwd=user&port=80&pwd=1&refr=1&sprp=0
+
  Bsp: http://admin:secret@192.168.0.2/cmd=18&apwd=admin&upwd=user&port=80&pwd=1&refr=1&sprp=0
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 18 || Kommando 18: HTTP konfigurieren
+
| cmd || 18 || Command 18: configure HTTP
 
|-
 
|-
| pwd || [0, 1] || 0: HTTP Authentifizierung ausschalten<br>1: HTTP Authentifizierung (HTTP Auth-Basic), Passwörter für 'user' bzw 'admin' werden erforderlich
+
| pwd || [0, 1] || 0: Switch off HTTP authentication <br>1: HTTP athentication (HTTP Auth-Basic), passwords for 'user' or 'admin' are necessary
 
|-
 
|-
| apwd || Zeichenkette mit maximal 15 Zeichen || Passwort des Benutzers 'admin'
+
| apwd || Character string with maximum 15 characters  || Password of the user 'admin'
 
|-
 
|-
| upwd || Zeichenkette mit maximal 15 Zeichen || Passwort des Benutzers 'user'
+
| upwd || Character string with maximum 15 characters  || Password of the user 'user'
 
|-
 
|-
 
| port || [1..65535] || HTTP Server Port
 
| port || [1..65535] || HTTP Server Port
 
|-
 
|-
| refr || [0,1] || HTTP Auto Refresh (automatisches Aktualisieren der Status Information im Web-Browser)<br>0: Autorefresh ausgeschaltet, 1: Autorefresh eingeschaltet
+
| refr || [0,1] || HTTP Auto Refresh (automatic refresh of status information in the web browser)<br>0: Autorefresh switched off, 1: Autorefresh switched on
 
|-
 
|-
| sprp || [0,1] || 0=keine Benutzer-Authentifizierung verlangen für ov.html<br>1=Benutzer Authentifizierung verlangen für ov.html (start-page-requires-password)
+
| sprp || [0,1] || 0=don't demand user authentication for ov.html<br>1=demand user authentication for ov.html (start-page-requires-password)
 
|}
 
|}
  
 
+
==Configuration: SNMP==
==Konfiguration: SNMP==
+
Ex.: http://192.168.0.2/cmd=8&get=1&set=1&trap=1&cpub=public&cpriv=private&trapv=2&tr0=192.168.0.100&tr1=&tr2=&tr3=&tr4=&tr5=&tr6=&tr7=
Bsp: http://192.168.0.2/cmd=8&get=1&set=1&trap=1&cpub=public&cpriv=private&trapv=2&tr0=192.168.0.100&tr1=&tr2=&tr3=&tr4=&tr5=&tr6=&tr7=
 
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 8 || Kommando 8: SNMP konfigurieren
+
| cmd || 8 || Command 8: configure SNMP
 
|-
 
|-
| get || [0, 1] || 0: keine SNMP-Get Anfragen beantworten<br>1: SNMP-Get Anfragen bei gültiger public-community beantworten
+
| get || [0, 1] || 0: don’t answer SNMP-Get requests<br>1: answer SNMP-Get requests at valid public-community
 
|-
 
|-
| set || [0, 1] || 0: keine SNMP-Set Anfragen beantworten<br>1: SNMP-Set Anfragen bei gültiger private-community beantworten
+
| set || [0, 1] || 0: don’t answer SNMP-Set requests<br>1: answer SNMP-Set requests at valid public-community
 
|-
 
|-
| trap || [0, 1] || 0: keine SNMP-traps verschicken<br>1: SNMP-traps verschicken
+
| trap || [0, 1] || 0: don’t send SNMP-traps<br>1: send SNMP-traps  
 
|-
 
|-
| trapv || [1,2] || 1: versende SNMP-v1 traps<br>2: versende SNMP-v2 traps
+
| trapv || [1,2] || 1: send SNMP-v1 traps<br>2: send SNMP-v2 traps
 
|-
 
|-
| cpub || Zeichenkette mit maximal 15 Zeichen || Name der public SNMP-Community
+
| cpub || Character string with maximum 15 characters || Name of the public SNMP-Community
 
|-
 
|-
| cpriv || Zeichenkette mit maximal 15 Zeichen || Name der private SNMP-Community
+
| cpriv || Character string with maximum 15 characters || Name of the private SNMP-Community
 
|-
 
|-
| tr0 || Zeichenkette mit maximal 100 Zeichen || IPv4 Adresse oder FQDN des externen ''SNMP-trap-receivers'', ggf. mit alternativer Portangabe, z.B. nagios.mydomain.de:10161
+
| tr0 || Character string with maximum 100 characters || IPv4 address or FQDN of the external SNMP-trap-receiver, possibly with alternate Port declaration, e.g. nagio.mydomain.de:10161
 
|-
 
|-
| tr1 .. tr7 || wie tr0 || wie tr0
+
| tr1 .. tr7 || like tr0 || like tr0
 
|}
 
|}
  
  
==Konfiguration: Syslog==
+
==Configuration: Syslog==
  Bsp: http://admin:geheim@192.168.0.2/?cmd=17&syslog=1&slgsrv=192.168.0.100
+
  Ex.: http://admin:secret@192.168.0.2/?cmd=17&syslog=1&slgsrv=192.168.0.100
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 17 || Kommando 17: Syslog konfigurieren
+
| cmd || 17 || Command 17: configure Syslog
 
|-
 
|-
| syslog || [0, 1] || 0: syslog ausgeschaltet<br>1: versende syslog nachrichten
+
| syslog || [0, 1] || 0: syslog switched off<br>1: send syslog messages
 
|-
 
|-
| slgsrv || Zeichenkette mit maximal 100 Zeichen || IPv4 Adresse oder FQDN des externen syslog Servers, ggf. mit alternativer Portangabe, z.B. nagios.mydomain.de:10514
+
| slgsrv || Character string with maximum 100 characters || IPv4 address or FQDN of the external syslog server, possibly with alternate port declaration, e.g. Nagios.mydomain.de:10514
 
|}
 
|}
  
  
==Konfiguration E-Mail==
+
==Configuration E-Mail==
  Bsp: http://admin:geheim@192.168.0.2/?cmd=15&mail=1&auth=0&mailsrv=mx.mydomain.de&sender=epc%40mydomain.de&email=user%40mydomain.de
+
  Ex.: http://admin:secret@192.168.0.2/?cmd=15&mail=1&auth=0&mailsrv=mx.mydomain.de&sender=epc%40mydomain.de&email=user%40mydomain.de
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! CGI Parameter !! gültige Werte !! Beschreibung
+
! CGI Parameter !! Valid values !! Description
 
|-
 
|-
| cmd || 15 || Kommando 15: E-Mail konfigurieren
+
| cmd || 15 || Command 15: configure E-Mail
 
|-
 
|-
| mail || [0, 1] || 0: E-Mail Benachrichtigungen deaktiviert<br>1: E-Mail Benachrichtigungen aktiviert
+
| mail || [0, 1] || 0: E-Mail notifications deactivated<br>1: E-Mail notifications activated
 
|-
 
|-
| auth || [0, 1] || 0: mit E-Mail Server ohne SMTP-Authentifizierung verbinden<br>1: E-Mail Server SMTP-Authentifizierung (PLAIN) verbinden
+
| auth || [0, 1] || 0: connect to E-Mail server without SMTP authentication<br>1: connect to E-Mail server with SMTP authentication (PLAIN)
 
|-
 
|-
| mailsrv || Zeichenkette mit maximal 100 Zeichen || IPv4 Adresse oder FQDN des externen SMTP Servers, ggf. mit alternativer Portangabe, z.B. mymx.mydomain.de:10125
+
| mailsrv || Character string with maximum 100 characters || IPv4 address or FQDN of the external SMTP server, possibly with alternate port declaration, e.g. mymx.domain.de:10125
 
|-
 
|-
| sender || Zeichenkette mit maximal 100 Zeichen || Sender (From) Adresse
+
| sender || Character string with maximum 100 characters || Transmitter (From) address
 
|-
 
|-
| email || Zeichenkette mit maximal 100 Zeichen || Empfänger (To) Adresse
+
| email || Character string with maximum 100 characters || Receiver (To) address
 
|}
 
|}
  
 +
=JSON Data=
  
=JSON Daten=
+
All dynamic data of the EPC can be requested as '''JSON''' formatted data via HTTP.
  
Alle dynamischen Daten des EPCs können als '''JSON''' Formatierte Daten per HTTP abgefragt werden.
+
''Advice:'' http://json.org/
  
''Hinweis:'' http://json.org/
+
Variable datas are divided into two categories.
  
Variable Daten werden in in zwei Kategorien eingeteilt.
+
* Status values
 +
** available in JSON format with statusjsn.js
 +
** available for ''user'' and ''admin''
  
* Status Werte
+
* Configuration values
** verfügbar im JSON-Format mit statusjsn.js
+
** available  in JSON format with cfgjsn.js
** verfügbar für ''user'' und ''admin''
+
** available for ''admin''
  
* Konfigurations Werte
 
** verfügbar im JSON-Format mit cfgjsn.js
 
** verfügbar für ''admin''
 
  
 +
When JSON datas are requested, you have to decide which parts of the datas should be transmitted. This happens with the CGI Parameter ''components''.
  
Beim Anfragen der JSON Daten muss jeweils von Ihnen entschieden werden welche Teile der Daten übertragen werden sollen. Dies geschieht mit dem CGI Paramater ''components''.
+
''components'' has to be transmitted as decimal CGI parameter, by setting single bits you determine which parts of the dynamic datas you need.
  
''components'' muss als dezimaler CGI Parameter übertragen werden, durch setzen einzelner Bits bestimmen Sie welche Teile der dynamischen Daten Sie benötigen.
+
* Examples:
 
+
** o You want to receive the status of the outputs (set Bit-0, see below)
 
+
*** wget "http://admin:secret@192.168.0.2/statusjsn.js?components=1"
* Beispiele:
+
** o You want to receive the status of the inputs (set Bit-1, see below)
** Sie möchten den Status der Ausgänge erhalten (setzen Sie Bit-0, siehe unten)
+
*** wget "http://admin:secret@192.168.0.2/statusjsn.js?components=2"
*** wget "http://admin:geheim@192.168.0.2/statusjsn.js?components=1"
+
** o You want to receive the status of the outputs and the inputs together (set Bit-0 and Bit-1, see below)
** Sie möchten den Status der Eingänge erhalten (setzen Sie Bit-1, siehe unten)
+
*** wget "http://admin:secret@192.168.0.2/statusjsn.js?components=3"
*** wget "http://admin:geheim@192.168.0.2/statusjsn.js?components=2"
+
** o You want to receive '''all''' status information
** Sie möchten den Status der Ausgänge und Eingänge zusammen erhalten  (setzen Sie Bit-0 und Bit-1, siehe unten)
+
*** wget "http://admin:secret@192.168.0.2/statusjsn.js?components=1073741823"
*** wget "http://admin:geheim@192.168.0.2/statusjsn.js?components=3"
+
*** ''Advice'': 1073741823 conforms 0x3fffffff
** Sie möchten '''alle''' Status Informationen erhalten
 
*** wget "http://admin:geheim@192.168.0.2/statusjsn.js?components=1073741823"
 
*** ''Hinweis'': 1073741823 entspricht 0x3fffffff
 
  
 
* '''status.html'''
 
* '''status.html'''
** Ein weiteres Beispiel gibt status.html
+
** One additional example gives status.html
** Diese holt sich alle Status- und alle Konfigurations-Werte per HTTP-GET-Request, und stellt diese nach Erhalt hierarchisch im Browser da.
+
** This one gets all status and all configuration values via HTTP-GET-Request and depicts these hierarchically in the browser after receiving.
  
  
==Status Werte aus statusjsn.js==
+
==Status values from statusjsn.js==
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! JSON Object Name !! compontents<br />(dezimal) !! compontents<br />(hexadezimal) !! Beschreibung
+
! JSON object name !! Components<br />(decimal) !! Compontents<br />(hexadecimal) !! Description
 
|-
 
|-
|outputs||1||0x00000001||Status Ausgänge
+
|outputs||1||0x00000001||Output status
 
|-
 
|-
|inputs||2||0x00000002||Status interne Eingänge
+
|inputs||2||0x00000002||Internal inputs status
 
|-
 
|-
|dns_cache||4||0x00000004||Inhalt des aktuellen DNS Caches
+
|dns_cache||4||0x00000004||Content of the actual DNS cache
 
|-
 
|-
|ethernet||8||0x00000008||Ethernet Status/Zähler
+
|ethernet||8||0x00000008||Ethernet status / counter
 
|-
 
|-
|misc||16||0x00000010||Diverses Status infos (Firmwave Version, Bootloader Version, etc)
+
|misc||16||0x00000010||Miscellaneous status info (Firmware version, Bootloader version, etc.)
 
|-
 
|-
|events||128||0x00000080||Zähler von Message-Events
+
|events||128||0x00000080||Message-events counter
 
|-
 
|-
|port_summary||256||0x00000100||zusammenfassende Status Informationen von Aus- und Eingängen
+
|port_summary||256||0x00000100||Summarized status information of the outputs and inputs
 
|-
 
|-
|hardware||512||0x00000200||zusammenfassende Status Informationen zur Hardware im allgemeinen
+
|hardware||512||0x00000200||Summarized status information of the general hardware
 
|-
 
|-
|gsm_status||1024||0x00000400||Status informationen bei GSM produkten
+
|gsm_status||1024||0x00000400||Status information for GSM products
 
|-
 
|-
|gsm_log||2048||0x00000800||Anruf-log bei GSM produkten
+
|gsm_log||2048||0x00000800||Call-log for GSM products
 
|-
 
|-
|gsm_counters||4096||0x00001000||zusammenfassende Status Informationen bei GSM produkten
+
|gsm_counters||4096||0x00001000||Summarized status information for GSM products
 
|-
 
|-
|sim||8192||0x00002000||Zustand der SIM Karte bei GSM produkten
+
|sim||8192||0x00002000||Sim card status for GSM products
 
|-
 
|-
|sensor_values||16384||0x00004000||Aktuelle Werte der vorhandenen Sensoren (Temperatur, etc)
+
|sensor_values||16384||0x00004000||Actual values of available sensors (temperature, etc.)
 
|-
 
|-
|sensor_descr||65536||0x00010000||Feld-Beschreibung der aktuell vorhandenen Sensoren (Temperatur, etc)
+
|sensor_descr||65536||0x00010000||Field description of the actual available sensors (temperature, etc.)
 
|-
 
|-
 
|}
 
|}
Zeile 334: Zeile 332:
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! Variable !! Datentyp !! Beschreibung !! mögliche Werte
+
! Variable !! Data type !! Description !! Possible values
 
|-
 
|-
| status['outputs'] || array || array mit N Elementen, N=Anzal der Outputs ||
+
| status['outputs'] || array || Array with N elements, N=number of outputs ||
 
|-
 
|-
| status['outputs'][n] || object || zusammenstellen der Status Informationen pro Output ||
+
| status['outputs'][n] || object || Compilation of status information per output ||
 
|-
 
|-
| status['outputs'][n].name || String || Name des Outputs || z.B. "Power Port 1"
+
| status['outputs'][n].name || String || Output name || E.g. “Power Port 1”
 
|-
 
|-
| status['outputs'][n].state || Number || Schaltzustand || 0=ausgeschaltet, 1=eingeschaltet
+
| status['outputs'][n].state || Number || Switching status || 0=switched off<br>1=switched on
 
|-
 
|-
| status['outputs'][n].type || Number || Output Typ || 0=Powerport, 1=GPIO output
+
| status['outputs'][n].type || Number || Output type || 0=Powerport1<br>1=GPIO output
 
|-
 
|-
| status['outputs'][n].batch || array || batch[0]: gesamte Wartezeit in s<br />batch[1]: verbleibende Wartezeit in s<br /> batch[2]: Schaltsequenz (binary)<br />batch[3]: gesamte Anzahl der Schaltkommandos<br />batch[4]: Nummer des aktuellen<br />batch[5]: Grund des Batchmodes ||
+
| status['outputs'][n].batch || array || batch[0]: total waiting time in seconds<br />batch[1]: remaining waiting time in seconds<br />batch[2]: switching sequence (binary)<br />batch[3]: total number of switching commands<br />batch[4]: number of the current<br />batch[5]: reason of Batch mode ||
 
|}
 
|}
  
  
Bsp:
+
Ex.:
 
  "outputs": [
 
  "outputs": [
 
   {
 
   {
Zeile 364: Zeile 362:
 
  ]
 
  ]
  
==Konfigurations Werte aus cfgjsn.js==
+
==Configuration values from cfgjsn.js==
 
{| border="1" cellpadding=3 cellspacing=0
 
{| border="1" cellpadding=3 cellspacing=0
 
|- bgcolor="#f9f9f9"
 
|- bgcolor="#f9f9f9"
! JSON Object Name !! compontents<br />(dezimal) !! compontents<br />(hexadezimal) !! Beschreibung
+
! JSON object name !! Components<br />(decimal) !! Compontents<br />(hexadecimal) !! Description
 
|-
 
|-
|mail||2||0x00000002||Mail Client/Server Konfiguration
+
|mail||2||0x00000002||Mail client/server configuration
 
|-
 
|-
|http||4||0x00000004||HTTP Server Konfiguration
+
|http||4||0x00000004||HTTP server configuration
 
|-
 
|-
|messages||32||0x00000020||Konfigration welche Sensoren/Messeinheiten Nachrichten versenden
+
|messages||32||0x00000020||Configuration of which sensors/measurement modules send messages
 
|-
 
|-
|syslog||64||0x00000040||Syslog Konfiguration
+
|syslog||64||0x00000040||Syslog configuration
 
|-
 
|-
|port_cfg||128||0x00000080||Konfiguration Ausgänge (Powerports)
+
|port_cfg||128||0x00000080||Outputs configuration (Power ports)
 
|-
 
|-
|ipv4||256||0x00000100||IP Konfigration (IP Adresse, Netzwerkmaske, etc)
+
|ipv4||256||0x00000100||IP configuration (IP address, network mask, etc.)
 
|-
 
|-
|ipacl||512||0x00000200||Konfiguration der IP-ACL (Filter Liste)
+
|ipacl||512||0x00000200||IP-ACL configuration (filter list)
 
|-
 
|-
|beeper||1024||0x00000400||Konfiguration des u.U. integrierten Beeper (Alarmgebers)
+
|beeper||1024||0x00000400||Possibly integrated beeper (alarm transmitter) configuration
 
|-
 
|-
|snmp||2048||0x00000800||SNMP Konfiguration
+
|snmp||2048||0x00000800||SNMP configuration
 
|-
 
|-
|input_cfg||4096||0x00001000||Input Konfiguration
+
|input_cfg||4096||0x00001000||Input configuration
 
|-
 
|-
|gsm_codes||8192||0x00002000||Konfiguration des GSM Codes (bei Produkten mit GSM)
+
|gsm_codes||8192||0x00002000||GSM code configuration (for products with GSM)
 
|-
 
|-
|gsm_numbers||16384||0x00004000||Konfiguration einiger spezieller GSM Telefonnummern (bei Produkten mit GSM)
+
|gsm_numbers||16384||0x00004000||Configuration of some special GSM phone numbers (for products with GSM)  
 
|-
 
|-
|gsm_phonebook||32768||0x00008000||Konfiguration einer GSM Telefonnummern-liste (bei Produkten mit GSM)
+
|gsm_phonebook||32768||0x00008000||Configuration of a GSM phone number list (for products with GSM)
 
|-
 
|-
|gsm_flags||65536||0x00010000||Konfiguration einzelner GSM Features (bei Produkten mit GSM)
+
|gsm_flags||65536||0x00010000||Individual GSM features configuration (for products with GSM)
 
|-
 
|-
|gsm_provider||131072||0x00020000||Konfiguration der GSM Provider spezifischen Nummern (bei Produkten mit GSM)
+
|gsm_provider||131072||0x00020000||Configuration of GSM provider specific numbers  (for products with GSM)
 
|-
 
|-
 
|}
 
|}
  
 +
=Easy code examples=
 +
The following examples switch on the first output each and show the switching status of all outputs.
  
=Einfache Code Beispiele=
+
The examples use a combination of:
Die folgenden Beispiele schalten jeweils den ersten Output ein, und geben den Schaltzustand aller Outputs aus.
+
* transferring of one HTTP GET Request with CGI data (here: output-1 switch on)
 +
* the subsequent output of status information (JSON parse) (here: output of names and switching status of all outputs)
  
Die Beispiele verwenden eine Kombination aus:
+
If your development environment has methods of sending HTTP-GET Requests and methods of parsing JSON-data, you can accordingly implement the mentioned examples below.
* dem Übermitteln eines HTTP GET Request mit CGI Daten (hier: Ausgang-1 einschalten)
 
* der anschließenden Ausgabe von Status Informationen (JSON parse) (hier: Ausgabe der Namen und Schaltzustände aller Ausgänge)
 
  
Verfügt Ihre Entwicklungsumgebung Methoden zum Versenden von HTTP-GET-Requests, und Methoden zum Parsen von JSON-Daten, so können Sie die unten angegebenen Beispiele entsprechend umsetzen.
+
==Perl Example==
 
 
==Perl Beispiel==
 
 
  #!/usr/bin/perl
 
  #!/usr/bin/perl
 
  use LWP::UserAgent;
 
  use LWP::UserAgent;
Zeile 429: Zeile 426:
  
  
==PHP Beispiel==
+
==PHP Example==
 
  <?php
 
  <?php
 
   $data = file_get_contents('http://192.168.0.2/statusjsn.js?components=1&cmd=1&p=1&s=1');
 
   $data = file_get_contents('http://192.168.0.2/statusjsn.js?components=1&cmd=1&p=1&s=1');
Zeile 440: Zeile 437:
 
  ?>
 
  ?>
  
==C++/Qt Beispiel==
+
==C++/Qt Example==
 
*main.cpp
 
*main.cpp
 
  #include <QApplication>
 
  #include <QApplication>
Zeile 510: Zeile 507:
 
  };
 
  };
  
 
+
=Advanced code examples=
=Erweitere Code Beispiele=
+
== Measurement values and sensors ==
== Messwerte und Sensoren ==
 
 
* [http://www.gude.info/temp/http_sensor_value.zip http_sensor_value.pl]:
 
* [http://www.gude.info/temp/http_sensor_value.zip http_sensor_value.pl]:
** verwendet eine Kombination aus 'sensor_descr' und  'sensor_values' um eine Liste aller Sensorwerte auf der Konsole auszugeben
+
** uses combination from 'sensor_descr' and 'sensor_values' to output a list of all sensor values on the console
  
  
=HTTP Authentifizierung=
+
=HTTP authentication=
==Basic Authentication==
+
==Basic authentication==
* der HTTP-Server verlangt, bei eingeschaltetem HTTP-Passwortschutz, HTTP-GET-Requests inklusive der sog. [http://de.wikipedia.org/wiki/HTTP-Authentifizierung#Basic_Authentication Basic Authentication Credentials]
+
* when HTTP-password protection is activated, the HTTP-server requires HTTP-GET-Requests incl. of the so-called [http://de.wikipedia.org/wiki/HTTP-Authentifizierung#Basic_Authentication Basic Authentication Credentials]
* fehlen bei eingeschaltetem HTTP-Passwortschutz die [http://de.wikipedia.org/wiki/HTTP-Authentifizierung#Basic_Authentication Basic Authentication Credentials], oder ist das darin übermittelte Passwort falsch, so Antwortet der HTTP Server mit dem HTTP Error Code 401 (Unauthorized)
+
* if the [http://de.wikipedia.org/wiki/HTTP-Authentifizierung#Basic_Authentication Basic Authentication Credentials]are missing when http-password protection is activated, or the transmitted password therein is incorrect, the HTTP server replies with the HTTP Error Code 401 (Unauthorized)
  
 
+
==Examples==
==Beispiele==
+
* assumed the password for the user named ''user'' would be ''secret''
* angenommen das Passwort für den Benutzer Namens ''user'' sei ''geheim''
+
* the Basic-Auth-Credentials in the HTTP Header have to be
* die Basic-Auth-Credentials im HTTP Header müssen dann lauten
 
 
** Authorization:Basic dXNlcjpnZWhlaW0=
 
** Authorization:Basic dXNlcjpnZWhlaW0=
** denn die Zeichenkette ''user:geheim'' lautet in der [http://de.wikipedia.org/wiki/Base64 Base64] Schreibweise: ''dXNlcjpnZWhlaW0=''
+
** because the character string ''user:secret'' is ''dXNlcjpnZWhlaW0='' in [http://de.wikipedia.org/wiki/Base64 Base64] spelling
* ein kompletter GET-Request welcher den ersten Powerport einschaltet sieht demnach folgendermaßen aus:
+
* a complete GET-Request which switches on the first power port is as follows:
  
 
  GET /?cmd=1&p=1&s=1 HTTP/1.0
 
  GET /?cmd=1&p=1&s=1 HTTP/1.0
Zeile 534: Zeile 529:
 
   
 
   
  
*in hexadezimaler Schreibweise als Byte-Kette:
+
*in hexadecimal spelling as byte string:
 
  47 45 54 20 2f 3f 63 6d  64 3d 31 26 70 3d 31 26  |GET /?cmd=1&p=1&|
 
  47 45 54 20 2f 3f 63 6d  64 3d 31 26 70 3d 31 26  |GET /?cmd=1&p=1&|
 
  73 3d 31 20 48 54 54 50  2f 31 2e 30 0d 0a 41 75  |s=1 HTTP/1.0..Au|
 
  73 3d 31 20 48 54 54 50  2f 31 2e 30 0d 0a 41 75  |s=1 HTTP/1.0..Au|
Zeile 540: Zeile 535:
 
  63 20 64 58 4e 6c 63 6a  70 6e 5a 57 68 6c 61 57  |c dXNlcjpnZWhlaW|
 
  63 20 64 58 4e 6c 63 6a  70 6e 5a 57 68 6c 61 57  |c dXNlcjpnZWhlaW|
 
  30 3d 0d 0a 0d 0a                                |0=....|
 
  30 3d 0d 0a 0d 0a                                |0=....|
 
  
 
==wget==
 
==wget==
*[http://gnuwin32.sourceforge.net/packages/wget.htm wget] bietet die Möglichkeit eine HTTP-Client-Implementierung zu verwenden um derartige GET-Requests zu erzeugen, und eignet sich damit besonders für script- bzw. maschienengesteuertes, automatisiertes schalten.
+
*[http://gnuwin32.sourceforge.net/packages/wget.htm wget] offers the opportunity to use HTTP client implementation to create such GET-Requests and is thereby especially suitable for script or machine controlled, automatic switching.
*Beispiele:
+
*Examples:
** verwende den Benutzer ''user'', und frage das Passwort ab:
+
** use the ''user'', and request the password:
 
*** wget "http://192.168.0.1/?cmd=1&p=1&s=1" --auth-no-challenge --user=user --ask-password
 
*** wget "http://192.168.0.1/?cmd=1&p=1&s=1" --auth-no-challenge --user=user --ask-password
** verwende den Benutzer ''user'' und das Password ''geheim''
+
** use the user''user'' and the Password ''secret''
*** wget "http://192.168.0.1/?cmd=1&p=1&s=1" --auth-no-challenge --user=user --password=geheim
+
*** wget "http://192.168.0.1/?cmd=1&p=1&s=1" --auth-no-challenge --user=user --password=secret
*** '''Hinweis''': eine Batch-Datei mit einem solchen wget-Einzeler lässt gut per Windows-Aufgabenplaner starten, um z.B. eine Zeitschaltuhr zu realisieren
+
*** '''Advice''': a batch file with such a wget one-liner can be easily started via Windows task scheduler to realize a time switch for example
** verwende den Benutzer ''user'' und das Password ''geheim''
+
** use the ''user'' and the password ''secret''
*** wget "http://user:geheim@192.168.0.1/?cmd=1&p=1&s=1" --auth-no-challenge
+
*** wget "http://user:secret@192.168.0.1/?cmd=1&p=1&s=1" --auth-no-challenge
 
 
  
==Schalten ohne HTTP Implementierung==
+
==Switching without HTTP implementation==
*steht Ihnen keine HTTP Implementierung zur Verfügung, z.B. beim Einsatz einer Mediensteuerung, so können sie dennoch per HTTP schalten indem Sie eine wie oben gezeigte Byte-Kette zum HTTP Port als ein einzelnes TCP-Paket versenden (idR. zu TCP Port 80)
+
*if you have no HTTP implementation on hand, when using a media control system for example, you can still switch via HTTP by sending a byte string (like above mentioned) to the HTTP port as an individual TCP package (usually to TCP Port 80).

Version vom 2. Dezember 2015, 17:18 Uhr

  • Below you will find a description of the HTTP application programming interface for the Expert Power Control series of the newer generation.
  • As interface, a combination between CGI and JSON via HTTP is described
  • If your device is equipped with the resource status.html, the following information can be used. If not, your device is unfortunately not compatible to this description.

Overview

  • The following section describes how you can send commands to the EPC via HTTP, and how to evaluate dynamic status or configuration values via HTTP.
    • For example, a command can be the instruction to the EPC to turn on an output or to save a configuration value.
    • With reports of status or configuration values the question is meant for example: “Is output number 1 switched on?” or “Is Syslog switched on?”


CGI GET Request

Commands to the EPC are sent as an HTTP-GET-request, the following you will find a list of commands and the respective required CGI parameters.

Output switching (easy switching command)

Ex.: http://user:secret@192.168.0.2/ov.html?cmd=1&p=1&s=1
CGI Parameter Valid values Description
cmd 1 Command 1: switching output
p [1,2, ... , N] Number of the Output (power port) to be switched
s [0,1] 0: Switch off, 1: Switch on


Output switching (switching in series, Batch mode)

Start Batch mode

Ex.: http://user:secret@192.168.0.2/?cmd=5&p=1&a1=0&a2=1&s=5
CGI Parameter Valid values Description
cmd 5 Command 5: Batch mode
p [1,2, ... , N] Number of the Output (power port) to be switched
a1 [0,1] Action number1:
0: Switch off, 1: Switch on
a2 [0,1] Action number2:
0: Switch off, 1: Switch on
s [1..65535] Waiting time in seconds between Action1 and Action2


Cancel Batch mode

Ex.: http://user:secret@192.168.0.2/?cmd=2&p=1
CGI Parameter Valid values Description
cmd 2 Command 2: cancel Batch mode
p [1,2, ... , N] Number of the output (power port) to be switched


Reset

Reset is a preconfigured Batch mode, which turns off and turns on again after a configurable time (see : Configuration: Outputs)

Ex.: http://user:secret@192.168.0.2/?cmd=12&p=2
CGI Parameter Valid values Description
cmd 12 Command 12: perform reset
p [1,2, ... , N] Number of the output (power port) on which a reset should be performed


Configuration: Outputs

Ex.: http://admin:secret@192.168.0.2/?cmd=3&p=1&name=Output+1&powup=0&powrem=0&idle=0&on_again=0&reset=0&we=0&wip=&wt=0&wport=80&wint=10&wret=6

CGI Parameter Valid values Description
cmd 3 Command 3: configure Output (Power port)
p [1,2, ... , N] Number of the output (power port) to be configured
name Character string with maximum 15 characters Output name
powup [0, 1]

0: leave output switched off after device start
1: Switch Output on after device start

powrem [0, 1] 0: don’t remember actual switching status for next device start
1: remember actual switching status for next device start
idle [0 .. N] Amount of waiting time in seconds after device start before switching on the output
0 = no idle time
on_again [0 .. N] Amount of waiting time in seconds after switching off one output before automatically switching back on,

0= no automatic switching back on

reset [1 .. N] Reset duration: duration of power-down phase in seconds by the reset command
we [0, 1] 0= Watchdog deactivated
1= Watchdog activated
wip Character string Hostname (FQDN) or IP-address of the host to be monitored
wt [0, 1] 0= Watchdog uses ICMP pings
1= Watchdog uses TCP handshakes
wport [1..65535] TCP port number if wt=1
wint [1..65535] Watchdog ping interval in seconds
wret [1..65535] Watchdog ping retry: amount of ping-signals which has to be unanswered to state the watchdog condition “host failed”


Configuration: Inputs

Ex.: http://admin:secret@192.168.0.2/?cmd=13&p=1&name=Input+1&hitext=closed&lowtext=open&inverted=1&msgt=0
CGI Parameter Valid values Description
cmd 13 Command 13: configure input
p [1,2, ... , N] Number of the input to be configured
name Character string with maximum 15 characters Input name
hitext Character string with maximum 15 characters Name of the logical-1 condition
lowtext Character string with maximum 15 characters Name of the logical-0 condition
inverted [0,1] Inverts the physical state of the input at inverted=1 . At inverted=0 applies: physical state = logical state
msgt [0,1] Generate messages: at msgt=1 messages will be generated (possibly Syslog, Mail and SNMP-trap) at input condition changes


Configuration: IPv4 Network

Ex.: http://admin:secret@192.168.0.2/?cmd=4&host=enc-2i2o-gude&ip=192.168.0.2&nm=255.255.255.0&gw=192.168.0.1dns=192.168.0.1&dhcp=1
CGI Parameter Valid values Description
cmd 4 Command 4: IPv4 network configuration
host Character string with maximum 15 characters Host name (fqdn)
ip Character string with maximum 15 characters IPv4 address
nm Character string with maximum 15 characters IPv4 network mask
gw Character string with maximum 15 characters IPv4 address of an external Gateway
dns Character string with maximum 15 characters IPv4 address of an external DNS-server
dhcp [0, 1] 0: DHCP switched off
1: start DHCP request after device start


Configuration: IP filter (IP-ACL, IP Access Control List)

Ex.: http://admin:secret@192.168.0.2/?cmd=6&ping=1&acl=1&ipsec0=192.168.1.0%2F24&ipsec1=&ipsec2=&ipsec3=&ipsec4=&ipsec5=&ipsec6=&ipsec7=
CGI Parameter Valid values Description
cmd 6 Command 6: configure IP-ACL
ping [0, 1] 0: don’t answer on ICMP Echo-Request
1: answer on ICMP Echo-Requests with ICMP Echo-Reply
acl [0, 1] 0: deactivate IP filter, IPv4 access won’t be restricted
1: activate IP filter, just devices or networks mentioned in ipsec0 till ipsec7 have IPv4 access
ipsec0 Character string with maximum 18 characters Host- or Network address which should have IPv4 access when IP filter is switched on (CIDR spelling, e.g. 10.0.0.0/24)
ipsec1 .. ipsec7 like ipsec0 like ipsec0


Konfiguration: HTTP

Bsp: http://admin:secret@192.168.0.2/cmd=18&apwd=admin&upwd=user&port=80&pwd=1&refr=1&sprp=0
CGI Parameter Valid values Description
cmd 18 Command 18: configure HTTP
pwd [0, 1] 0: Switch off HTTP authentication
1: HTTP athentication (HTTP Auth-Basic), passwords for 'user' or 'admin' are necessary
apwd Character string with maximum 15 characters Password of the user 'admin'
upwd Character string with maximum 15 characters Password of the user 'user'
port [1..65535] HTTP Server Port
refr [0,1] HTTP Auto Refresh (automatic refresh of status information in the web browser)
0: Autorefresh switched off, 1: Autorefresh switched on
sprp [0,1] 0=don't demand user authentication for ov.html
1=demand user authentication for ov.html (start-page-requires-password)

Configuration: SNMP

Ex.: http://192.168.0.2/cmd=8&get=1&set=1&trap=1&cpub=public&cpriv=private&trapv=2&tr0=192.168.0.100&tr1=&tr2=&tr3=&tr4=&tr5=&tr6=&tr7=

CGI Parameter Valid values Description
cmd 8 Command 8: configure SNMP
get [0, 1] 0: don’t answer SNMP-Get requests
1: answer SNMP-Get requests at valid public-community
set [0, 1] 0: don’t answer SNMP-Set requests
1: answer SNMP-Set requests at valid public-community
trap [0, 1] 0: don’t send SNMP-traps
1: send SNMP-traps
trapv [1,2] 1: send SNMP-v1 traps
2: send SNMP-v2 traps
cpub Character string with maximum 15 characters Name of the public SNMP-Community
cpriv Character string with maximum 15 characters Name of the private SNMP-Community
tr0 Character string with maximum 100 characters IPv4 address or FQDN of the external SNMP-trap-receiver, possibly with alternate Port declaration, e.g. nagio.mydomain.de:10161
tr1 .. tr7 like tr0 like tr0


Configuration: Syslog

Ex.: http://admin:secret@192.168.0.2/?cmd=17&syslog=1&slgsrv=192.168.0.100
CGI Parameter Valid values Description
cmd 17 Command 17: configure Syslog
syslog [0, 1] 0: syslog switched off
1: send syslog messages
slgsrv Character string with maximum 100 characters IPv4 address or FQDN of the external syslog server, possibly with alternate port declaration, e.g. Nagios.mydomain.de:10514


Configuration E-Mail

Ex.: http://admin:secret@192.168.0.2/?cmd=15&mail=1&auth=0&mailsrv=mx.mydomain.de&sender=epc%40mydomain.de&email=user%40mydomain.de
CGI Parameter Valid values Description
cmd 15 Command 15: configure E-Mail
mail [0, 1] 0: E-Mail notifications deactivated
1: E-Mail notifications activated
auth [0, 1] 0: connect to E-Mail server without SMTP authentication
1: connect to E-Mail server with SMTP authentication (PLAIN)
mailsrv Character string with maximum 100 characters IPv4 address or FQDN of the external SMTP server, possibly with alternate port declaration, e.g. mymx.domain.de:10125
sender Character string with maximum 100 characters Transmitter (From) address
email Character string with maximum 100 characters Receiver (To) address

JSON Data

All dynamic data of the EPC can be requested as JSON formatted data via HTTP.

Advice: http://json.org/

Variable datas are divided into two categories.

  • Status values
    • available in JSON format with statusjsn.js
    • available for user and admin
  • Configuration values
    • available in JSON format with cfgjsn.js
    • available for admin


When JSON datas are requested, you have to decide which parts of the datas should be transmitted. This happens with the CGI Parameter components.

components has to be transmitted as decimal CGI parameter, by setting single bits you determine which parts of the dynamic datas you need.

  • status.html
    • One additional example gives status.html
    • This one gets all status and all configuration values via HTTP-GET-Request and depicts these hierarchically in the browser after receiving.


Status values from statusjsn.js

JSON object name Components
(decimal)
Compontents
(hexadecimal)
Description
outputs 1 0x00000001 Output status
inputs 2 0x00000002 Internal inputs status
dns_cache 4 0x00000004 Content of the actual DNS cache
ethernet 8 0x00000008 Ethernet status / counter
misc 16 0x00000010 Miscellaneous status info (Firmware version, Bootloader version, etc.)
events 128 0x00000080 Message-events counter
port_summary 256 0x00000100 Summarized status information of the outputs and inputs
hardware 512 0x00000200 Summarized status information of the general hardware
gsm_status 1024 0x00000400 Status information for GSM products
gsm_log 2048 0x00000800 Call-log for GSM products
gsm_counters 4096 0x00001000 Summarized status information for GSM products
sim 8192 0x00002000 Sim card status for GSM products
sensor_values 16384 0x00004000 Actual values of available sensors (temperature, etc.)
sensor_descr 65536 0x00010000 Field description of the actual available sensors (temperature, etc.)


status 'outputs'

components = 1 (Bit-0)

Variable Data type Description Possible values
status['outputs'] array Array with N elements, N=number of outputs
status['outputs'][n] object Compilation of status information per output
status['outputs'][n].name String Output name E.g. “Power Port 1”
status['outputs'][n].state Number Switching status 0=switched off
1=switched on
status['outputs'][n].type Number Output type 0=Powerport1
1=GPIO output
status['outputs'][n].batch array batch[0]: total waiting time in seconds
batch[1]: remaining waiting time in seconds
batch[2]: switching sequence (binary)
batch[3]: total number of switching commands
batch[4]: number of the current
batch[5]: reason of Batch mode


Ex.:

"outputs": [
  {
    "name": "Power Port 1",
    "state": 1,
    "type": 1,
    "batch": [0, 0, 0, 0, 0],
    "wdog": [0, 2, "0.0.0.0"]
  },
  {
    [ ... ]
  }
]

Configuration values from cfgjsn.js

JSON object name Components
(decimal)
Compontents
(hexadecimal)
Description
mail 2 0x00000002 Mail client/server configuration
http 4 0x00000004 HTTP server configuration
messages 32 0x00000020 Configuration of which sensors/measurement modules send messages
syslog 64 0x00000040 Syslog configuration
port_cfg 128 0x00000080 Outputs configuration (Power ports)
ipv4 256 0x00000100 IP configuration (IP address, network mask, etc.)
ipacl 512 0x00000200 IP-ACL configuration (filter list)
beeper 1024 0x00000400 Possibly integrated beeper (alarm transmitter) configuration
snmp 2048 0x00000800 SNMP configuration
input_cfg 4096 0x00001000 Input configuration
gsm_codes 8192 0x00002000 GSM code configuration (for products with GSM)
gsm_numbers 16384 0x00004000 Configuration of some special GSM phone numbers (for products with GSM)
gsm_phonebook 32768 0x00008000 Configuration of a GSM phone number list (for products with GSM)
gsm_flags 65536 0x00010000 Individual GSM features configuration (for products with GSM)
gsm_provider 131072 0x00020000 Configuration of GSM provider specific numbers (for products with GSM)

Easy code examples

The following examples switch on the first output each and show the switching status of all outputs.

The examples use a combination of:

  • transferring of one HTTP GET Request with CGI data (here: output-1 switch on)
  • the subsequent output of status information (JSON parse) (here: output of names and switching status of all outputs)

If your development environment has methods of sending HTTP-GET Requests and methods of parsing JSON-data, you can accordingly implement the mentioned examples below.

Perl Example

#!/usr/bin/perl
use LWP::UserAgent;
use JSON;

$browser = LWP::UserAgent->new;
$response = $browser->get("http://192.168.0.2/statusjsn.js?components=1&cmd=1&p=1&s=1");

if ($response->is_success) {
  $json = decode_json($response->content);
  foreach my $output(@{$json->{outputs}}) {
    print $output->{name} . " is " . ($output->{state} ? "on" : "off") . "\n";
  }
}

download epccontrol3.pl for a more powerfull perl example


PHP Example

<?php
  $data = file_get_contents('http://192.168.0.2/statusjsn.js?components=1&cmd=1&p=1&s=1');
  if ($data) {
    $json = json_decode($data);
    foreach ($json->outputs as $output) {
      echo $output->name . ' is ' . ($output->state ? 'on' : 'off') . PHP_EOL;
    }
  }
?>

C++/Qt Example

  • main.cpp
#include <QApplication>
#include <QDebug>
#include <QtScript>
#include "main.h"  

QUrl url("http://192.168.0.2/statusjsn.js?components=1&cmd=1&p=1&s=1");

QEpcDemo::QEpcDemo() {
    connect(&manager, SIGNAL(finished(QNetworkReply*)),
            this, SLOT(httpReplyFinished(QNetworkReply*)));
}

void QEpcDemo::startGetRequest() {
    manager.get(QNetworkRequest(url));
}

void QEpcDemo::httpReplyFinished(QNetworkReply* reply) {
    int ret = 1;

    if (reply->error() == QNetworkReply::NoError) {
        QScriptEngine engine;
        QScriptValue sv = engine.evaluate("(" + QString(reply->readAll()) + ")");
        int i = sv.property("outputs").property("length").toInteger();
        QScriptValueIterator it(sv.property("outputs"));
        while ((i-- > 0) && it.hasNext()) {
            it.next();
            QString name(it.value().property("name").toString());
            int state = it.value().property("state").toInteger();
            qDebug() << QString("'%1' is %2")
                .arg(name)
                .arg(state ? QString("on") : QString("off"));
        }
        ret = 0;
    } else {
        qDebug()
            << "httpReplyFinished ERROR: "
            << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()
            << reply->error()
            << reply->errorString();
    }

    reply->deleteLater();
    QApplication::exit(ret);
}

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    QEpcDemo epcdemo;
    epcdemo.startGetRequest();
    return app.exec();
}
  • main.h
#include <QObject>
#include <QtNetwork>

class QEpcDemo : public QObject
{
    Q_OBJECT
public:
    QEpcDemo();
    void startGetRequest();
private:
    QNetworkAccessManager manager;
private slots:
    void httpReplyFinished(QNetworkReply*);
};

Advanced code examples

Measurement values and sensors

  • http_sensor_value.pl:
    • uses combination from 'sensor_descr' and 'sensor_values' to output a list of all sensor values on the console


HTTP authentication

Basic authentication

  • when HTTP-password protection is activated, the HTTP-server requires HTTP-GET-Requests incl. of the so-called Basic Authentication Credentials
  • if the Basic Authentication Credentialsare missing when http-password protection is activated, or the transmitted password therein is incorrect, the HTTP server replies with the HTTP Error Code 401 (Unauthorized)

Examples

  • assumed the password for the user named user would be secret
  • the Basic-Auth-Credentials in the HTTP Header have to be
    • Authorization:Basic dXNlcjpnZWhlaW0=
    • because the character string user:secret is dXNlcjpnZWhlaW0= in Base64 spelling
  • a complete GET-Request which switches on the first power port is as follows:
GET /?cmd=1&p=1&s=1 HTTP/1.0
Authorization:Basic dXNlcjpnZWhlaW0=

  • in hexadecimal spelling as byte string:
47 45 54 20 2f 3f 63 6d  64 3d 31 26 70 3d 31 26  |GET /?cmd=1&p=1&|
73 3d 31 20 48 54 54 50  2f 31 2e 30 0d 0a 41 75  |s=1 HTTP/1.0..Au|
74 68 6f 72 69 7a 61 74  69 6f 6e 3a 42 61 73 69  |thorization:Basi|
63 20 64 58 4e 6c 63 6a  70 6e 5a 57 68 6c 61 57  |c dXNlcjpnZWhlaW|
30 3d 0d 0a 0d 0a                                 |0=....|

wget

  • wget offers the opportunity to use HTTP client implementation to create such GET-Requests and is thereby especially suitable for script or machine controlled, automatic switching.
  • Examples:

Switching without HTTP implementation

  • if you have no HTTP implementation on hand, when using a media control system for example, you can still switch via HTTP by sending a byte string (like above mentioned) to the HTTP port as an individual TCP package (usually to TCP Port 80).