trigger /hugvey_fade on block/unblock
This commit is contained in:
parent
2cd47470de
commit
efd5298e45
2 changed files with 12 additions and 3 deletions
|
@ -515,7 +515,9 @@ class HugveyState(object):
|
|||
# if the story is looping, light should not go off when the story starts
|
||||
if status != self.STATE_RUNNING or self.command.config['story']['loop'] is False:
|
||||
lightOn = status in [self.STATE_AVAILABLE, self.STATE_PAUSE]
|
||||
self.setLightStatus(lightOn)
|
||||
intensity = self.command.config['light']['on_intensity'] if lightOn else self.command.config['light']['off_intensity']
|
||||
duration = self.command.config['light']['fade_duration_id']
|
||||
self.transitionLight(intensity, duration)
|
||||
|
||||
self.eventLogger.info(f"status: {self.status}")
|
||||
|
||||
|
@ -726,9 +728,13 @@ class HugveyState(object):
|
|||
self.command.commandLight('/hugvey', [self.lightId, self.lightStatus])
|
||||
|
||||
def transitionLight(self, intensity, duration):
|
||||
"""
|
||||
Intensity: 0-255
|
||||
duration: an integer between 0-92 indicating the lanbox fade times
|
||||
"""
|
||||
self.lightIntensity = intensity
|
||||
self.logger.log(LOG_BS, f"Send /hugvey_fade {self.lightIntensity} {duration}")
|
||||
self.command.commandLight('/hugvey_fade', [self.lightId, intensity, duration])
|
||||
self.command.commandLight('/hugvey_fade', [self.lightId, intensity, int(duration)])
|
||||
|
||||
def setLightId(self, id):
|
||||
"""
|
||||
|
@ -785,7 +791,7 @@ class HugveyState(object):
|
|||
port = self.command.config['web']['port']
|
||||
|
||||
resuming = False
|
||||
if Story.hugveyHasSavedState(self.id):
|
||||
if Story.hugveyHasSavedState(self.lightId):
|
||||
self.logger.info(f"Recovering from state :-)")
|
||||
self.story = Story.loadStoryFromState(self)
|
||||
resuming = True
|
||||
|
|
|
@ -36,5 +36,8 @@ web:
|
|||
light:
|
||||
ip: "192.168.178.15"
|
||||
port: 7400
|
||||
on_intensity: 150
|
||||
off_intensity: 0
|
||||
fade_duration_id: 37
|
||||
story:
|
||||
loop: true
|
Loading…
Reference in a new issue