diff --git a/examples/19-WebLog/DEV_LED.h b/examples/19-WebLog/DEV_LED.h
index 0dbe012..07c7552 100644
--- a/examples/19-WebLog/DEV_LED.h
+++ b/examples/19-WebLog/DEV_LED.h
@@ -18,6 +18,7 @@ struct DEV_LED : Service::LightBulb { // First we create a derived
power=new Characteristic::On(); // this is where we create the On Characterstic we had previously defined in setup(). Save this in the pointer created above, for use below
this->ledPin=ledPin; // don't forget to store ledPin...
pinMode(ledPin,OUTPUT); // ...and set the mode for ledPin to be an OUTPUT (standard Arduino function)
+ WEBLOG("Configuring LED on Pin %d",ledPin);
} // end constructor
@@ -26,7 +27,7 @@ struct DEV_LED : Service::LightBulb { // First we create a derived
boolean update(){
digitalWrite(ledPin,power->getNewVal()); // use a standard Arduino function to turn on/off ledPin based on the return of a call to power->getNewVal() (see below for more info)
- WEBLOG("LED on Pin %d: %s (%s)",ledPin,power->getNewVal()?"ON":"OFF",homeSpan.getClientIP());
+ WEBLOG("LED on Pin %d: %s",ledPin,power->getNewVal()?"ON":"OFF");
return(true); // return true to indicate the update was successful (otherwise create code to return false if some reason you could not turn on the LED)
diff --git a/src/HAP.cpp b/src/HAP.cpp
index fe5482f..dd8eb19 100644
--- a/src/HAP.cpp
+++ b/src/HAP.cpp
@@ -1297,7 +1297,7 @@ int HAPClient::getStatusURL(){
response+="
";
if(homeSpan.webLog.maxEntries>0){
- response+="| Entry | Up Time | Log Time | Message |
\n";
+ response+="| Entry | Up Time | Log Time | Client | Message |
\n";
int lastIndex=homeSpan.webLog.nEntries-homeSpan.webLog.maxEntries;
if(lastIndex<0)
lastIndex=0;
@@ -1316,7 +1316,7 @@ int HAPClient::getStatusURL(){
else
sprintf(clocktime,"Unknown");
- response+="| " + String(i+1) + " | " + String(uptime) + " | " + String(clocktime) + " | " + String(homeSpan.webLog.log[index].message) + " | \n";
+ response+="
| " + String(i+1) + " | " + String(uptime) + " | " + String(clocktime) + " | " + homeSpan.webLog.log[index].clientIP + " | " + String(homeSpan.webLog.log[index].message) + " | \n";
}
response+="
\n";
}
diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp
index 1e768fe..6ce1b1c 100644
--- a/src/HomeSpan.cpp
+++ b/src/HomeSpan.cpp
@@ -1979,6 +1979,7 @@ void SpanWebLog::addLog(const char *fmt, ...){
va_start(ap,fmt);
vasprintf(&log[index].message,fmt,ap);
va_end(ap);
-
+
+ log[index].clientIP=homeSpan.lastClientIP;
nEntries++;
}
diff --git a/src/HomeSpan.h b/src/HomeSpan.h
index d115498..e7d9469 100644
--- a/src/HomeSpan.h
+++ b/src/HomeSpan.h
@@ -110,6 +110,7 @@ struct SpanWebLog{ // optional web status/log data
uint64_t upTime; // number of seconds since booting
struct tm clockTime; // clock time
char *message; // pointers to log entries of arbitrary size
+ String clientIP; // IP address of client making request (or "0.0.0.0" if not applicable)
} *log=NULL; // array of log entries
void init(uint16_t maxEntries, const char *serv, const char *tz, const char *url);
@@ -221,7 +222,6 @@ struct Span{
void setApFunction(void (*f)()){apFunction=f;} // sets an optional user-defined function to call when activating the WiFi Access Point
void enableAutoStartAP(){autoStartAPEnabled=true;} // enables auto start-up of Access Point when WiFi Credentials not found
void setWifiCredentials(const char *ssid, const char *pwd); // sets WiFi Credentials
- const char *getClientIP(){return(lastClientIP.c_str());} // get IP address of last client to send an encrypted request - to be used only in update() commands
void setPairingCode(const char *s){sprintf(pairingCodeCommand,"S %9s",s);} // sets the Pairing Code - use is NOT recommended. Use 'S' from CLI instead
void deleteStoredValues(){processSerialCommand("V");} // deletes stored Characteristic values from NVS