Dim lights with Lux sensor

I recently bought an aqara motion sensor that also has a LUX meter.
I would like some of my lamps to change their brightness depending on how dark it is.
I have searched the forum and searched online for it but have not succeeded.

My thought is that, for example, when it is 500 lux, the lighting should have 40% brightness and if it is instead 400 lux, it should increase to 50%.

would be very grateful if someone could help me with this or say that it does not exist so I can stop looking :slight_smile:

There’s one disadvantage to use the Aqara motion sensor as luxmeter: it sends the lux value only along with motion events.

F.i. if motion was detected in the dark, the lux value will change to 0 lux; in bright sunlight it will still be at 0 lux, until a motion is detected, then it changes the lux value to the actual lux value.

Flows can be like this:
Flow 1
sensor lux value gets below 500
Dim light to 40%

Flow 2
sensor lux value gets below 400
Dim light to 50%

When i used HA i found that when the lights are on, the lux value of the sensor also increased by the lights that are turned on.
What i did was creating a separate lux sensor somewhere facing to the outside and use that value to set a variable “dark” to true for the whole home