Last winter, a house that I rent out sustained 11 thousand dollars worth of water damage because an ice jam formed above the gutters. I learned a lot about how this happens during the ordeal. Heat from the house melts the bottom layer of ice & snow on the roof. The water from the melting trickles down the roof, but once it gets to the eaves (away from the heat because the eaves are not enclosed and extend away from the house), it freezes and forms a dam. Since the water has nowhere to go, it backs up from the eaves between the roof and the ice above it and gets under the slates/shingles.

My tenants didn’t notice the water coming in in the dining room through the ceiling and walls until the damage had started showing on the first floor. Once I was alerted, I hired a company to come and remove the ice dam above the gutters.

The conditions needed for an ice dam/jam to form on the roof are 4 or 5 days where the temperature never gets above freezing and ice or snow has accumulated on the roof. Dealing with the ice jam was such an ordeal that this year, I wanted to figure out a way (or ways) to get an early warning that an ice jam could be forming.

I had an idea to use a moisture sensor in the windows that would sound an alarm if water made contact with the sensor. There was one window in particular where the water built up the most, so I bought this cheap moisture sensor (only $12) and installed it between the window and the storm window:

However, by the time it goes off, a good bit of damage will have occurred already. That makes it a good backup, but I needed something predictive. Long ago, I had tried looking into the possibility of getting weather alerts when the temperature stays below freezing for multiple days, however after installing tons of apps and even looking into IFTTT‘s weather channel, the best alerts I could find were when the temperature went below freezing on a single day. So today I finally sat down and rolled my own way to get an alert after 4 or more days of freezing temperatures in a row.

The basic idea was, I wanted to use IFTTT‘s weather channel to add tomorrow’s high temperature from the forecast to a google spreadsheet every day. I then would create a google script attached to the spreadsheet to email me when the last 4 entries in the spreadsheet all had values below 33 degrees (F). The script can be set to be triggered whenever a new row is added.

The first hurdle I faced was that IFTTT only lets you set 1 location for weather alerts and I already have my location set to where I live (not where the house I rent out is) and I already have weather recipes that rely on my location (e.g. when the pollen count gets high, turn on my air filter). If I was to change the location, all my recipes would use the new location, which made no sense. So I posted to the reddit IFTTT board and found out from the suggestions there that you can create multiple IFTTT accounts connected to the same gmail address by using gmail’s magical “+” feature. So if your gmail address is johndoe@gmail.com, you can register an alternate IFTTT account using johndoe+ifttt1@gmail.com. Note, after you create the account, you’ll need to go into your account settings and change your default username from “johndoe+ifttt1” to something like “johndoeifttt1” because IFTTT complains about the plus sign.

Next, you must create an IFTTT recipe (now called an “Applet”). The trigger will be the weather channel’s “tomorrow’s forecast” trigger and the action will be to add a row to a google drive spreadsheet. The settings when you’re done should look like this:

Note, you might need to add the Google Drive and WU Weather channels (now called “Services”) to your IFTTT account. Make sure to go into the weather channel’s settings to ensure it’s set to the correct location and that you’ve given IFTTT‘s google drive channel permission to access your google drive.

Next, you’ll need to create a google drive folder named “IFTTT” (or whatever you entered in the recipe above). In there, create a spreadsheet with the name you used for the IFTTT recipe.

You then need to add a script to the spreadsheet. In the google docs tool bar, select “Tools->Script Editor…”. Replace the code there with the following code, but be sure to enter your email address you want to receive the ice jam warnings. Click the image to access copyable code on pastebin:

Save the script, click the “Select function” drop-down list, select the “createSpreadsheetChangeTrigger”, and click the play button.

You can now close the script editor window and test out your spreadsheet by entering temperatures in the first column. I entered “22”, 4 times to test it out. 2 things should happen upon entering the 4th value:

You receive the email alert Column 3 gets the value “ ICE JAM WARNING!”

Now, when IFTTT adds a row, if it’s the fourth or more day in a row of freezing temperatures, you’ll get an email warning that maybe you should check for an ice jam!