Vibration energy is abundantly present in many natural and artificial systems and can be assembled by various devices, mainly employing benefits of the piezoelectric and electromagnetic phenomena. In the present article, the electromechanical system with two degrees of freedom is considered. To the main mass, whose vibrations are to be reduced, an additional element (dynamical vibration absorber or DVA) is attached. The DVA consists of a spring, damping and piezoelectric elements for energy harvesting. The goal is to reduce the maximal possible responses of the main structure at the vicinity of external 1:1 resonance and at the same time collect energy from the vibration of the system. An analytical approach is proposed to find the solution of the problem. We show that the piezoelectric element allows effective energy harvesting and at the same has a very limited influence on reducing the amplitude of oscillations of the main mass. The theoretical results are confirmed by numerical experiments.