The part of the Einstein equations of general relativity referred to vacuum energy, introduce a repulsive term in gravity. This means that as the space become bigger and bigger, vacuum part become more and more important, leading to an undefined accelerated growth of the universe. Why vacuum energy does not violate the principles of thermodynamic? This is a sort of perpetual motion, isn't it?
You should read the question here energy conservation in general relativity to get a feel of the complexity of the problem.
Why vacuum energy does not violate the principles of thermodynamic?
Thermodynamics is an emergent theory from classical statistical mechanics and that is based on quantum statistical mechanics. General relativity does not enter in the derivation of the thermodynamic laws.
It is conservation of energy that can be questioned and the answer is in the link provided.
I quote from the concluding paragraph:
What you can't have is a tensor quantity that is globally defined that one can easily associate with 'energy density' of the gravitational field, or define one of these energies for a general spacetime. The reason for this is that one needs a time with which to associate a conserved quantity conjugate to time. But if there is no unique way of specifying time, and especially no way to specify time in such a way that it generates some sort of symmetry, then there is no way to move forward with this procedure.
To violate a law one has to be able to define it, and it seems that this is not possible in general in General Relativity.
Energy conservation in GR only holds approximately in spacetime regions that are very small, compared to curvature radii. But in general, since parallel transport is dependent on the trajectory in spacetime, an observer cannot uniquely define the energy of another distant observer.
The so-called Universal Time in the FLRW cosmology is a convention. We choose to define a set of synchronized observers, so that the metric can be separated in two factors, one of them with only spatial coordinates. But that doesn't mean that the universal time can be used as an analogous concept to a newtonian $t$ that would allow to define conservation laws. You could slice spacetime in another way, defining a different set of synchronized observers.
Anyway, physics is all about mathematical models, and you are free to think in terms of the one called Newtonian Cosmology in astrophysics books. It has mainly didactical purposes, but it leads to some correct results (and it is what many people secretly have in mind when they talk about cosmology). In that framework, you may define a total energy and see if it is conserved. The problem is that Newtonian Cosmology doesn't have dark energy. How would you model the summand of the dark potential energy?
The conserved quantity in GR, in problems that do NOT deal with the cosmological-scale dark energy (for instance when studying neutron stars and black holes) is the energy momentum tensor of normal matter. I think that perhaps an equivalent statement to your question may be: Is there any way to include the dark energy as part of the energy-momentum tensor, so that its conservation law still holds? There is nowadays a very active theoretical research on how to model dark energy, so your question is eventually a very interesting one, and is still open.
Theoretically, you could use the accelerated expansion of the universe to create a perpetual motion machine. It would not be practical due to engineering issues, but in theory it is possible. Imagine you had two large masses that are separated by a large distance and you had a monomolecular filament rope between the objects that could be lengthened at a negligible energy cost. With that setup the accelerated expansion would cause a tension on that rope and you could let that force be exerted over a distance to extract work from the accelerated expansion.
First of all, the universe is expanding at 74 km/sec/Mpc (Mpc is a mega parsec which is 3.26 million light years). So let's take two heavy objects and place them far from any galaxy cluster or other influence and space them just one parsec apart (3.26 light years). Then they will effectively be moving apart at 7.4 cm/sec. Now imagine that your monomolecular filament rope between the objects puts a force on the objects that will decelerate the objects. Then during the time that they are decelerating you can extract work from the objects. That work per second comes from the force the rope is exerting being applied over the 7.4 cm/sec that the objects are moving apart. However, once the force causes their relative velocity to drop to 0, you won't be able to get any more energy from the objects since they are no longer moving apart. There will still be a constant force on your rope but you need to have a force applied over a distance to get work.
Now this is all from just the "Big Bang" expansion of space. Once the rope's force has gotten their relative velocity to zero, the two objects are like a gravitational bound system and it will stop "expanding". However, in addition to the "standard" expansion of space, we now know that there is dark energy which is causing an accelerating expansion of the universe. This means that the two objects are not just "moving" apart at constant 7.4 cm/sec but that this velocity is actually increasing with time. So if you setup your rope such that the force it is exerting on the objects results in an deceleration that is slightly smaller than this cosmic acceleration, you can extract work continuously and indefinitely. Unfortunately, I have not been able to convert the dark energy measurements into units of acceleration in this particular case of objects at one parsec. I suspect it is a small number but current estimates are that it is definitely positive. Note that if your rope exerts more force that causes a deceleration larger than the cosmic acceleration then the objects will eventually stop moving apart and the work you can extract will drop to zero again.
Note that from just the normal expansion of the universe you can only extract a finite total amount of energy, but that with the accelerated expansion you can extract a small but positive amount of energy per second forever. However, your rope needs to get longer and longer with time (at the rate of 7.4 cm/sec, in this example), so, as they say TANSTAFL (there ain't no such thing as a free lunch). The rope needs to get longer because you have to have your very small force applied to continuously moving objects to get work done. Since it will take continuous energy to make a continuously lengthening rope, and you cannot win this battle by starting with objects that are further apart since then the rope is lengthening at an even faster rate than the 7.4 cm/sec of this example. You can increase the energy per second you extract by making the objects more massive, but then the force on the rope increases so you need to make a thicker rope.
The bottom line is that I think this free energy project is impractical, even though it is theoretically possible. The problem that needs to be solved is the energy cost of the continuously lengthening rope.