This commit is contained in:
J. Nick Koston 2024-07-29 21:19:07 -05:00
parent 581efad5a7
commit 93fe46509f
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View File

@ -528,7 +528,9 @@ def _async_subscribe_keypad_events(
button_type=button_type,
action=action,
)
async_dispatcher_send(f"{DOMAIN}_{config_entry_id}_button_{button_id}", data)
async_dispatcher_send(
hass, f"{DOMAIN}_{config_entry_id}_button_{button_id}", data
)
hass.bus.async_fire(LUTRON_CASETA_BUTTON_EVENT, data)
for button_id in keypad_buttons:

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from homeassistant.components.event import EventEntity
from homeassistant.components.event import EventDeviceClass, EventEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -25,7 +25,7 @@ async def async_setup_entry(
"""Set up Lutron pico and keypad buttons."""
data = config_entry.runtime_data
async_add_entities(
LutronCasetaButtonEvent(data, config_entry.entry_id, button_device)
LutronCasetaButtonEvent(data, button_device, config_entry.entry_id)
for button_device in data.button_devices
)
@ -33,6 +33,8 @@ async def async_setup_entry(
class LutronCasetaButtonEvent(LutronCasetaDevice, EventEntity):
"""Representation of a Lutron pico and keypad button event."""
_attr_device_class = EventDeviceClass.BUTTON
def __init__(
self,
data: LutronCasetaData,