Energy Independence sensor

Enphase have brought out a new thing I like the look of, an Energy Independence score.

https://community.enphase.com/s/article/What-does-my-Energy-Independence-score-mean?utm_source=enlighten&utm_medium=banner&utm_campaign=community-oct20

It is calculated as [1 - (Imported/Consumed)]*100.

Has anyone scratched this particular itch before I lose sleep arsing around redoing the template of my solar percent sensor?

(to admit i’m poor at templating would be underselling it!)

# Renewables Percentage Sensor
  - platform: template
    sensors:
      daily_solar_percent:
        value_template: "{{ ((states('sensor.envoy_today_s_energy_production')|float * 100) / ((states('sensor.enph_envy_daily_consumption')|float * 1) + states('sensor.envoy_today_s_energy_production')|float))|round(1) | int * 1.5 }}"
        unit_of_measurement: '%'
        friendly_name: Solar percent