@DaveL17, you are the MAN! Sorry for the long delayed reply to you, but I have been away from the project for a while. Between you pointing me in the right direction, and coupled with an Intro to Programming class I am taking, I think we are officially working. You pointed me to the right block of code, and your fix suggestion was very close.
In short summary, this is what we needed to do:
1. I added your block of code. (Not the second single line, just the block)
2. I received an error about strftime only accepting one argument, but we provided two, counting the indigo.server.getTime().
3. I changed the d.strftime object to use just the time formatting you provided.
4. The next error would complain about 'd' not being defined, so I defined 'd' in the same block, and used it call indigo.server.getTime()
This seems to have fixed all of the errors. If someone tries this and they see weird errors still, its likely because you havent yet defined the Device (Acme CP). Once I did that and reloaded the module, it starts error free and all functions are working.
Thanks again DaveL17, that was a HUGE help. Also thank you to my instructor in my current Java class, as I actually used what ive learned.
- Code: Select all
#
# Thread operation
#
def runConcurrentThread(self):
try:
while True:
d = indigo.server.getTime() ### This line added by jfeger to avoid an error at runtime. 2016-03-30
dev = indigo.devices[self.dev]
if dev.states["lastreset"] == "": ### Check for a lastreset value, and if not set, execute a set. DaveL / jfeger. 2016-03-30
dev.updateStateOnServer("lastreset", d.strftime("%Y-%m-%d") ) ### Set the lastreset parameter based on 'd' time value. DaveL / jfeger 2016-03-30
s = epsdtutils.DateDiff ("hours", indigo.server.getTime(), str(dev.states["lastreset"]) + " 00:00:00")
if s > 24:
self.hlreset()
self.sleep(1)
except self.StopThread:
pass # Optionally catch the StopThread exception and do any needed cleanup.