Sure you can have access to sensors and data in your device via termux
Make sure you install the termux API add-on
You also need to install the termux-api package as shown in this screencast.
There will be a bunch of new termux-* commands, to access different aspects, sensors and data in your device. I use most in conjunction with the jq package to parse the json they output most of the time