How to calculate Tesla PowerWall batter charging from gid/solar

I could use some help creating a power sensor showing how much of my Tesla PowerWall battery charging is coming from solar and a separate one for how much is coming from the grid. I want to use these sensors in my overall power and electricity usage graphs and dashboards.

I have the Tesla Fleet Integration installed and in the Tesla Powerwall integration, there is a battery power sensor (negative is charging, positive is discharging), there is also a power sensor for grid power (positive for importing, negative for exporting), solar generation (positive or zero), and % battery charged. I’m not sure how set it up properly since the battery can charge from gird and solar at the same time, plus thereare other loads drawing from these power sources at the same time, and the Powerwall charge rate limitation may also effect the calculation.

The Tesla Powerwall integration does have energy sensor values for Battery Charged by Grid and by Solar, but I need a power sensor not energy sensor, and also the battery charge energy sensors periodically reset, which causes issue with energy calculations.

Any guidance is greatly appreciated.