diff --git a/SCRIPTING.md b/SCRIPTING.md
index a38298f..fd8285d 100644
--- a/SCRIPTING.md
+++ b/SCRIPTING.md
@@ -30,7 +30,7 @@ In general, scripts conform to the following BNF:
                 <statement> <statement>
 
 <event> ::= init |
-            wificonnect |
+            wificonnect | wifidisconnect |
 	    mqttconnect |
             timer <num> |
             alarm <num> |
@@ -92,9 +92,9 @@ init
 This event happens once after restart of the script. All "config" parameters are applied, but typically WiFi is not yet up and no external nodes are connected. This is typically the clause where the initalization of variables and timers as well as subscriptions to topics on the local broker take place.
 
 ```
-wificonnect
+wificonnect | wifidisconnect
 ```
-This event happens each time, the esp_uMQTT_broker (re-)connects as client to the WiFi and has received an IP address.
+This event happens each time, the esp_uMQTT_broker (re-)connects as client to the WiFi and has received an IP address, resp. if it disconnects (tyically due to link loss).
 
 ```
 mqttconnect
diff --git a/firmware/0x00000.bin b/firmware/0x00000.bin
index d90f18d..307d6ec 100644
Binary files a/firmware/0x00000.bin and b/firmware/0x00000.bin differ
diff --git a/firmware/0x10000.bin b/firmware/0x10000.bin
index 3b6c689..54d380d 100644
Binary files a/firmware/0x10000.bin and b/firmware/0x10000.bin differ
diff --git a/firmware/sha1sums b/firmware/sha1sums
index 9c9f835..a2bb9e1 100644
--- a/firmware/sha1sums
+++ b/firmware/sha1sums
@@ -1,2 +1,2 @@
-006758f605dad0af543519127a32d340648d0429  0x00000.bin
-743f4b2d6048740d41be990bcef8c6cab8aee749  0x10000.bin
+98ff2105dd36027e691991d4871d4ee0bb8bfdf8  0x00000.bin
+bdedac73a8ac9b70a476213c10993d7b0f2de653  0x10000.bin
diff --git a/user/lang.c b/user/lang.c
index 74d46ca..0fdc373 100644
--- a/user/lang.c
+++ b/user/lang.c
@@ -533,6 +533,15 @@ int ICACHE_FLASH_ATTR parse_event(int next_token, bool * happend) {
 	return next_token + 1;
     }
 
+    if (is_token(next_token, "wifidisconnect")) {
+	lang_debug("event wifidisconnect\r\n");
+
+	*happend = (interpreter_status == WIFI_DISCONNECT);
+	if (*happend)
+	    lang_log("on wifidisconnect\r\n");
+	return next_token + 1;
+    }
+
     if (is_token(next_token, "topic")) {
 	char *topic;
 	int topic_len;
@@ -646,7 +655,7 @@ int ICACHE_FLASH_ATTR parse_event(int next_token, bool * happend) {
 	return next_token + 1;
     }
 #endif
-    return syntax_error(next_token, "'init', 'mqttconnect', 'topic', 'gpio_interrupt', 'serial', 'alarm', 'http_response', or 'timer' expected");
+    return syntax_error(next_token, "event spec (like 'topic') expected");
 }
 
 int ICACHE_FLASH_ATTR parse_action(int next_token, bool doit) {
@@ -1892,6 +1901,18 @@ int ICACHE_FLASH_ATTR interpreter_wifi_connect(void) {
     return parse_statement(0);
 }
 
+int ICACHE_FLASH_ATTR interpreter_wifi_disconnect(void) {
+    if (!script_enabled)
+	return -1;
+
+    lang_debug("interpreter_wifi_disconnect\r\n");
+
+    interpreter_status = WIFI_DISCONNECT;
+    interpreter_topic = interpreter_data = "";
+    interpreter_data_len = 0;
+    return parse_statement(0);
+}
+
 int ICACHE_FLASH_ATTR interpreter_mqtt_connect(void) {
     if (!script_enabled)
 	return -1;
diff --git a/user/lang.h b/user/lang.h
index 202ac59..36dc991 100644
--- a/user/lang.h
+++ b/user/lang.h
@@ -3,7 +3,7 @@
 
 #include "mqtt/mqtt_server.h"
 
-typedef enum {SYNTAX_CHECK, CONFIG, INIT, MQTT_CLIENT_CONNECT, WIFI_CONNECT, TOPIC_LOCAL, TOPIC_REMOTE, TIMER, SERIAL_INPUT, GPIO_INT, ALARM, HTTP_RESPONSE} Interpreter_Status;
+typedef enum {SYNTAX_CHECK, CONFIG, INIT, MQTT_CLIENT_CONNECT, WIFI_CONNECT, WIFI_DISCONNECT, TOPIC_LOCAL, TOPIC_REMOTE, TIMER, SERIAL_INPUT, GPIO_INT, ALARM, HTTP_RESPONSE} Interpreter_Status;
 typedef enum {STRING_T, DATA_T} Value_Type;
 
 typedef struct _var_entry_t {
@@ -41,6 +41,7 @@ int interpreter_config();
 int interpreter_init();
 int interpreter_mqtt_connect(void);
 int interpreter_wifi_connect(void);
+int interpreter_wifi_disconnect(void);
 int interpreter_topic_received(const char *topic, const char *data, int data_len, bool local);
 int interpreter_serial_input(const char *data, int data_len);
 
diff --git a/user/user_main.c b/user/user_main.c
index e1cf73f..36674b7 100644
--- a/user/user_main.c
+++ b/user/user_main.c
@@ -560,6 +560,9 @@ void wifi_handle_event_cb(System_Event_t * evt) {
 
 	MQTT_server_cleanupClientCons();
 
+#ifdef SCRIPTED
+	interpreter_wifi_disconnect();
+#endif
 #ifdef MQTT_CLIENT
 	if (mqtt_enabled)
 // Missing test for local