I did some digging myself when I recently started with home assistant.
It seems that the sunlight opacity sensor is derived from sun.sun and the Darksky weather integration as a combination of the position of the sun and the cloud coverage.
At least that is what I saw in another post.
sensors:
## Calculates daylight brightness out of 100%
sunlight_pct:
entity_id:
- sun.sun
- sensor.dark_sky_cloud_coverage
value_template: >-
{%- set elevation = state_attr('sun.sun','elevation') | float %}
{%- set cloud_coverage = states('sensor.dark_sky_cloud_coverage') | float %}
{%- set cloud_factor = (1 - (0.75 * ( cloud_coverage / 100) ** 3 )) %}
{%- set min_elevation = -6 %}
{%- set max_elevation = 90 %}
{%- set adjusted_elevation = elevation - min_elevation %}
{%- set adjusted_elevation = [adjusted_elevation,0] | max %}
{%- set adjusted_elevation = [adjusted_elevation,max_elevation - min_elevation] | min %}
{%- set adjusted_elevation = adjusted_elevation / (max_elevation - min_elevation) %}
{%- set adjusted_elevation = adjusted_elevation %}
{%- set adjusted_elevation = adjusted_elevation * 100 %}
{%- set brightness = adjusted_elevation * cloud_factor %}
{{ brightness | round }}
unit_of_measurement: '%'
device_class: 'illuminance'
sunlight_opacity:
entity_id:
- sensor.sunlight_pct
value_template: >-
{%- set sunpct = states('sensor.sunlight_pct') | float %}
{%- set opacity = sunpct / 100 | float %}
{{ opacity }}
Unfortunately it seems that the Darksky services has been limited and will be terminated by the end of 2022.https://www.home-assistant.io/integrations/darksky/ I am still looking for a suitable replacement but haven’t found a cloud coverage yet.