Skip to content

Commit

Permalink
Update light intensity (#32)
Browse files Browse the repository at this point in the history
Update light intensity.
  • Loading branch information
Dimitri23 committed Mar 29, 2020
1 parent 476a3a0 commit 5a0c5b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyvlx/node_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
FrameGetAllNodesInformationNotification,
FrameNodeStatePositionChangedNotification)
from .opening_device import OpeningDevice
from .parameter import Position
from .lightening_device import LighteningDevice
from .parameter import Intensity, Position


class NodeUpdater():
Expand All @@ -22,10 +23,16 @@ async def process_frame(self, frame):
if isinstance(node, OpeningDevice):
node.position = Position(frame.current_position)
await node.after_update()
elif isinstance(node, LighteningDevice):
node.intensity = Intensity(frame.current_position)
await node.after_update()
elif isinstance(frame, FrameGetAllNodesInformationNotification):
if frame.node_id not in self.pyvlx.nodes:
return
node = self.pyvlx.nodes[frame.node_id]
if isinstance(node, OpeningDevice):
node.position = Position(frame.current_position)
await node.after_update()
elif isinstance(node, LighteningDevice):
node.intensity = Intensity(frame.current_position)
await node.after_update()

0 comments on commit 5a0c5b7

Please sign in to comment.