@theolodian If you want an example to reference have a look at my repo for the MQTT4DSF project. It's depreciated now, but its written in python and uses the API for talking to DSF, and should still be functionally relevant.
The API allows you to "subscribe" to the keys in the object model you want to monitor and will push updates when the values change. It can also handle executing gcode commands.