Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix led state is not boolean #102

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pylutron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,8 @@ class Event(LutronEvent):

STATE_CHANGED: The button has been pressed.
Params:
state: The boolean value of the new LED state.
state: The value of the new LED state.
0= off, 1= on, 2= 1 flash/sec, 3= 10 flash/sec
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add class enums for OFF, ON, FLASH_SLOW, FLASH_FAST

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

"""
STATE_CHANGED = 1

Expand Down Expand Up @@ -969,10 +970,10 @@ def state(self):
return self._state

@state.setter
def state(self, new_state: bool):
def state(self, new_state):
rzulian marked this conversation as resolved.
Show resolved Hide resolved
"""Sets the new led state.

new_state: bool
new_state
"""
self._lutron.send(Lutron.OP_EXECUTE, Keypad._CMD_TYPE, self._keypad.id,
self.component_number, Led._ACTION_LED_STATE,
Expand All @@ -991,7 +992,7 @@ def handle_update(self, action, params):
_LOGGER.debug("Unknown params %s (action %d on led %d in keypad %s)" % (
params, action, self.number, self._keypad.name))
return False
self._state = bool(params[0])
self._state = params[0]
self._query_waiters.notify()
self._dispatch_event(Led.Event.STATE_CHANGED, {'state': self._state})
return True
Expand Down