Tracking light brightness with a timer/script - possible?

I have Aqara no-neutral wall switches controlling ceiling light fixtures with non-replaceable LED lighting. This works great, but the light fixtures have a feature where if you switch them off and then back on within 3 seconds, they light up with a lower brightness (in three levels). Is there any way to program Home Assistant to be aware of this to (for instance) tell it to switch the light to middle brightness? Then it would switch it off/on based on the current known state until getting to the desired brightness?