It's straightforward to verify that for any $ c \in \mathbb R $ and any additive idempotent $ g : \mathbb R \to \mathbb R $ satisfying $ g ( c ) = c $, the function $ f : \mathbb R \to \mathbb R $ defined with $ f ( x ) = g ( x ) + c $ for all $ x \in \mathbb R $, satisfies
$$ f \bigl ( f ( x ) + y + z \bigr ) = f ( x ) + f ( y ) - f ( - z ) + f ( 0 ) \tag 0 \label 0 $$
for all $ x , y , z \in \mathbb R $. To prove that these are the only solutions, consider an $ f : \mathbb R \to \mathbb R $ satisfying \eqref{0} for all $ x , y , z \in \mathbb R $, and let $ c = f ( 0 ) $. Substituting $ y + z $ for $ y $ and $ 0 $ for $ z $ in \eqref{0}, you get
$$ f \bigl ( f ( x ) + y + z \bigr ) = f ( x ) + f ( y + z ) $$
for all $ x , y , z \in \mathbb R $, which comparing with \eqref{0} itself, yields
$$ f ( y + z ) = f ( y ) - f ( - z ) + c \tag 1 \label 1 $$
for all $ y , z \in \mathbb R $. Interchanging $ y $ and $ z $ in \eqref{1} and comparing with \eqref{1} itself, you have
$$ f ( y ) - f ( - z ) = f ( z ) - f ( - y ) $$
for all $ y , z \in \mathbb R $, which in particular for $ z = 0 $ implies
$$ f ( - y ) = - f ( y ) + 2 c \tag 2 \label 2 $$
for all $ y \in \mathbb R $. Define $ g : \mathbb R \to \mathbb R $ with $ g ( x ) = f ( x ) - c $ for all $ x \in \mathbb R $. Then you have $ g ( 0 ) = 0 $, while \eqref{2} implies
$$ g ( - y ) = - g ( y ) \tag 3 \label 3 $$
for all $ y \in \mathbb R $. By \eqref{1} and \eqref{3}, you get
$$ g ( y + z ) = g ( y ) + g ( z ) \tag 4 \label 4 $$
for all $ y , z \in \mathbb R $; i.e. $ g $ is additive. \eqref{0} becomes
$$ g \bigl ( g ( x ) + y + z + c \bigr ) + c = g ( x ) + c + g ( y ) + c - g ( - z ) - c + c \text , $$
which using \eqref{3} and \eqref{4} implies
$$ g \bigl ( g ( x ) \bigr ) + g ( y ) + g ( z ) + g ( c ) = g ( x ) + g ( y ) + g ( z ) + c \text , $$
for all $ x , y , z \in \mathbb R $, or
$$ g \bigl ( g ( x ) \bigr ) + g ( c ) = g ( x ) + c \tag 5 \label 5 $$
for all $ x \in \mathbb R $. Setting $ x = 0 $ in \eqref{5} you get $ g ( c ) = c $, and therefore \eqref{5} imples
$$ g \bigl ( g ( x ) \bigr ) = g ( x ) $$
for all $ x \in \mathbb R $; i.e. $ g $ is idempotent, and we're done.
The characterization given above is the best you can hope for. Without further assumptions on $ f $, there are uncountably many wild solutions. Take a look at "Overview of basic facts about Cauchy functional equation" to get more information about the matter. In case you have regularity assumptions (like continuity, local boundedness or measurability) on $ f $, $ g $ will be regular, too, and thus it must be of the form $ g ( x ) = a x $ for some constant $ a \in \mathbb R $ and all $ x \in \mathbb R $. By idempotency of $ g $, you get $ a ^ 2 = a $, and therefore $ a \in \{ 0 , 1 \} $. As you also have $ g ( c ) = c $, $ a = 0 $ is only possible if $ c = 0 $. Therefore, the only regular solutions of the problem are those of the form $ f ( x ) = x + c $ for some constant $ c \in \mathbb R $, and the constant zero function $ f ( x ) = 0 $.
To characterize all the possible $ g $ above when no further assumptions hold, consider a Hamel basis $ \mathcal H $ of $ \mathbb R $ over $ \mathbb Q $, which contains $ c $ in case $ c \ne 0 $. Partition $ \mathcal H $ into two subsets $ \mathcal X $ and $ \mathcal Y $, such that $ \mathcal Y $ contains $ c $ if $ c \ne 0 $. Consider any $ h : \mathcal X \to \operatorname {span} _ { \mathbb Q } ( \mathcal Y ) $, and define $ g $ to be the unique $ \mathbb Q $-linear function on $ \mathbb R $ which simultaneously extends $ h $ and $ \operatorname {Id} _ { \mathcal Y } $. Then $ g $ will be and additive idempotent function on $ \mathbb R $ with $ g ( c ) = c $. Conversely, given any such $ g $, the set of fixed point of $ g $ will be a $ \mathbb Q $-subspace of $ \mathbb R $. Considering a Hamel basis $ \mathcal Y $ of this set over $ \mathbb Q $ (which can be chosen so that it contains $ c $ if $ c \ne 0 $) and extending it to a Hamel basis of $ \mathbb R $ over $ \mathbb Q $, you can see that $ g $ is of the previously mentioned form.