Door lock detector based on analog hall effect sensor

Lock state sounds like a job for a template binary sensor, which would use your hall_sensor.

You could set up the light a few ways. Output is fine. Or mark the switch as internal.

To interlock the light with the lock, use on_press and on_release actions to switch it on/off.

You may also be interested in the door lock sensor here.