   digitalWrite(PIN_BUZZER, LOW);
 
   if (lock_status_on()) {
+    g_lock_status = LOCK_LOCKED;
+  } else {
     g_lock_status = LOCK_UNLOCKED;
-  } else {
-    g_lock_status = LOCK_LOCKED;
   }
   g_status = STATUS_INIT_GPRS;
 }

#include <ArduinoJson.h>
#include <LGPRS.h>
#include <LGPRSClient.h>
#include <LGPS.h>
#include <MQTTClient.h>

#define JSON_BUF_SIZE 192

#define PIN_MOTOR 0
#define PIN_LOCK_STATUS 5

  bool rc = false;
  LGPRSClient net_client;

  Serial.println("connect reg");
  while (!net_client.connect("reg-t.yunba.io", 9944)) {
    Serial.println(".");
    delay(1000);
  }

  String data;
  if (device_id == NULL)
