The Ability to Make a Rule to Control the Fan on the Thermostat

  • 109 Views
  • Last Post 14 March 2013
Axial-User posted this 19 February 2013

There might already be a way to do this......

I would like a way to have a rule control the fan on my thermostat. I would like to have it turn on every hour for a few minutes each hour to circulate the air in my house. The thermostat is upstairs and the basement can get cool so having the fan run every hour helps stabilize temperature in the whole house. Also I would like a way to program the rule not to run if the fan is already running. I have only made rules using scenes, but there is not option to change anything on the thermostat during a scene but Heat and Cool temps. Any ideas?

Order By: Standard | Newest | Votes
Ryan-Scott posted this 20 February 2013

There might already be a way to do this......

I would like a way to have a rule control the fan on my thermostat. I would like to have it turn on every hour for a few minutes each hour to circulate the air in my house. The thermostat is upstairs and the basement can get cool so having the fan run every hour helps stabilize temperature in the whole house. Also I would like a way to program the rule not to run if the fan is already running. I have only made rules using scenes, but there is not option to change anything on the thermostat during a scene but Heat and Cool temps. Any ideas?


You can do this with a script. You'll need to download version 2.210 then create a script called "ThermostatFanRunTimed.cs" and save it to your InControl's scripts folder. Here's the content of the script:


using System;
using System.Collections.Generic;
using System.Text;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;
using MLS.HA.DeviceController.Common.Device.ZWave;
using System.Threading;

///
///
/// IMPORTANT READ THIS!
///
/// ALWAYS MAKE COPIES OF SCRIPTS YOU INTEND TO CUSTOMIZE OR YOUR CHANGES
/// COULD BE LOST.
///
/// **********************
/// This script checks if the thermostat fan is on, and if not, turns it on
/// and runs it for a pre-defined amount of time before turning it off
/// again.
///
**********************
///
///

public class ThermostatFanRunTimed : ScriptBase, ScriptInterface {
public void runScript() {
try {
// Change this to match the nodeId of your thermostat
var thermostatNodeId = 67;

// Change this to match how long to run the fan
var runTimeMinutes = 10;

// *************
// Be careful if changing anything below here
// *************
var thermostatDevice = getNode(thermostatNodeId) as Thermostat;

// Activate the fan if it isn't already running
if (thermostatDevice.thermostatFanState != MLS.HA.DeviceController.Common.ThermoFanState.On) {
// Turn the fan on
dm.setZWaveThermostatFanMode(thermostatDevice.deviceId, MLS.HA.DeviceController.Common.ThermoFanMode.On);

// Sleep for a bit to let the fan run, then turn it off
Thread.Sleep(runTimeMinutes * 1000);

// Turn the fan off
dm.setZWaveThermostatFanMode(thermostatDevice.deviceId, MLS.HA.DeviceController.Common.ThermoFanMode.Auto);
}

} catch (Exception ex) {
// Log the exception here
writeFileLog("Error during thermostatFanRunTimed script", ex);
}
}
}




You'll need to modify the line that says:

var thermostatNodeId = 67;

Make it mach the node id of your thermostat. After that, setup a scene that runs this script as either post or pre, it doesn't matter. Finally, create your rule that repeats hourly and activates this scene.

Axial-User posted this 21 February 2013

The script seems to work but only runs the fan for 10 seconds. Any ideas why?

Also if the fan is already on the script turns it off after 10 seconds.

Ryan-Scott posted this 21 February 2013

The script seems to work but only runs the fan for 10 seconds. Any ideas why?

Also if the fan is already on the script turns it off after 10 seconds.


Oops, yes, slight calculation problem.

Change the line to:

Thread.Sleep(runTimeMinutes * 1000 * 60);

Axial-User posted this 21 February 2013

Okay. That worked for the time. How do I get rule to ignore if the fan is currently on.

Axial-User posted this 21 February 2013

I am not sure if this related but my thermostat (node 14) is throwing this error in the log file:
This has happened every 30 seconds since I installed 2.209. I am on 2.210


2/20/2013 7:49:42 PM: Device 14 command reports status of ResMissing
2/20/2013 7:49:51 PM: Device 17 command reports status of ResMissing
2/20/2013 7:50:12 PM: Device 14 command reports status of ResMissing
2/20/2013 7:50:41 PM: Device 14 command reports status of ResMissing
2/20/2013 7:50:42 PM: Device 14 command reports status of ResMissing
2/20/2013 7:51:12 PM: Device 14 command reports status of ResMissing
2/20/2013 7:51:43 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:05 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:07 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:13 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:43 PM: Device 14 command reports status of ResMissing
2/20/2013 7:53:13 PM: Device 14 command reports status of ResMissing
2/20/2013 7:53:44 PM: Device 14 command reports status of ResMissing
2/20/2013 7:54:14 PM: Device 14 command reports status of ResMissing
2/20/2013 7:54:24 PM: Device 21 command reports status of ResMissing
2/20/2013 7:54:43 PM: Device 14 command reports status of ResMissing
2/20/2013 7:54:44 PM: Device 14 command reports status of ResMissing
2/20/2013 7:55:14 PM: Device 14 command reports status of ResMissing
2/20/2013 7:55:45 PM: Device 14 command reports status of ResMissing

Ryan-Scott posted this 22 February 2013

I am not sure if this related but my thermostat (node 14) is throwing this error in the log file:
This has happened every 30 seconds since I installed 2.209. I am on 2.210


2/20/2013 7:49:42 PM: Device 14 command reports status of ResMissing
2/20/2013 7:49:51 PM: Device 17 command reports status of ResMissing
2/20/2013 7:50:12 PM: Device 14 command reports status of ResMissing
2/20/2013 7:50:41 PM: Device 14 command reports status of ResMissing
2/20/2013 7:50:42 PM: Device 14 command reports status of ResMissing
2/20/2013 7:51:12 PM: Device 14 command reports status of ResMissing
2/20/2013 7:51:43 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:05 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:07 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:13 PM: Device 14 command reports status of ResMissing
2/20/2013 7:52:43 PM: Device 14 command reports status of ResMissing
2/20/2013 7:53:13 PM: Device 14 command reports status of ResMissing
2/20/2013 7:53:44 PM: Device 14 command reports status of ResMissing
2/20/2013 7:54:14 PM: Device 14 command reports status of ResMissing
2/20/2013 7:54:24 PM: Device 21 command reports status of ResMissing
2/20/2013 7:54:43 PM: Device 14 command reports status of ResMissing
2/20/2013 7:54:44 PM: Device 14 command reports status of ResMissing
2/20/2013 7:55:14 PM: Device 14 command reports status of ResMissing
2/20/2013 7:55:45 PM: Device 14 command reports status of ResMissing


That script should already check to see if the fan is on and not run if it is. However, the above log could suggest that there is an issue polling your t-stat, so InControl may not actually know what state your fan is in. What kind of t-stat do you have? Is it associated to the USB stick (using the Associations button)?

Axial-User posted this 22 February 2013

I have a 2gig CT30. I do not have it associated with the controllor. It seem to be polling, because when I make any change on the Thermostat manually it with register with incontrol and the andriod app. It also show last poll time in the properities. How and what does associating the two together do? It possibly that the command to shut the fan off works whether it turns it on or off? Thanks for your help

Axial-User posted this 25 February 2013

I went to the associations button and I checked the box for the controller and the t stat but could not find any way to save it. If I x out of the box it would not save it.

Ryan-Scott posted this 25 February 2013

I went to the associations button and I checked the box for the controller and the t stat but could not find any way to save it. If I x out of the box it would not save it.


Are you clicking the T-stat, then choosing the association button on the t-stat's detail page? The save happens automatically, so if it's not working, then it probably means that:

1 - The device is battery operated and needs to be woken up first
2 - The device doesn't support associations
3 - You aren't using the beta z-wave controller

Most likely #2 is the problem.

For what it's worth, when you associate a device "1" to another device "2", you are basically telling device 1 to send reports and information about it's operation to device 2.

Axial-User posted this 25 February 2013

I was doing that. I opened the the assocation again and nothing would be checked so I assume it's not being done. Most likely the device.

Back to my main question of why the script still turns of my fan off if I have turned it on manually. Have you tried it on your system? Can you run the script and if your fan is already set to on the does the script turn it off? Instead of polling the device can it check the staus of incontrol? If Incontrol shows the fan is on not to excute the script. Is that possible?

Axial-User posted this 04 March 2013

Any more ideas on this?

Axial-User posted this 14 March 2013

Thanks to Ryan we figured this out, Atleast for the 2GIG ct30.

using System;
using System.Collections.Generic;
using System.Text;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;
using MLS.HA.DeviceController.Common.Device.ZWave;
using System.Threading;

///


///
/// IMPORTANT READ THIS!
///
/// ALWAYS MAKE COPIES OF SCRIPTS YOU INTEND TO CUSTOMIZE OR YOUR CHANGES
/// COULD BE LOST.
///
/// **********************
/// This script checks if the thermostat fan is on, and if not, turns it on
/// and runs it for a pre-defined amount of time before turning it off
/// again.
///
**********************
///
///

public class ThermostatFanRunTimed : ScriptBase, ScriptInterface {
public void runScript() {
try {
// Change this to match the nodeId of your thermostat
var thermostatNodeId = 67;

// Change this to match how long to run the fan
var runTimeMinutes = 10;

// *************
// Be careful if changing anything below here
// *************
var thermostatDevice = getNode(thermostatNodeId) as Thermostat;

// Activate the fan if it isn't already running
if (thermostatDevice.thermostatFanMode != MLS.HA.DeviceController.Common.ThermoFanMode.On) {
// Turn the fan on
dm.setZWaveThermostatFanMode(thermostatDevice.deviceId, MLS.HA.DeviceController.Common.ThermoFanMode.On);

// Sleep for a bit to let the fan run, then turn it off
Thread.Sleep(runTimeMinutes * 1000*60);

// Turn the fan off
dm.setZWaveThermostatFanMode(thermostatDevice.deviceId, MLS.HA.DeviceController.Common.ThermoFanMode.Auto);
}

} catch (Exception ex) {
// Log the exception here
writeFileLog("Error during thermostatFanRunTimed script", ex);
}
}
}


Close