Help with rule to De-ice hose

Hello,
I have an ambient weather station which Habitat has access to its output. I want a rule that says if the outdoor temperature drops below 34 degrees an outlet turns on (hose tape warmer for my ice machine that drains outside), stays on the entire time the outdoor temperature is below 34 degrees and turns off when the temperature goes above 34 degrees. I have a rule working, but it sends on and off commands every 7 minutes. What am I doing wrong, and how can I fix it? Screen shots below.




Every time the weather station reports under 34 it will trigger and no doubt your weather station sends either periodic reports, reports on a change, or both so it triggers constantly with each report. The way around that is to use a required expression with a private boolean:

Required expression :

  • temp >=34
  • private boolean true

Trigger:

  • temp <34

Actions:

  • set private boolean false
  • turn on drain hose
  • wait for event temp >=34
  • turn off drain hose
  • set private boolean true

That will only trigger once as it goes below 34 and cannot run again until the rule completes.

3 Likes

Thank you! Below is the screen shot I now have for the rule. Please review if you could.
2 questions: 1. I added a command to turn it off. Will this work, or should I use a separate rule?
2. The boolean condition just keeps the rule from triggering every 7 min when the weather station sends an update?
Thank you again for helping me.

You've made a mistake with the overlap...

You can't have >= in the required expression and <= in the trigger. Re read what I posted

  • greater than or equal to 34 in the required expression
  • less than 34 in the trigger

That's critical to ensure you only capture the transition. In your example the value 34 is in both because of the = in both.

Yes - I added the 'off' in my example. Don't do that in a second rule. The whole idea is that the single rule once triggered runs to the end.

The boolean prevents the rule retriggering period...until it is true again.

  • The boolean starts true and the temp is above or equal to 34 so the required expression allowing a trigger is met.
  • With the very first report of a temp under 34, the rule triggers and the required expression goes false as the the temp is no longer greater than or equal to 34.
  • The actions occur and the first setting the boolean further prevents another trigger, allowing all actions to complete.
  • The temp rises above or equal 34 so the pump stops and the first part of the required expression is met
  • It then turns the boolean true so the second part of the required expression is met.
  • Only now can it re trigger again if the temp falls
1 Like

I have a similar rule to turn on heat tape for my water main (which is above ground, but insulated).

Perhaps it will be helpful. I've pasted it below:

Just wanted to add; in this particular situation, "Wait for Event" and "Wait for Expression" are equivalent. But there is a difference in how they work, explained in this post by @bertabcd1234

2 Likes

or use the app i wrote for this eons ago..

1 Like

Thanks for all of your help. Updated screen shot is below. Based on the logs, I'm not getting the activation that I was before. It's supposed to freeze tonight, so I'll see if the rule fires appropriately. I appreciate the explanations of how the rule works, your patience, and the examples you posted.

Aaron

1 Like

You need to remove the temperature restriction in your required expression.

If you don’t remove it, your rule will never trigger.

1 Like

If the required expression has a temp >34 and the trigger is <34, then the rule will never run.

Because when the temp is <34, the required expression will be false, so the rule cannot be triggered.

This was all covered in another post....it will. When it's 34 or over it can trigger. At the instant that a value is reported under 34 it will trigger on that incoming report and then go false.

I read that post. I'm dead certain it will not.

The required expression has an AND, not an OR. So for the trigger to work, the PB has to be TRUE and the temp has to be >34.

Well, the trigger is <34.

So, when the trigger can be active, the required expression will be false.

In that post someone proved it with virtual devices and logs. If it didn't work my lights wouldn't have been working for 2 years

Not at the precise instant that the value is reported

You're using that specific temp logic in a rule? Or some other device?

I do it with luminance

At that precise instant, the required expression turns to false. I've played with this and temperature. Doesn't work.

....and at that same precise instant the rule triggers.

I'll set it up with virtual now and post logs (for the sake of my own sanity :rofl:)

Yeah - I don't see that with temperature. Or with a "windSpeed" attribute.

Here is a rule I use for my chicken coop heater which is a pretty close parallel to the OP's need. Turn on a switch at or below a certain temp, and turn it off at or above another temp.

This rule fires only once when the temp drops below the trigger point. Once the switch is on, the rule doesn't continue to fire due to the required condition. It waits for the 'off' temperature to occur, then turns the switch off, which re-enables the rule. There is no need to use a PB when the state of the switch performs the same function.

If you take out my notification lines, this rule is as simple as it can get. One required condition. One trigger. Three actions... On, Wait, Off.

2 Likes

I really think you would find it easier to use Webcore instead. It has cases for rising above and falling below, so no boolean needed and simple to read.

I made the automation (ignore the Island lights, that would be your warmer switch)