mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix double events on Lutron Pico keypads (#21408)
* Fix double events on Lutron Pico keypads (#21235) * Replace "else" with default value; remove explanatory comments
This commit is contained in:
parent
6626e5c4a4
commit
4e9d0ebc63
@ -134,19 +134,18 @@ class LutronButton:
|
|||||||
"""Fire an event about a button being pressed or released."""
|
"""Fire an event about a button being pressed or released."""
|
||||||
from pylutron import Button
|
from pylutron import Button
|
||||||
|
|
||||||
|
# Events per button type:
|
||||||
|
# RaiseLower -> pressed/released
|
||||||
|
# SingleAction -> single
|
||||||
|
action = None
|
||||||
if self._has_release_event:
|
if self._has_release_event:
|
||||||
# A raise/lower button; we will get callbacks when the button is
|
|
||||||
# pressed and when it's released, so fire events for each.
|
|
||||||
if event == Button.Event.PRESSED:
|
if event == Button.Event.PRESSED:
|
||||||
action = 'pressed'
|
action = 'pressed'
|
||||||
else:
|
else:
|
||||||
action = 'released'
|
action = 'released'
|
||||||
else:
|
elif event == Button.Event.PRESSED:
|
||||||
# A single-action button; the Lutron controller won't tell us
|
|
||||||
# when the button is released, so use a different action name
|
|
||||||
# than for buttons where we expect a release event.
|
|
||||||
action = 'single'
|
action = 'single'
|
||||||
|
|
||||||
data = {ATTR_ID: self._id, ATTR_ACTION: action}
|
if action:
|
||||||
|
data = {ATTR_ID: self._id, ATTR_ACTION: action}
|
||||||
self._hass.bus.fire(self._event, data)
|
self._hass.bus.fire(self._event, data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user