Formalism of $H=E$ (Hamiltonian mechanics)

An answer to the question When is the Hamiltonian of a system not equal to its total energy? is:

In an ideal, holonomic and monogenic system (the usual one in classical mechanics), Hamiltonian equals total energy when and only when both the constraint and Lagrangian are time-independent and generalized potential is absent.

(from Siyuan Ren (https://physics.stackexchange.com/users/3887/siyuan-ren), URL (version: 2011-07-06): https://physics.stackexchange.com/a/11918/ )

that seems the most exact one I've found in several similar posted questions.

I'm trying to translate these conditions to equations.

1. Lagrangian is time-independent could be: $$L(q,\dot{q},t)=L(q,\dot{q})$$.
2. constraint is time-independent: ?
3. generalized potential is absent: ?

The function $$h$$ defined by the equation $$h=\sum_j\left( \frac{\partial \mathcal{L}}{\partial \dot{q}_j}\dot{q}_j\right)-\mathcal{L}$$ is called the energy function of the system $$\mathcal{S}$$.

If $$\mathcal{L}=\mathcal{L}(q,\dot{q},t)$$, then $$\partial \mathcal{L}/\partial t\not=0$$ and $$h$$ is not conserved.

If $$\mathcal{L}=\mathcal{L}(q,\dot{q})$$ then $$\partial \mathcal{L}/\partial t =0$$ so that $$h$$ is a constant. The conservation formula $$\sum_j\left( \frac{\partial \mathcal{L}}{\partial \dot{q}_j}\dot{q}_j\right)-\mathcal{L}=\mathrm{constant}$$ is called the energy integral of the system $$\mathcal{S}$$.

If $$\mathcal{S}$$ is a conservative standard system, then $$\mathcal{S}$$ is autonomous and so $$h$$ is conserved. In addition, energy integral can be written in a more familiar form, if

$$T=\sum_{j,k}a_{jk}(q)\dot{q}_j\dot{q}_k$$

and $$V=V(q)$$. The energy integral becomes $$h=T+V=\mathrm{constant}$$ In this case the total energy $$E$$ of the system.

Now All you need to do is to take Hamiltonian in place of the Energy function. $$\mathcal{H}=\sum_j\left( \frac{\partial \mathcal{L}}{\partial \dot{q}_j}\dot{q}_j\right)-\mathcal{L}=\sum_j p_j\dot{q}_j-\mathcal{L}$$