if the value of the device state "lastreset" is empty:
set the value of the device state "lastreset" to a valid value
def runConcurrentThread(self):
try:
while True:
dev = indigo.devices[self.dev]
if dev.states["lastreset"] == "":
dev.updateStateOnServer("lastreset", d.strftime(indigo.server.getTime(), "%Y-%m-%d ") )
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.
dev.updateStateOnServer("lastreset", d.strftime("%Y-%m-%d ") )
dev.updateStateOnServer("lastreset", d.strftime(indigo.server.getTime(), "%Y-%m-%d ") )
#
# 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.
IndigoSam wrote:I am wondering if the original author has now moved on.
Sam.
Installing and enabling plugin Acme Future Home CPanel System v1.1.1
Error XML Parse Error: not well-formed (invalid token)
Error On character 61 of line number 21.
Loading plugin "Acme Future Home CPanel System 1.1.1"
Starting plugin "Acme Future Home CPanel System 1.1.1" (pid 22162)
Started plugin "Acme Future Home CPanel System 1.1.1"
Acme Future Home CPanel System Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 251, in runConcurrentThread
AttributeError: 'Plugin' object has no attribute 'dev'
Acme Future Home CPanel System Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Acme Future Home CPanel System Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 251, in runConcurrentThread
AttributeError: 'Plugin' object has no attribute 'dev'
Acme Future Home CPanel System Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Acme Future Home CPanel System Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 251, in runConcurrentThread
AttributeError: 'Plugin' object has no attribute 'dev'
Acme Future Home CPanel System Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Acme Future Home CPanel System Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 251, in runConcurrentThread
AttributeError: 'Plugin' object has no attribute 'dev'
Acme Future Home CPanel System Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Acme Future Home CPanel System Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 251, in runConcurrentThread
AttributeError: 'Plugin' object has no attribute 'dev'
Acme Future Home CPanel System Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Acme Future Home CPanel System Error Error in plugin execution runConcurrentThread:
Traceback (most recent call last):
File "plugin.py", line 251, in runConcurrentThread
AttributeError: 'Plugin' object has no attribute 'dev'
Acme Future Home CPanel System Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Error XML Parse Error: not well-formed (invalid token)
Error On character 61 of line number 21.
Disabling plugin "Acme Future Home CPanel System 1.1.1"
Stopping plugin "Acme Future Home CPanel System 1.1.1" (pid 22162)
Stopped plugin "Acme Future Home CPanel System 1.1.1"
Users browsing this forum: No registered users and 1 guest