cancel
Showing results for 
Search instead for 
Did you mean: 

Script Help for automatically turning on/off fan with thermostat state.

Jmahoneyy
Community Member

1. I want an overhead smart fan to turn on when my thermostat turns on the furnace.

2. I want an overhead smart fan to turn off when my thermostat turns off the furnace.

 

I got #1 to work using this script:

 

 

starters:
- type: device.state.TemperatureSetting 
state: activeThermostatMode
is: heat
device: Main Level - 1 Family Room


actions:
- type: device.command.OnOff 
on: true
devices: Fan - 1 Family Room

 

 

I am having trouble with #2

 

 

starters:
- type: device.state.TemperatureSetting 
state: activeThermostatMode
is: on
device: Main Level - 1 Family Room

actions:
- type: device.command.OnOff 
on: false
devices: Fan - 1 Family Room

 

 

I have also tried 

"activeThermostatMode" is "off".

1 REPLY 1

robbygomez36
Community Member

Give the two scripts below a try.. I have Gen 3 Nest Thermostat and a Meross Fan Control wall switch. If it is winter time, then you have the Nest set to heat. Thermostat mode is always set to Heat in this case. ActiveThermostatMode is set to "heat" when the furance turns on. ActiveThermostatMode is set to "none" when the furance turns off since it reached the setpoint. The annoying part is that when you use the script editor autofill for ActiveThermostatMode there isn't a "none" value available so you can't use it in the script editor because it will throw an error. I used the isNot operator since I couldn't query for the HVAC fan on/off status and I couldn't figure out a way to compare the temperature setpoint and the ambient temperature .

metadata:
name: Fans OFF when Heat OFF
description: turn off fans when hvac heat is off
automations:
- starters:
- type: device.state.TemperatureSetting
device: Nest Thermostat - Hallway
state: activeThermostatMode
isNot: heat
actions:
- type: device.command.OnOff
devices: Fan - Office
on: false

metadata:
name: Fans ON when Heat ON
description: turn on fans when hvac heat is on
automations:
- starters:
- type: device.state.TemperatureSetting
device: Nest Thermostat - Hallway
state: activeThermostatMode
is: heat
actions:
- type: device.command.OnOff
devices: Fan - Office
on: true