Heating Automation - Help Needed

Posted on
Sun Nov 05, 2017 6:22 pm
digtrail offline
Posts: 28
Joined: Jun 02, 2016

Heating Automation - Help Needed

My house is heated by a modulating-condensing boiler. When the temps are over 40 if multiple zones are not calling for heat at the same time the boiler will short fire as no single zone has enough output even at minimum firing rate. So I just installed three Trane z-wave thermostats. I have them working with Indigo now to where I can read their values and create variables based on those values.

What I want to do is when the temperature is over 40, even if a zone is calling for heat it won't be able to unless there is another zone also calling for heat. Since these thermostats directly control the zone valves I figure the best way is to do this is to toggle the thermostats mode fromOff to Heat and back to Off as zones open/close. I have triggers that are working and updating variables that read current temp, set temp, compare those and modifies another variable to true if a zone wants heat.

To cut down on triggers I thought a script would be best to run any time there is a change in the value of the variable that indicates a call for heat. This script would read the variable and if two or more were true then the thermostat would switch to Heat mode. I would create an action group that would contain the nearly identical script for each thermostat and run the scripts when triggered by the change in any of the zones call for heat. Problem is I don't know any python. I cobbled together a few applescripts for Indigo a couple years ago, and copy/pasted my way thru a simple python on last year but this is beyond me even though it is pretty simple. I have this so far which I mashed together using different examples I found here on the forum. But it doesn't come any where close to working and I knew it wouldn't. But I thought it might be a good starting point for somebody to help me with. Any solutions?

Code: Select all
# variables are true if zone is calling for heat, false if not
bed = indigo.variables(915602964)
living = indigo.variables(40815081)
base = indigo.variables(915602964)

# get current temp
currentTemp = float(indigo.devices[1007237836].states["temp"])

# is  temp over 40
if currentTemp >= 40 and living.states['true'] and bed.states['true'] or base.states['true']:
   indigo.devices.modeHeat(1643055815)

# temp is under 40
elif currentTemp < 40 and indigo.variables(40815081).states['true']:
   indigo.devices.modeHeat(16430558150)

# the conditions above are not met
else:
   indigo.devices.modeOff(16430558150)

Posted on
Tue Nov 07, 2017 5:51 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: Heating Automation - Help Needed

MODERATOR NOTE: Moved to Python Scripting sub-forum.

To get the float value out of a variable you should call getValue. Examples:

Code: Select all
bed = indigo.variables(915602964)
living = indigo.variables(40815081)
base = indigo.variables(915602964)
bedVal = bed.getValue(float)
livingVal = living.getValue(float)
baseVal = base.getValue(float)

But are those really Indigo variables or are they devices? I ask because later you refer to bed.states['true'] but variables don't have "states", only devices do. So you cannot reference bed.states[] on an Indigo variable.

To change the mode of a thermostat between OFF and HEAT you should use:

Code: Select all
indigo.thermostat.setHvacMode(dev, indigo.kHvacMode.Off)
indigo.thermostat.setHvacMode(dev, indigo.kHvacMode.Heat)

Also it looks like you have a typo. In some places you reference device ID 1643055815 and in others it is 16430558150.

Image

Posted on
Sat Oct 27, 2018 8:19 am
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: Heating Automation - Help Needed

I'm interested running similar comparisons in Python. Noting Matt's comments regarding variables and states, in general, how did the conditional syntax work out?

Code: Select all
# variables are true if zone is calling for heat, false if not
bed = indigo.variables(915602964)
living = indigo.variables(40815081)
base = indigo.variables(915602964)

# get current temp
currentTemp = float(indigo.devices[1007237836].states["temp"])

# is  temp over 40
if currentTemp >= 40 and living.states['true'] and bed.states['true'] or base.states['true']:
   indigo.devices.modeHeat(1643055815)

# temp is under 40
elif currentTemp < 40 and indigo.variables(40815081).states['true']:
   indigo.devices.modeHeat(16430558150)

# the conditions above are not met
else:
   indigo.devices.modeOff(16430558150)


Could you post your final working script, and any other interesting variations?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest