|  | @@ -73,20 +73,20 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // config variables - do not change here!
 | 
	
		
			
				|  |  | -char* deviceName = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_server = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char deviceName[30]; // = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_server[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  |  int mqtt_port = MQTT_PORT;
 | 
	
		
			
				|  |  | -char* mqtt_topic_in = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_topic_out = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_topic_out_hold_1 = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_topic_out_hold_2 = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_topic_out_hold_3 = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -//char* mqtt_payload_out_hold[3] = { BUTTON1_HOLD_PAYLOAD_OUT, BUTTON2_HOLD_PAYLOAD_OUT, BUTTON3_HOLD_PAYLOAD_OUT };
 | 
	
		
			
				|  |  | -char* mqtt_payload_out_hold_1 = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_payload_out_hold_2 = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | -char* mqtt_payload_out_hold_3 = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_topic_in[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_topic_out[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_topic_out_hold_1[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_topic_out_hold_2[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_topic_out_hold_3[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +//char+ mqtt_payload_out_hold[3] = { BUTTON1_HOLD_PAYLOAD_OUT, BUTTON2_HOLD_PAYLOAD_OUT, BUTTON3_HOLD_PAYLOAD_OUT };
 | 
	
		
			
				|  |  | +char mqtt_payload_out_hold_1[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_payload_out_hold_2[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char mqtt_payload_out_hold_3[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  |  int domoticzIdx[3] = {DOMOTICZ_IDX_1, DOMOTICZ_IDX_2, DOMOTICZ_IDX_3}; // initially set to 0, must be defined in config
 | 
	
		
			
				|  |  | -char* domoticz_out_topic = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  | +char domoticz_out_topic[30]; //  = "123456789012345678901234567890"; // 30 chars
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  int relais_impulse[3] = {RELAIS1_IMPULSE, RELAIS2_IMPULSE, RELAIS3_IMPULSE};
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -157,24 +157,25 @@ void setup() {
 | 
	
		
			
				|  |  |      return;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  deviceName = DEVICE_NAME;
 | 
	
		
			
				|  |  | -  mqtt_server = MQTT_SERVER;
 | 
	
		
			
				|  |  | -  mqtt_topic_in = MQTT_TOPIC_IN;
 | 
	
		
			
				|  |  | -  mqtt_topic_out = MQTT_TOPIC_OUT;
 | 
	
		
			
				|  |  | -  mqtt_topic_out_hold_1 = BUTTON1_HOLD_TOPIC_OUT;
 | 
	
		
			
				|  |  | -  mqtt_topic_out_hold_2 = BUTTON2_HOLD_TOPIC_OUT;
 | 
	
		
			
				|  |  | -  mqtt_topic_out_hold_3 = BUTTON3_HOLD_TOPIC_OUT;
 | 
	
		
			
				|  |  | -  mqtt_payload_out_hold_1 = BUTTON1_HOLD_PAYLOAD_OUT;
 | 
	
		
			
				|  |  | -  mqtt_payload_out_hold_2 = BUTTON2_HOLD_PAYLOAD_OUT;
 | 
	
		
			
				|  |  | -  mqtt_payload_out_hold_3 = BUTTON3_HOLD_PAYLOAD_OUT;
 | 
	
		
			
				|  |  | -  domoticz_out_topic = DOMOTICZ_OUT_TOPIC; // changeable subscription topic, as domoticz supports different flat/hierarchical out-topics
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  //  if (!loadConfig()) {
 | 
	
		
			
				|  |  | -  //    Serial.println("Failed to load config");
 | 
	
		
			
				|  |  | -  //  } else {
 | 
	
		
			
				|  |  | -  //    Serial.println("Config loaded");
 | 
	
		
			
				|  |  | -  //  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  // set config default parameters
 | 
	
		
			
				|  |  | +  strcpy(deviceName, DEVICE_NAME);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_server, MQTT_SERVER);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_topic_in, MQTT_TOPIC_IN);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_topic_out, MQTT_TOPIC_OUT);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_topic_out_hold_1, BUTTON1_HOLD_TOPIC_OUT);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_topic_out_hold_2, BUTTON2_HOLD_TOPIC_OUT);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_topic_out_hold_3, BUTTON3_HOLD_TOPIC_OUT);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_payload_out_hold_1, BUTTON1_HOLD_PAYLOAD_OUT);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_payload_out_hold_2, BUTTON2_HOLD_PAYLOAD_OUT);
 | 
	
		
			
				|  |  | +  strcpy(mqtt_payload_out_hold_3, BUTTON3_HOLD_PAYLOAD_OUT);
 | 
	
		
			
				|  |  | +  strcpy(domoticz_out_topic, DOMOTICZ_OUT_TOPIC); // changeable subscription topic, as domoticz supports different flat/hierarchical out-topics
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  // load config from SPIFFS file if exists
 | 
	
		
			
				|  |  | +  if (!loadConfig()) {
 | 
	
		
			
				|  |  | +    Serial.println("Failed to load config");
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    Serial.println("Config loaded");
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    // set relais pin modes
 | 
	
		
			
				|  |  |    for (int i = 0; i < RELAIS_COUNT; i++) {
 |