# Convert the Hue light level to actual lux value

Hi,
Since the Hue motions sensors have been added to the current Hue integration, the conversion of the light level to lux from @robmarkcole is not transferred to the integration.

Therefore, I am now looking for a way to convert the present value to the real lux value corresponding to this conversion:

But how do I translate this into a template sensor? I have made an attempt, however, without success?

{{ ((states(‘sensor.office_light_level’) | float | round(2)) - 1) / 10000 }}

you’re missing the 10 to the power of the eq

``````{{ 10**((states('sensor.office_light_level') | float - 1)/10000) | round(2) }}
``````

Hi Petro, I just tried that. Gave me a result of 1.0 which don’t make any sense in a room with light.
The raw value from the light_level is: 8.485940

Im seeking the old value which varied between 0 and 30.000 (indoor)?

are you trying to reverse the equation? I.E. The value you gave is the lux and you’re searching for the light level?

Yes I’m trying to reverse as he did in his custom sensor script. The current value I get is a light level and I want it to be as the old lux value. The script I posted above is the conversion to lux from light level (I assume).

It’s been a long time since i’ve dealt with exponents in math but I’ll give it a whirl

``````{{ 10000*log(states('sensor.office_light_level') | float, 10) + 1 }}
``````
1 Like

The value output from the new integration is already the lux value. The complication being that in the custom component the words ‘light_level’ meant a raw value that needed converting into lux, but in homeassistant ‘light_level’ is a level of light measured in lux.

You do not need to make any conversions if you want a lux value as you say.

Petro you’re my man! That did the math!
I’m back to the old lux range and varies between 0 and 30000 instead of 0 to 800.

Thank you!

1 Like