Triggers with Required Expression

Just started trying out required expressions and am a bit confused. The rule I started with is shown in the image below. When I check the log it appears that the Action(s) don't run until:
1 Power Level changed (Trigger) (i.e from 6 watts - 600w)
2 If the change is less or greater than 5 the expression is set to True. (i.e Given the change in step 1 this would be set to True)
3. Another Power Level changed (Trigger) occurs. (600 watts - 6 Watts)

Only after step 3 do the actions actually run. This is not desirable for what I am trying to do here. How do I get around this?

The way required expressions work is they are evaluated before the event that triggers. So in your case the hot tub would have t o be greater than 11.1 or less than 1.1 and then change. Not sure that's what you're shooting for here. Maybe what you want is just two trigger statements?

2 Likes

Without wanting to read too much into your own requirements.... my interpretation of what you have configured in the rule would be:

Only trigger the rule when Iota_HotTub (actual reading) is 5 Watts either side of VS_HotTub Watts

  • Whenever the Iota_HotTub changes it's reading outside of the VS_HotTube +/- 5W restriction
    • Set VS_HotTub = Iota_HotTub

Now that I understand the rule definition.... I expect @brad5 is better placed to recommend Hot Tub rules.. I can only offer my interpretation of what you have created... which may or may not be correct :slight_smile:

1 Like

My hot tub automation is limited to temperature monitoring only. I may be under-achieving!

1 Like

Having one immediately elevates you to a higher status than me... :slight_smile:

1 Like

Well in this case it is merely setting the watts to a virtual switch which is linked via hub mesh to my other hub. The iotawatt device gets updated every 60 seconds and often the change is less than 1 watt. That said....
@brad5 answered my question with "The way required expressions work is they are evaluated before the event that triggers. "

1 Like

That's the crux of what I think we were both wanting to convey.... So good to hear you have been able to take that on board.

This rule was just an experiment with regular expressions. In my way of thinking I would have thought the expressions would be evaluated after the trigger not before. Not sure under what circumstances I would use this as I could achieve the same without it as shown below.

The required expressions would be evaluated when they change and turn the rule on or off, if on, then the triggers would be evaluated when the devices included change state

2 Likes

Ah... That makes sense. I could see a use for that

2 Likes