Setting up gutter heat trace tape

Good morning,

This is one of the first scripts I am writing for Hubitat. If you have a minute to check it, I would appreciate it.

I have a gutter heating system that I would like to operate when there is snow between the tempratures of 10 degrees and 35 degrees, for at least 6 hours.

The script I have come up with is:

My understanding is that this would trigger the heat trace to turn on for 6 hours, and then it would turn off. If the conditions for triggering the heat trace remained after 6 hours, it would then turn the heat trace back on.

Am I correct?

If I added:
OR WX weather contains rain
would that supersede the temperature requirements or keep the temperature requirements and trigger for both rain and snow?

Thank you.

Nothing will trigger that rule unless you define any trigger events. We can't tell from that screenshot. Can you share the entire rule?

Also, the UI is giving you a hint here that something is wrong: see the red "Broken Condition"? Either fix that condition (on the Manage Conditions page) or at least remove it from this expression, depending on what you're trying to check for.

Finally, I suggest to finish off your IF THEN with an END-IF just to get the habit of correct syntax, even though it won't matter since you don't have any actions after it in this particular rule.

There could be more, but again, seeing the whole rule will allow someone to see for sure.

2 Likes

I'll second @bertabcd1234 's recommendation to post the entire rule. One other thing that's likely to come into play is your specific trigger. It seems like a "periodic" trigger may be appropriate (evaluate once every hour for example). There does need to be some thought regarding cases where a rule can be "retriggered" before execution of the first instance has completed.

you could use a rule.. but i have an app i wrote for this a long long time ago back in the smartthigns era after my roof got an ice damn because i forgot to turn it on after a snow storm and subsequent melt.. i figured it was better to waste enegy than fff up my roof again..

if you search in package manager it will be there.

i didnt bother with sensing snow as the problem is not when it is snowing but when you get a ton of snow on the roof and next time it warms up and it starts melting.. (that could be days later) at least it was in my case.

1 Like

Thank you all. I've reworked things, given a better understanding from what I've read in this thread.

@kahn-hubitat, your app looks fantastic. I will probably spend time deconstructing it as a lesson, but I need to be able to add the temperature controls.

Below is what I have, my issue is that I want to create a second "IF" for if conditions are not met to re-try in an hour. Alternatively, if I can add, "if trigger conditions are met, attempt program every hour," that would also work.

I've read some bits about Boolean, but do not fully understand it. From what I've read, I should be able to create a boolean that would say, "If the temp is between A and B, then true," but I can't seem to figure out how to write that script.

I appreciate the helpfulness of this community.

I'm on my phone at the moment and unable to provide an example, but your rule seems overly constrained to me. For example, you shouldn't need to include "snow" as a trigger AND in your IF statement conditions.

This is easy to accomplish using the "Required Expression" feature in Rule Machine. For example, you could use a periodic trigger to run the rule every hour along with a required expression that "snow" is in the forecast. This will result in a rule that runs every hour, but only when snow is in the forecast.

The most applicable for this rule seems to be the "private" boolean. When false, the private boolean prevents a rule from re-triggering. A common practice is to "Set Private Boolean to FALSE" as the first action in a rule to prevent running multiple parallel instances of the same rule. Resetting the boolean to TRUE is usually the last action of such rules.

There may be some other issues as well. The placement of your repeat may not work as you expect, you should include an END-IF, and possibly others.

If it all seems like a lot to process, it is. Don't worry, though. After you've got a couple rules under your belt it gets easier. I'll try to follow up with an example later if i have time.

1 Like

it does the temp. stuff internally that is what the turn on and turn off temps do.

1 Like

@kahn-hubitat, I'm sorry, I misspoke. I need the forecast bit. We go weeks between precipitation, and I don't want to heat the outside when there is no new snow.

@dylan.c, the END-IF command is exactly what I was looking for. Thank you.

Looking at what you were saying about constraints, if I am running the program for 6 hour after the snow falls, I don't actually need to repeat it. The next time the trigger happens, the program will restart.

The issue arises if the system triggers a new snow event during the cooldown, so I created a new IF to check that a new snow event has not started before shutting the system down. It would then repeat the cycle an hour later to check on the temperature until the triggers are not in effect.

Is that correct?

ya good luck i figured that but wanted to set the record straight ,, but good luck with your rule.. i had a similar rule but here in nh it can be cold for weeks and as i said that after the snow during the melt phase was when you get ice damns and that can be weeks later here.

after my rule didnt work and i chopped up the roof and the heat coils (with an axe) stopping the water coming in. i bit the bullet and wrote the app just based on temp during the winter so it would never happen again.

I think I would approach this rule a different way. Not saying yours is wrong...there are multiple ways to accomplish any given task in RM. This one just suits my way of thinking about the intended outcome...


Stepping thought it piece by piece...
Required Expression: Using your desired temp range and forecast condition as required expressions will only enable the rule to execute when those conditions are met. Any other time the rule will simply not run.

Trigger: I have it running at defined times of day (every hour, on the hour). This might be overkill. Another approach is to use the "Every 1 hour(s) starting at 12:00 a.m. " Probably no functional difference. Either way, if the the required expression is FALSE (temp out of range or no snow in forecast), the rule does not run.

Actions:

  • First step sets the private boolean to false to prevent multiple instances of the rule from running.
  • Next we turn on the heat trace (Relay2).
  • Now we wait until either the forecast changes or the temp moves out of range. If neither changes within 24 hours, we assume something is broken and move to the next step.
  • Now that its stopped snowing, warmed up, or cooled off, we wait another 6 hours for good measure.
  • Finally we can turn off the heaters. Worst case scenario, they've been running for 30 hours.
  • We set the private boolean back to true and the rule is allowed to run again. You can disregard the 15 second delay...that snuck in at the end and isn't needed.

The way my example is structured, the heater will turn off and then back on at the next triggered time...up to one hour later. If you want to keep the heater on the whole time, you would just move the "Set Private Boolean to TRUE" before the "Wait for 6 hours" action.

I like this. There is an elegance to this approach that mine completely lacked. Thank you.

Heated gutters? That's an amazing idea.

/ something new every day

@djh_wolf, They work well, but it is a sub-optimal solution. You are essentially running a radiant heater on the outside of the house. When I get mine going, they burn about 1.2kWh per hour.

If you have access to your attic, insulation/ventilation is much better bang for your buck with preventing ice-dams. I have scissor joists, however, and there's not much I can do without much more major work.

1 Like

Do you have automatic controls with a temperature/moisture sensor? I have a walkway heater with automatic controls. The sensor doesn't know snow from flurries, so what I do is let it run automatically, but I get a notification when it turns on and will often turn it off.

Makes sense. Not an issue in my neck of the woods, I just thought it was interesting.

The main difference is taking advantage of the "Required Expression" and "wait for Expression" features. These are basically short-hand ways to replace the IF statements and repeats that you were using.

My example could probably be trimmed down even further by removing the "wait for Expression" bit (and the associated conditions) and the private boolean lines. I think it would work exactly the same but without the "safety" privided by the timeout. Don't take my word for it though... be sure to test it in your environment.

1 Like

@bill.d Nope. I have a heat trace directly wired to a circuit breaker. I added a switch to the line. Even worse, I am pulling weather data from flatlands 7 miles down from the valley I live in, so my weather data is being pulled from a different microclimate.

It's far from ideal. I'll be getting a local weather station at some point.

A note for anyone who finds this thread and wants to use the code: since everything is case sensitive, you need to account for both "Snow" and "snow" (the second for when the WX device reports "Light snow."

1 Like