Check out a video demo of this functionality here.
Get the current state of a sensor and get it back as a local variable you can access in the same task.
Use the magnifying glass to find out which sensors your device has.
Some sensors will report their state right away while others might need a state change to report it.