Help to create sensor / template for solar injection

Hi !

I’m trying to create a sensor of something equivalent for solar production.

I need something that could display “Injection” when power given by panel > power used by home.
and display “Consumption” when power produced by panels < power used by home.

I did a binary helper like this

and a sensor like this

based on a battery model, so it works but display “charging / discharging”
(other data are for testing, to understand how it works)

How would you do to get a similar sensor displaying “Injection / consumption” with a (if possible) dedicated icon also changing depending on the state ?