Replacing SPST light switch with Occupancy sensor
You will need to determine which of the black wires on the original switch is the always hot feed. A voltage meter would be very helpful in determining this. Once you establish this, hook that black wire to the black,line, wire on your new switch. Hook the other black wire to the red, load, wire from your new switch and then hook up the ground wire to the metal box or to the bare copper wire.