The issue is that the device's values and states are not updated in the same thread. Its a confusing issue.
The new value won't be reflected until the device executes that method again.
I have a method I'm working on to turn on a bunch of lights and verify they are on and try again if not. To do that I can only do it by executing the method in a loop using the runin command. Below is a very ruff pseudo code of what I do (minus all the logic behind checking and stopping the loop etc).
The runin command will reload the states before the next execution of the method.
def turnOnDevices() {
if devices are not on then
turn on devices
runin 3s turnOnDevices
else
All are on and we are done
More details in thread below. Somebody else was having a similar issue.