# Get the two humidity values
bathHumidity = indigo.devices[288098054].sensorValue # ID of bathroom humidity device
bedroomHumidity = indigo.devices[1185510746].sensorValue # ID of bedroom humidity device
# Calculate the difference and check to see if it's greater than or equal to 20
if (bathHumidity - bedroomHumidity) >= 20:
# Difference is greater than or equal to 20, so turn on the device(s) for 5 minutes
indigo.device.turnOn(404137540, duration=300) # ID of exhaust fan
indigo.device.turnOn(116176458, duration=300) #ID of toilet fan
indigo.device.turnOn(404137540) # ID of fan
indigo.speedcontrol.setSpeedIndex(123, value=0) # turn off
indigo.speedcontrol.setSpeedIndex(123, value=1) # low
indigo.speedcontrol.setSpeedIndex(123, value=2) # medium
indigo.speedcontrol.setSpeedIndex(123, value=3) # high
# Get the temperature value from the sensor and get the setpoint value from the setpoint device.
RoomTemp = indigo.devices[1770450782].sensorValue # ID of the Temperature device
RoomHighSetpoint = indigo.devices[1254352989].brightness # ID of the variable setpoint
#calculate the difference and check to see if it is greater or equal to 0
if (RoomTemp - RoomHighSetpoint) > 0: # Difference is greater than 0, so turn on the device
indigo.speedcontrol.setSpeedIndex(731663956, value=3) # turns fan to High
if (RoomTemp - RoomHighSetpoint) > 0: # Difference is greater than 0, so turn on the device
indigo.speedcontrol.setSpeedIndex(731663956, value=2) # turns fan to Med
if (RoomTemp - RoomHighSetpoint) > 0: # Difference is greater than 0, so turn on the device
indigo.speedcontrol.setSpeedIndex(731663956, value=3) # turns fan to High
if (RoomTemp - RoomHighSetpoint) > 0: # Difference is greater than 0, so turn on the device
indigo.speedcontrol.setSpeedIndex(731663956, value=2) # turns fan to Med
# Get the temperature value from the sensor and get the setpoint value from the setpoint device.
RoomTemp = indigo.devices[1770450782].sensorValue # ID of the Temperature device
RoomHighSetpoint = indigo.devices[1254352989].brightness # ID of the variable setpoint
# Log the values and the calculation results:
calculation_result = RoomTemp - RoomHighSetpoint
indigo.server.log("{} - {} = {}".format(RoomTemp, RoomHighSetpoint, calculation_result))
#calculate the difference and check to see if it is greater or equal to 0
if (calculation_result) > 0: # Difference is greater than 0, so turn on the device
indigo.speedcontrol.setSpeedIndex(731663956, value=3) # turns fan to High
elif (calculation_result) < 0: # Difference is LESS than 0, so turn on the device
indigo.speedcontrol.setSpeedIndex(731663956, value=2) # turns fan to Med
Users browsing this forum: No registered users and 1 guest