Before you can do anything with temperature information, you have to get it into HomeVision. There are several ways to do this:
Track High and Low Temperatures
It's often useful to track daily high and low temperatures. To do this, create a variable for each. Then, update these each time you read in a new temperature. For example, the code below can be used in a periodic event that reads an analog temperature sensor every minute.
Var #1 (Current temp) = Analog input #1 (LM34) If Var #1 (Current temp) > var #2 (Daily high temp) Then Var #2 (Daily high temp) = var #1 (Current temp) End If ; If Var #1 (Current temp) < var #3 (Daily low temp) Then Var #3 (Daily low temp)=var #1 (Current temp) End If
You must also reset the high and low temperature variables at the end of each day. This is best done in a scheduled event that performs the following commands at midnight:
Var #2 (Daily high temp) = var #1 (Current temp) Var #3 (Daily low temp) = var #1 (Current temp)
Weather Conditions TV Screen
The weather conditions TV screen can display a variety of weather data, including temperatures. An example screen is shown below:
Current inside temp = var #1 (Current temp) Today's high inside temp = var #2 (Daily high temp) Today's low inside temp = var #3 (Daily low temp)
You can do the same thing with the outside temperature readings as well. Note that if you don't have access to the non-temperature data, you can leave them blank on the screen.
Display Temperature on the TV
Another use is to display the current temperature overlaid onto the TV channel you're watching. You can create a periodic event that runs every hour and put the following commands in it:
Video: Start external video mode Video: Display video screen # 0 Video: Set cursor row to 11 Video: Set cursor column to 1 Video: Display last 2 digits of var #1 (Current temp) Wait 0:00:30.00 with timer #1 (Display temp), then: Video: Stop video mode End Wait
These commands start the external video mode and display a blank screen (# 0) for you to write on. They put the cursor in the lower left screen corner, then write the current temperature. Finally, they start a timer which will shut the screen off after 30 seconds. Thus, the periodic event runs every hour, each time displaying the temperature overlaid onto the video source for 30 seconds.
Automatic HVAC Heat/Cool Changeover
HomeVision can control multiple thermostats to different daily time/temperature schedules, and set them back when you leave home. One useful thing you may want to also do is automatically switch your HVAC system into the proper mode based upon the actual temperature. The example below shows one way to do this.
If HVAC zone 1 current temp is > 78 Then ; Ensure we're in the cool mode: If HVAC zone 1 system mode is off Or HVAC zone 1 system mode is heat Or HVAC zone 1 system mode is auto Then Set HVAC zone 1 system mode to cool ; Ensure temperature setpoint is correct: If Flag #1 (At Home) is set Then Set HVAC zone 1 to scheduled temp Else Set HVAC zone 1 temp setpoint back End If End If End If ; If HVAC zone 1 current temp is <70 Then ; Ensure we're in the heat mode: If HVAC zone 1 system mode is off Or HVAC zone 1 system mode is cool Or HVAC zone 1 system mode is auto Then Set HVAC zone 1 system mode to heat ; Ensure temperature setpoint is correct: If Flag #1 (At Home) is set Then Set HVAC zone 1 to scheduled temp Else Set HVAC zone 1 temp setpoint back End If End If End If
It's best to put these commands in a periodic event that runs each minute. If the temperature is above 78, it makes sure the HVAC is in the cool mode. If not, it puts it in the cool mode, then makes sure the temperature setpoint is correct. If we're at home, it's set to the temperature specified by the current schedule. If we're away from home, the setback temperature (a higher temperature to save energy) is used. The heat mode is similar.
Note that the setback temperatures and the temperature schedule are specified elsewhere; this code just shows how the changeover is made. Also note that the thermostat commands shown here are new to HomeVision version 2.5.
Overtemperature and Undertemperature Monitoring
You can easily check to see if the temperature reaches an extreme that requires you to take special action. For example, you could monitor the indoor temperature while away from home to see if it drops below freezing. Or you could put sensors in your refrigerator and freezer to detect failures.
You might sound an alert if any of the temperatures exceed preset limits. This works well if someone is at home to see or hear the alert, but what if no one's home? How can you report these conditions? Here are a few ways:
Report Data to Computer
HomeVision can transmit the temperature data to a computer and write it to a text file. Create a periodic event that runs every 5 minutes and transmits the temperature and current time. If you write it in the proper format, you can then import the file into an Excel spreadsheet. Since HomeVision can control programs on the computer, you could even automate this. Every day at 6:00 AM HomeVision could import the latest file into Excel, graph it, then print it for you to review later!
This only scratches the surface of how you might use temperature data in home automation. Let us know if you come up with other interesting ideas.