Syncing Cloud Refreshes and Ad-Hoc Commands

I am developing a thermostat driver that is predominantly cloud-based and want to make sure that regular polling of the cloud API for any status changes (temp, mode, etc) does not conflict with changes requested through RM rules or dashboard interactions. Does anyone have any tips in achieving this?

I'm assuming the predominant scheduling mechanism will be the runInX methods, which I have yet to fully research or implement in my driver... I'm interested to know how developers manage these setups with ad-hoc requests...