Control brightness by from_state and to state

Hello,

I have found the solution of my last project but now I would like to control the light brightness’s with an automatisation. It will look like to:

When: sensor.lightsensor_eclairement state changed from 7lux

Action: light turn on at 6500 kelvin and the brightness step is 1% or -1% (depending if brightness is decreasing or increasing)

But I dont know how to arrive to write it, using trigger from_state and trigger.to_state to calcul if the brightness is increasing or decreasing

Thank you for your help

Not sure where you are stuck.
If trigger.from_state.state < trigger.to_state.state, it’s increasing…

Bonjour, je suis coincé sur l’écriture (le codage) du value_template pour si la valeur rend une valeur égale a vrai avec from_state et to state pour récupérer ancienne valeur et nouvelle valeur de mon capteur de luminosité . Je voulais faire pareil que vous mais jamais la condition déclenché l’automatisation