Help with Light and binary sensor

I’m stuck on the following situation:

I’m trying to controlling a kitchen Extractor lights.
I used a 4n25 Optocoupler , the extractor push micro switch is now connected to the ESP8266 and im able to control it using a GPIO binary_sensor.

The problem is that the extractor lights are controlled by pressure time and they have 100% and 50% light, with this combinations:
If Lights are off
on/off time is 800ms → 100% light
on/off time is >2.1s → 50% light
If lights at 100%
on/off time is 800ms → lights off
on/off time is >2.1s → 50% light
if lights at 50%
on/off time is 800ms → 100% light
on/off time is >2.1s → lights off

Now. how can i add a light switch that gives me the status of the light so that i can control it from HA?

I know pressure time because I have a duty_time at “on_press” and at “on_release”