Numerous observations imply that the late universe is in accelerated expansion [1, 2]. Within the framework of the standard cosmological model, an accelerated expansion can be accounted for by a positive cosmological constant \(\Lambda \), which presents in the system of equations for a homogeneous, isotropic and flat universe (\(k = 0\)),

$$\begin{aligned}{} & {} H^2 = \frac{8\pi G}{3} \rho + \frac{\Lambda }{3} , \end{aligned}$$
(1)
$$\begin{aligned}{} & {} \frac{{\ddot{a}}}{a} \equiv {\dot{H}} + H^{2} = - \frac{4\pi G}{3} (\rho + 3p) + \frac{\Lambda }{3} . \end{aligned}$$
(2)

Here overdots denote derivatives with respect to the cosmic time, \(H \equiv {\dot{a}}/a\) is the Hubble parameter, G is the gravitational constant, and \(\rho \) and p are the mass and pressure densities of cosmological fluids (we use the system of units where \(c = \hbar = k_B = 1\)).

In (1) and (2) the cosmological constant \(\Lambda \) is a free parameter and is fixed only from observations, which for the value of dark energy density gives [3],

$$\begin{aligned} \Omega _{\Lambda } = \frac{\Lambda }{3H_0^2} \approx 0.692 , \end{aligned}$$
(3)

where \(H_0\) denotes the present value of the Hubble parameter. One of the main problems of standard cosmology is that the measured value of \(\Lambda \) is much smaller than theoretical estimations obtained from the standard quantum field theory. In order to resolve this discrepancy, various models have been proposed (see the reviews [4, 5]).

It is known that, using the Friedmann equation (1), the acceleration equation (2) can be expressed without \(\Lambda \),

$$\begin{aligned} {\dot{H}} = - 4\pi G (\rho + p) . \end{aligned}$$
(4)

Also, combining (1) and (2), one can obtain the matter energy–momentum conservation equation,

$$\begin{aligned} {\dot{\rho }} = - 3 H (\rho + p) , \end{aligned}$$
(5)

where the cosmological constant \(\Lambda \) does not appear as well. If instead of (1) and (2), one will choose (4) and (5) as the independent system of cosmological equations, \(\Lambda \) obtains the role of integration constant. Indeed, excluding \((\rho + p)\) from (4) and (5),

$$\begin{aligned} \frac{4\pi G}{3} {\dot{\rho }} = H{\dot{H}} , \end{aligned}$$
(6)

and integrating this relation over the time, we obtain the Friedmann equation (1),

$$\begin{aligned} H^2 = \frac{8\pi G}{3} \rho + C , \end{aligned}$$
(7)

but with an integration constant C instead of \(\Lambda /3\). So, in a cosmological models where the system (4), (5) is primary, and the Friedmann equation (1) represents its first integral, the value of \(\Lambda \) can be obtained from boundary conditions of the model. The examples of scenarios where \(\Lambda \) arises as an integration constant are unimodular relativity [6,7,8,9] and thermodynamic approach to gravity [10,11,12,13,14,15,16].

Key ingredient in thermodynamic model of gravity is entropy, which allows us to study different aspects of various physical systems using a similar mathematical framework (see the recent review [17]). Most thermodynamic cosmological scenarios are based on the holographic principle (see the review [18]) and for an associated entropy of a volume usually is used the Bekenstein–Hawking formula for black holes [19, 20],

$$\begin{aligned} S_{\textrm{BH}} = \frac{A}{4G} = \frac{\pi R^2}{G} , \end{aligned}$$
(8)

where R denotes the radius and \(A = 4\pi R^2\) is the surface area. In thermodynamic cosmology, to the Hubble sphere of radius

$$\begin{aligned} R_H = \frac{1}{H} , \end{aligned}$$
(9)

having the surface and volume

$$\begin{aligned} A_H = \frac{4\pi }{H^2}, \quad V_H = \frac{4\pi }{3H^3} , \end{aligned}$$
(10)

can be associated the temperature [21],

$$\begin{aligned} T_H = \frac{H}{2\pi } , \end{aligned}$$
(11)

and the black hole type entropy (8),

$$\begin{aligned} S_H = \frac{A_H}{4G} = \frac{\pi }{GH^2} > 0 . \end{aligned}$$
(12)

In thermodynamic approach, the Friedmann equation (7) has the natural interpretation as the balance of gravitational and matter heat densities in the spirit of the first law of thermodynamics [15, 16], while the acceleration equation (4) can be obtained by equating the entropy input in the Hubble volume to the sum of entropy flux (entropy received per unit surface) transferred through the horizon and the entropy supplied by internal sources (entropy generated per unit volume). Indeed, if we neglect the entropy supplied by internal sources, the time derivative of the entropy contained within the Hubble volume, \(S_H\), should be equal to the flux of the matter entropy density, \(S_m\), through the boundary \(A_H\),

$$\begin{aligned} \dot{S}_H = S_m A_H . \end{aligned}$$
(13)

Using the classical Gibbs–Duhem relation,

$$\begin{aligned} \rho + p = T_HS_m , \end{aligned}$$
(14)

the Eq. (13) takes the form:

$$\begin{aligned} \dot{A}_H = 4G (\rho + p)\, \frac{A_H}{T_H} , \end{aligned}$$
(15)

which, using (10) and (11), reduces to the standard acceleration equation (4). Note that in thermodynamic picture the Universe cannot export the entropy to any external universes and it seems that its total entropy is conserved [22,23,24,25].

Thus, in various scenarios, the Friedmann equation (7) contains the integration constant C (the dark energy term). This change of the role of \(\Lambda \) from a parameter of the matter action to a property of states does not solve the cosmological constant problem, but it does change it from a question of fine-tuning to a question of boundary conditions [26, 27]. To find proper boundary conditions, note that cosmological equations are written for the Hubble volume, since as a proper causal boundary of the classical space-time (for the flat universe, \(k = 0\)) usually the Hubble horizon is considered [28, 29]. Then the metric fluctuations are bounded by \(R_H\) and thermodynamic laws also are satisfied on this boundary [30, 31].

On the other hand, the quantum fluctuations of matter fields should be limited not by the Hubble horizon \(R_H\), but by the event horizon \(R_e \ge R_H\), which represents a real boundary of space-time [32, 33]. Then, cosmological equations should also contain the energy density corresponding to entanglements of quantum particles across the Hubble horizon [34] and can be taken into account by introducing a surface term at \(R_H\). It was found that the perfect fluid of entanglement has a negative pressure [35] and can be interpreted as the origin of dark energy [13].

The value of the event horizon at the current cosmic time can be estimated as (see, for example, [36]):

$$\begin{aligned} R_e = \frac{1}{H_0}\int _{-1}^0 \frac{dy}{\sqrt{\Omega _m (1 + y)^3 + \Omega _\Lambda }} \approx \frac{0.96\, R_H}{\sqrt{\Omega _\Lambda }} , \end{aligned}$$
(16)

where \(\Omega _m\) denotes the matter density. While particle entanglements can be effective up to \(R_e \), in the context of cosmology (as well as in the context of black holes), (16) is always defined globally (see more discussions in [37]) and at the event horizon we can assume absence of matter,

$$\begin{aligned} \Omega _m |_{R \rightarrow R_e} \rightarrow 0. \end{aligned}$$
(17)

Using this assumption, we can fix the integration constant in (7):

$$\begin{aligned} C = H^2|_{R \rightarrow R_e} = \frac{1}{R_e^2} . \end{aligned}$$
(18)

Therefore, for the dark energy density we obtain the value

$$\begin{aligned} \frac{C}{H_0^2} = \frac{R_H^2}{R_e^2} \approx 1.08 \, \Omega _\Lambda , \end{aligned}$$
(19)

which almost coincides with the observed density of the dark energy (3), within the uncertainties in measurements of \(\Omega _m\) and \(\Omega _\Lambda \) in (16).

To summarize, in this paper we have noted that within the unimodular or thermodynamic approaches to gravity, in the Friedmann equation (7) the cosmological term appears as an integration constant, i.e. is not associated with the large vacuum expectation values and can be fixed from boundary conditions. Since the real boundary of space-time is the event horizon and not the Hubble sphere, we assume that cosmological equations should contain the terms corresponding to the entanglements of quantum particles across the apparent horizon. Using the fact that in a region enclosed by an event horizon, like a black hole, interior matter density should tend to zero at the horizon (17), in the Friedmann equation (7) we fix the integration constant (18) and obtain the value for the dark energy density (19) that almost coincides with the observations (3).