ZigBee commands not always working, working on Thermostat device handler

I have been working on a Thermostat device handler for the Centralite ZigBee thermostat that is used with Xfinity. I code all the code from the forum, been cleaning up some things, working on the UI, and I have it running really well.

The issue… Many times the commands simply do not work, maybe 30% of the time. I know this is a thing, and I even noticed it from the UI on the Xfinity controller when I used it there, but somehow when it came to scheduling and thermostat control not from use interaction, it always worked on xfinity system.

So when I tell it to set my temp to something when away and set it back when I get home, and that doesn’t work and I don’t realize it, then it gets really hot.

So I’m curious how it must have been solved.

Could I just send each command once, wait 2 seconds, and always just send the same command a second time? I haven’t had it fail twice in a row yet, so that might fix it.

What are others doing?

I don’t mind when hitting temp up/down having to hit it twice, it’s all about when doing schedules and away/back settings where it failing once can really mess up your entire system.

It never seems to fail on light switches, which are also zigbee, but those handlers are using smartthings methods, my handler is writing the “str wattr” commands directly.

thoughts?