Fix red light status for looping story
This commit is contained in:
parent
417b3d9361
commit
8a3b8e070b
1 changed files with 13 additions and 2 deletions
|
@ -246,9 +246,12 @@ class CentralCommand(object):
|
||||||
"""
|
"""
|
||||||
currentCode = None
|
currentCode = None
|
||||||
while self.isRunning.is_set():
|
while self.isRunning.is_set():
|
||||||
statusses = [hv.getStatus() for hv in self.hugveys.values()]
|
# statusses = [hv.getStatus() for hv in self.hugveys.values()]
|
||||||
lightOn = HugveyState.STATE_AVAILABLE not in statusses
|
# lightOn = HugveyState.STATE_AVAILABLE not in statusses
|
||||||
|
statusses = [hv.isAvailable() for hv in self.hugveys.values()]
|
||||||
|
lightOn = True not in statusses
|
||||||
lightCode = 1 if lightOn else 0
|
lightCode = 1 if lightOn else 0
|
||||||
|
print("LIGHT", lightCode)
|
||||||
if lightCode != currentCode:
|
if lightCode != currentCode:
|
||||||
self.commandLight('/red', [lightCode])
|
self.commandLight('/red', [lightCode])
|
||||||
currentCode = lightCode
|
currentCode = lightCode
|
||||||
|
@ -450,6 +453,14 @@ class HugveyState(object):
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.logger.warn("Destroying hugvey object")
|
self.logger.warn("Destroying hugvey object")
|
||||||
|
|
||||||
|
def isAvailable(self):
|
||||||
|
if self.command.config['story']['loop']:
|
||||||
|
if self.status == self.STATE_RUNNING and self.story:
|
||||||
|
if self.story.currentMessage:
|
||||||
|
if self.story.currentMessage.id == self.story.startMessage.id:
|
||||||
|
return True
|
||||||
|
return self.status == self.STATE_AVAILABLE
|
||||||
|
|
||||||
def getStatus(self):
|
def getStatus(self):
|
||||||
return self.status
|
return self.status
|
||||||
|
|
Loading…
Reference in a new issue