import datetime
now = indigo.server.getTime()
now_formatted = datetime.datetime.strftime(now, "%H:%M")
varA = indigo.variables[180461382] #email address
hseVcnt = indigo.variables[1176596514].getValue(bool)
# theBody = "The house is vacant, and the front door was opened at %s" % (now.value)
theBody = "The house is vacant, and the front door was opened at {}" .format("value", now_formatted))
# theBody = "The house is vacant, and the front door was opened at {}" .format("value", now))
# theBody = "some text"
# if hseVcnt
indigo.server.sendEmailTo(varA.value, subject = "BRK House-front door opened", body = theBody)
import datetime
now = indigo.server.getTime()
now_formatted = datetime.datetime.strftime(now, "%H:%M")
theAddress = indigo.variables[1979525395] #email address BOB
theSubj = "G house warmup OFF at {}" .format("value", now_formatted)
theBody = "The house was never occupied, and the heater was reset to 5C."
indigo.server.sendEmailTo(theAddress.value, subject = theSubj, body = theBody)
theSubj = "G house warmup OFF at {}" .format(now_formatted)
season = indigo.variables[325456157].getValue #season
import datetime
now = indigo.server.getTime()
now_formatted = datetime.datetime.strftime(now, "%H:%M")
theAddress = indigo.variables[1979525395] #email address BOB
theSubj = "G house warmup OFF at {}" .format(now_formatted)
theBody = "The house was never occupied, and the heater was reset to 5C OR HseWarmup20 was enabled."
indigo.actionGroup.execute(808629488) #action group allOFF
if season.value != "summer":
indigo.server.sendEmailTo(theAddress.value, subject = theSubj, body = theBody)
SMUSEBY wrote:I believe I made the suggested change, and received a new (to me) error:
Script Error hseWarmupAutoOFF.py: 'Boost.Python.function' object has no attribute 'value'
Script Error Exception Traceback (most recent call shown last):
hseWarmupAutoOFF.py, line 11, at top level
AttributeError: 'Boost.Python.function' object has no attribute 'value'
- Code: Select all
season = indigo.variables[325456157].getValue #season
import datetime
now = indigo.server.getTime()
now_formatted = datetime.datetime.strftime(now, "%H:%M")
theAddress = indigo.variables[1979525395] #email address BOB
theSubj = "G house warmup OFF at {}" .format(now_formatted)
theBody = "The house was never occupied, and the heater was reset to 5C OR HseWarmup20 was enabled."
indigo.actionGroup.execute(808629488) #action group allOFF
if season.value != "summer":
indigo.server.sendEmailTo(theAddress.value, subject = theSubj, body = theBody)
import datetime
now = indigo.server.getTime()
now_formatted = datetime.datetime.strftime(now, "%H:%M")
season = indigo.variables[325456157].value #season
theAddress = indigo.variables[1979525395].value #email address BOB
theSubj = "G house warmup OFF at {}" .format(now_formatted)
theBody = "The house was never occupied, and the heater was reset to 5C OR HseWarmup20 was enabled."
indigo.actionGroup.execute(808629488) #action group allOFF
if season != "summer":
indigo.server.sendEmailTo(theAddress, subject = theSubj, body = theBody)
season = indigo.variables[325456157].getValue #season
if season.value != "summer":
if season != "summer":
SMUSEBY wrote:It works. I have an idea why my version failed - perhaps you will confirm it.
The problem was not with the date/time, but rather how I treated the variables.
- Code: Select all
season = indigo.variables[325456157].getValue #season
if season.value != "summer":
if season != "summer":
The only difference I could find between my version and yours is above - I used the first two lines, and yours employed the last line.
My theory is that I assigned the value of the indigo variable 'season' to the local python variable 'season'., and python found that disagreable. Had I assigned the indigo value of variable 'season' to 'newVar', mine would have worked. - albeit with two lines vs one. If there is some other reason, please let me know.
season = indigo.variables[325456157].value #season
howartp wrote:For the formatting codes, scroll almost to the bottom of https://docs.python.org/3/library/datetime.html
There’s a table with them all in.
Very interesting. Thank you.the .value property gets the native value of the Indigo variable, which is a string. Which is what you want. You use .getValue() when you want to convert the string to a number or boolean. Which is not needed here.
SMUSEBY wrote:Python 2.7 vs 3.0: latest version isn't the one we're using?
Users browsing this forum: No registered users and 7 guests