diff --git a/exec/mqtt_spy.js b/exec/mqtt_spy.js
index eaa2c3def29f1695728b2a62ac9e69ff4c2ca129..165c241f92818324a89446255f96ece29b637d7e 100755
--- a/exec/mqtt_spy.js
+++ b/exec/mqtt_spy.js
@@ -117,7 +117,8 @@ while(!js.terminated) {
 				else
 					key = get_ansi_seq();
 			}
-			mqtt.publish(in_topic, key);
+			if(key)
+				mqtt.publish(in_topic, key);
 		}
 	}
 }