     		startEthernet();
     	}
     }
-
-    // Create MQTT topic and convert it to char array
-	String topicStr = "/actions/domoticz/";
-	topicStr.concat(topicID);
-	topicStr.toCharArray(topic, topicStr.length()+1);
 
 	// Convert payload to char array
 	payload.toCharArray(msg, payload.length()+1);

  Serial.print(temperature);
  Serial.println(F("DegC"));

  topicID = "Meriroom";
  dtype = "80";
  deviceType = atoi (dtype); // dtype is converted to int in order to use it with switch structure below and other functions

  //Measured temperature (float) is converted to char array
  char charVal[10];	//Temporarily holds data for dtostrf function
  dtostrf(temperature, 4, 1, charVal);  //4 is minimum width, 1 is precision; float value is copied into buff
  temp = charVal;

  //Send data to MQTT broker running on a Raspberry Pi
  sendMQTTPayload(createMQTTPayload());
}

String createMQTTPayload() //Create MQTT message payload. Returns created message as a String.
{

	String dataMsg = "{\"dunit\":1,";
	dataMsg.concat(F("\"dtype\":"));

	switch (deviceType)
	  {
		case 82: // Combined temperature and humidity sensor
	    	dataMsg.concat(dtype);
	    	dataMsg.concat(F(",\"dsubtype\":1,"));
	    	dataMsg.concat(F("\"svalue\":\""));
	    	dataMsg.concat(temp);
	    	dataMsg.concat(F(";"));
	    	dataMsg.concat(hum);
	    	dataMsg.concat(F(";0"));
	    	break;

		case 80: // Temperature sensor
			dataMsg.concat(dtype);
	    	dataMsg.concat(F(",\"dsubtype\":1,"));
	    	dataMsg.concat(F("\"svalue\":\""));
	    	dataMsg.concat(temp);
	    	break;

		default: // If dtype is unknown, then default case to be used. Default case is a temperature sensor.
			Serial.println("Unknown dtype received. Default procedure to be done.");
			dataMsg.concat(dtype);
	    	dataMsg.concat(F(",\"dsubtype\":1,"));
	    	dataMsg.concat(F("\"svalue\":\""));
	    	dataMsg.concat(temp);
	    	break;
	  }

	dataMsg.concat(F("\"}"));
	return dataMsg;
}

void sendMQTTPayload(String payload) // Sends MQTT payload to the Mosquitto server running on a Raspberry Pi.

		Serial.println("Received data parsed...");

		//Send data to MQTT broker running on a Raspberry Pi
    sendMQTTPayload(createMQTTPayload(receivedIDX, dtype)); //Send data to MQTT broker running on a Raspberry Pi

		#if defined RAM_DEBUG
		Serial.print(F("Amount of free RAM memory: "));
