Skip to content

Commit

Permalink
Merge pull request #979 from bigredfrog/fix_scene_dummy_effect
Browse files Browse the repository at this point in the history
Fix: protect from attempting to save DummyEffect in scenes
  • Loading branch information
shauneccles committed Jun 23, 2024
2 parents 22452a6 + 7ce2525 commit ca85468
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ledfx/api/scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from ledfx.api import RestEndpoint
from ledfx.config import save_config
from ledfx.effects import DummyEffect
from ledfx.events import SceneActivatedEvent
from ledfx.utils import generate_id

Expand Down Expand Up @@ -216,9 +217,16 @@ async def post(self, request: web.Request) -> web.Response:
for virtual in self._ledfx.virtuals.values():
effect = {}
if virtual.active_effect:
effect["type"] = virtual.active_effect.type
effect["config"] = virtual.active_effect.config
# effect['name'] = virtual.active_effect.name
# prevent crash from trying to save copy / span transitions
# which appear active even when the virtual is not!!!
if not isinstance(virtual.active_effect, DummyEffect):
effect["type"] = virtual.active_effect.type
effect["config"] = virtual.active_effect.config
# effect['name'] = virtual.active_effect.name
else:
_LOGGER.debug(
f"Skipping DummyEffect for virtual {virtual.id}"
)
scene_config["virtuals"][virtual.id] = effect
else:
virtuals = data.get("virtuals")
Expand Down

0 comments on commit ca85468

Please sign in to comment.