Efficiency question on checking state before setting vs just setting


#1

Looking to get some legs on understanding the best way to implement pistons.

Is it more efficient to set the state of a device regardless of the current state or to check and only set if needed.

thanks!


#2

The default behavior of WC is to do the checking (or perhaps the remembering) for you. So I say just set it.

If you ever look in detail at the full logs then you will see that WC will in fact disregard sending commands to devices if the command would not produce any change in the device. So WC is aware of the way a device is set.

In other words, if a light is already off and you tell WC to turn off the light, it will skip that command as it would not have made any change to the device. Adding in checking in this instance is unnecessary.

There may be times when you want WC to always send the command…but that gets into advanced stuff…which you don’t generally have to worry about too much (meaning too often).


#3

I had noticed the logs doing the check which is part of what prompted the question. thanks!