Old way Vs new way. is it worth re-writing this or other rules?

IMHO, this has to be one of the "Best questions asked so far!"
and
some of 'The Best' answers I've read too.

Well done @april.brandt @aaiyar @jercloud @HAL9000

1 Like

Mental hurdle question in #4:

In your conveyor example, your example should be something like comparing apple ripeness, which would compare more closely to your power example (namely because power reports often): "Is the previous apple more or less ripe than the previous one?" ... this would be the equivalent to "changed". So, basically every time an apple goes by, the ripeness has changed. So, the answer to your first question is almost always "yes", meaning you then have another decision to make: Is it too ripe ... or not ripe enough. So, every time an apple goes by, you're making 2-3 decisions (Changed? Too ripe? Not Ripe enough?)

The other option is to simply look at the apples and make the ripeness decision straight away: Too ripe? Applesauce. Not ripe enough? Apple juice. In this scenario, you're only making 1-2 decisions per apple.

Now, in terms of Hubitat, there is a not insignificant chance that these comparisons have differing impact on the system, though it would be challenging to compare this, since we are not given any hub performance data to work with. So, we can assume they're identical system impact wise, but I'd assume the triggers are more efficient, if anything.

Kindof like having loops: a "For ii = 1 to 1,000,000 ... Next ii" is generally more efficient than "Do ... ii += 1 ... While ii >= 1,000,000". They're doing the same thing, but one is doing more stuff.

I'm not sure about the CPU impact, but anything that "does" something will generally be a large computational hit, versus something that simply "thinks" something. So, your changed rule will, every time wattage is over 71W, keep setting BOOLEAN back to TRUE even though it's already true. It might be prudent to put in a "If PS2 > 71W AND BOOLEAN = FALSE THEN" to eliminate re-setting the boolean. Now, in terms of a variable, probably not a big deal. But if that were a light bulb, setting it to "on" when it's already "on" would not be a good idea.

Also, why the 2W gap?

The 2w gap is the difference between the PS4 being on and playing or being on but I'm rest mode downloading updates or something. So Even though it's using power I don't want the automation to run.

1 Like