What is the primary function of a smoke alarm in a residential setting?
a) To regulate indoor temperature
b) To detect and alert occupants to the presence of smoke or fire
c) To monitor air quality and humidity levels
d) To control the lighting and electrical systems