Weighted Poincare Inequality
The natural form of Poincaré inequality is $$\int_\Omega |f-f_\Omega|^2 \le C\int_\Omega |\nabla f|^2\tag1$$ where $f_\Omega=\int_\Omega f$ is the mean of $f$. This is exactly your first inequality, but I think (1) captures the meaning better. The weighted Poincaré inequality would be $$\int_\Omega |f-f_{\Omega, w}|^2w \le C'\int_\Omega |\nabla f|^2w\tag2$$ where $f_{\Omega,w}=\int_\Omega fw$ is the weighted mean of $f$. Again, this is what you have but written in a more natural way.
The industry of weighted Poincaré inequalities is huge, but the most fundamental result is that the Muckenhoupt condition $w\in A_2$ is sufficient for (2). This is proved in detail, e.g., in Chapter 15 of Nonlinear Potential Theory of Degenerate Elliptic Equations by Heinonen, Kilpeläinen, and Martio (now published by Dover, $10
). The constant $C'$ of course depends on the $A_2$ norm of $w$, but not in any explicit way. There has been some recent interest in estimates of the form $C'\le c\|w\|_{A_2}$ with weight-independent constant $c$, but I do not know if this particular one has been proved.
Anyway, the assumptions you stated are not enough for (2) to hold. Let $f(x)=\min(M, \log\log (e+|x|^{-1}))$ where $M$ is a large number to be chosen later. Spread one half of available weight uniformly on the square, and put the other half onto the set where $f=M$. Since on most of the square $f$ is much smaller than $M$, the weighted mean of $f$ is about $M/2$. Hence, the left hand side of (2) is of order $M$. But the right hand side of (2) is bounded independently of $M$.
Like 40 votes said, there is an industry of this. I happened to learn some of the results of the weighted Poincaré type inequality for some of my previous researches. There is a famous book by A. Kufner: Weighted Sobolev spaces. A more recent treatise on this is Nonlinear Potential Theory and Weighted Sobolev Spaces, please refer to a dedicated section 4.3 for Poincaré type inequality in weighted Sobolev space.
I myself learned the proof from this paper: An explicit right inverse of the divergence operator which is continuous in weighted norms. The section 3 of this paper proved the weighted Friedrichs' inequality for the weight $w = (|x-x_0|^2 + \theta^2)^{1/2}$.
Following is roughly the adaptation of the proof for any positive smooth weight $w>0$, $\int_{\Omega} w = 1$ (the weight can vanish on the boundary), under the same assumption "$\Omega$ is star-shaped with respect to a ball $B$".
Also what you wrote in your question is actually okay with a slight modification, which is the weighted Friedrichs' inequality (notice the following is much stronger version of 40 votes wrote):
For smooth function $f$ such that $\displaystyle \int_{\Omega} f w = 0$ with smooth weight $w>0$ in $\Omega$, and $\displaystyle \int_{\Omega} w = 1$: $$ \int_{\Omega}f^2 w \leq \int_{\Omega}f^2 \leq C\int_{\Omega} |\nabla f|^2w + (\text{Optional } L^2\text{-term}).\tag{$\star$} $$
A sketch of the proof: For simplicity we just assume $\Omega$ is a ball $B$ with radius 2 centered at the origin, and we can find some ball $\hat{B}\subset \Omega$ such that inside $B$, with positive radius $\hat{r} \geq c r_B$ for some positive $c$. For $x\in \hat{B}$, and $y\in B$: $$|y-x|\leq C w. \tag{1}$$ Why? Think a mollifier centered at origin, and this is a sufficient condition for the weight to satisfy for there to be a Poincaré type inequality. Let $\phi$ be a smooth weight vanishing at boundary of $\hat{B}$, and $\bar{f} = \int_{B} f\phi$ the weighted mean of $f$ vanishing outside this smaller ball then: for any $y\in B$ $$ f(y) - \bar{f} = \int_{B} \big(f(y) - f(z)\big)\phi(z)dx \\ = \int_{B} \int^1_0 (y-z)\cdot \nabla f(y + t(z-y)) \phi(z) dt \,dz, $$ which follows from the multi-dimensional Taylor formula. Now the trick is to rescale the variables: let $x = y + t(z-y)$ $$ f(y) - \bar{f} = \int_{B} \int^1_0 \frac{y-x}{t}\cdot \nabla v(x) \phi\left(y + \frac{x-y}{t}\right) \frac{1}{t^2} dx\,ds. $$ Now $\phi(y + \frac{x-y}{t})$ vanishes when $0< t < \gamma|x-y|$ for $\gamma$ relying on $\hat{r}$, hence for the kernel $$ K := \int^1_0 \frac{y-x}{t^3} \phi\left(y + \frac{x-y}{t}\right) dt, $$ we have $$ |K| \leq \sup|\phi| \int^1_{\gamma|x-y|} \frac{|y-x|}{t^3} dt \leq C |y-x|^{-1}. $$ Now use condition (1), $w^{1/2} \leq C |x-y|^{-1/2}$ inside the $\hat{B}$, and $K$ vanishes outside $\hat{B}$ we have $$ |f(y) - \bar{f}| \leq \int_B |K| |\nabla f| \\ = \int_B |K|w^{-1/2} w^{1/2}|\nabla f| \\ \leq C\int_B |y-x|^{-3/2} w^{1/2}|\nabla f|. $$ Now Young's inequality for convolution reads: $$ \|f - \bar{f}\|_{L^2(B)} \leq \Big\| |x|^{-3/2}\Big\|_{L^1(B)} \Big\|w^{1/2}|\nabla f|\Big\|_{L^2(B)}.\tag{2} $$ For $|x|^{-3/2}$ is $L^1$ when $B\subset \mathbb{R}^2$. Now if $\int_B fw = 0$, we have $$ \bar{f}_{B} := \frac{1}{|B|}\int_B f \phi = \frac{1}{|B|}\int_B f(\phi-w) \leq \frac{1}{|B|} \|f\|_{L^2(B)} \left(\int_B (\phi-w)^2\right)^{1/2}, $$ and the optional $L^2$-term in $(\star)$ is determined by how we can manipulate the weight so that $\|\bar{f}_{B} \|_{L^2(B)}$ can be absorbed by $ \|f\|_{L^2(B)}$, then we have: $$ \|f\|_{L^2(B)}^2\leq \|f-\bar{f}_{B}\|_{L^2(B)}^2 + \|\bar{f}_{B} \|^2_{L^2(B)}. $$ By (2) we have the result, for domain with radius not $O(1)$, a scaling argument will be in place.
I took these from some old notes I wrote to myself, there are maybe many loose ends. The $C$ in $(\star)$ depends on how this smooth weight $w$ "concentrates" itself with this domain, if it is very concentrated around some point, then $C$ in $(\star)$ has to be really large to control $\|f\|_{L^2(B)}$.