Custom component goecharger_mqtt - go-eCharger HOMEfix EV charger integration

Hi again,

As probably many others go-eCharger owners with solar panels on the roof I so much want to make an automation that charge my Tesla with excess solar power that would otherwise be exported to the grid…
I also acknowledge that there is a specific Tesla API available that some HA users have successfully taped into and hereby control the charging entirely from the Tesla + a grid power meter sensor.

However, with the new go-eCharger we now have the ability to control the charging entirely from the charger alone making it EV car independent. At least with the go-eCharger app alone I can now manually control the charging profile so that the total household consumption match the solar power produced:

I did this tedious manual job just to show that it was possible to match the solar power quite precisely.
And furthermore I did this without touching my Tesla - and I was even able to switch between 1 and 3 phases and back again on the fly. Well, it gave some short pauses in charging as can be seen but that is due to my Tesla wanting to think about the new charge situation. Go-eCharger just waited patiently!

But boy, would I want to have a script and automation just doing the same thing? Sure! :sweat_smile:

But in order to make the necessary calculation I need to know the actual charge power at all times. I can easily access the PSM key that control the phase switch (1 or 3) and the AMP key that control the current on the phases but the total power is “hidden” in place 12 (Total) of the NRG key that is an array:
U (L1, L2, L3, N), I (L1, L2, L3), P (L1, L2, L3, N, Total), pf (L1, L2, L3, N)

Question is how do I filter out “Total” from that key?

I would probably know how to do this if I was doing HA automations every day - but unfortunately I am nowhere near that…

Thanks for any guidance