   delay(10);
 
 
-}+}

#define MQTT_PORT 1883

//Constants
const char TV_STATE_OFF = 1;
const char TV_STATE_ON  = 2;
const char ALARM_ON  =  '2';
const char ALARM_OFF =  '1';

void processAlarmStateMsg(char* topic, byte* payload, unsigned int length)
{

  Serial.print("Checking if state topic");
  if(String(topic) == "ALARM1/cmd"){
	  Serial.println("Received Alarm change message");
       if ((char)payload[0] == ALARM_ON){
		    Serial.println("ALARM ON received");

			  switchAlarmOn();
			
	     }
       else if ((char)payload[0] == ALARM_OFF){
        Serial.println("ALARM OFF received");

        switchAlarmOff();
      
       }
		 else {


#define SENSOR_ID "ALARM1"

#define ALARM_LED_RELAY_PIN        D5
#define ALARM_BUZ_RELAY_PIN        D1 



