[BUG?] refresh() by runEveryXXMinutes() ignores commands that are executed by a manual refresh()

Hi There,

Making @nayelyz and @jody.albritton aware of a weird behavior I’ve seen that I can only think it’s a bug,

when running a refresh() that has a delayBetween(), with multiple zigbee.readAttribute() commands, this happens:

  • if the refresh() is called by runEveryXXMinutes(), it will only execute one zigbee.readAttribute() command out of 4 (always the same one)

  • if the refresh() is called manually by dragging from top to bottom the device page for a manual refresh, it will get 3* out of 4 of the commands.

  • I’m almost sure that using zigbee.onOffRefresh() means you will never see the on/off zigbee response using the parse() method.

Screenshot:

DTH Code: https://raw.githubusercontent.com/cristianhares/smartthings/main/devicetypes/chares/xiaomi-zigbee-smart-outlet/xiaomi-zigbee-smart-outlet.groovy

It sounds to me like a bug on the delayBetween when its inside a refresh, called by different functions (an actual manual refresh, vs a scheduled delay), or am I doing something wrong :woozy_face: ?

Can you take a look at it? Thanks!

Are you relying on the debut console output to determine if the commands are executing? If so that is not reliable. The debut console won’t print every debug messages if the server is overloaded or there are too many messages to print in the buffer.

Partially, but I can easily see the behavior happening in the App, and the events that are created on the device,

So I know this is happening and want to know if its a bug of the platform (like why does it executes 2 refresh() commands sometimes), or is an undocumented incompatibility of the java groovy methods used.

I’ve seen the debut console print the same log message twice when the servers are out of sync due to timing issues I suspect. You could be running into that. The only way to know for sure is to keep a running counter and print it.

Yup, I know the action itself happens twice, and its not just a timing issue unfortunately :frowning:

For the moment I don’t fully mind that an actual action runs twice like the refresh(), I’m more concerned on why a refresh() command would run differently when scheduled vs manual.