From 71a6ea1c10b59d4d6b9c30bcab855486d7999cf9 Mon Sep 17 00:00:00 2001 From: Mike <22148848+thegame3202@users.noreply.github.com> Date: Mon, 24 Feb 2020 20:43:27 -0600 Subject: [PATCH] Add shopping_list_item_added event_type (#28334) * Update __init__.py Added event_type "shopping_list_item_added" with an item tied to it. * Update __init__.py * Update __init__.py Black formatting style * Modified global event variables * Typo fix * Update __init__.py * Formatting changes * More formatting changes * Update __init__.py * Black formatting * Update __init__.py Co-authored-by: Paulus Schoutsen --- homeassistant/components/shopping_list/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/shopping_list/__init__.py b/homeassistant/components/shopping_list/__init__.py index 50d317c9095..3f61f70f858 100644 --- a/homeassistant/components/shopping_list/__init__.py +++ b/homeassistant/components/shopping_list/__init__.py @@ -241,7 +241,7 @@ def websocket_handle_items(hass, connection, msg): def websocket_handle_add(hass, connection, msg): """Handle add item to shopping_list.""" item = hass.data[DOMAIN].async_add(msg["name"]) - hass.bus.async_fire(EVENT) + hass.bus.async_fire(EVENT, {"action": "add", "item": item}) connection.send_message(websocket_api.result_message(msg["id"], item)) @@ -255,7 +255,7 @@ async def websocket_handle_update(hass, connection, msg): try: item = hass.data[DOMAIN].async_update(item_id, data) - hass.bus.async_fire(EVENT) + hass.bus.async_fire(EVENT, {"action": "update", "item": item}) connection.send_message(websocket_api.result_message(msg_id, item)) except KeyError: connection.send_message( @@ -267,5 +267,5 @@ async def websocket_handle_update(hass, connection, msg): def websocket_handle_clear(hass, connection, msg): """Handle clearing shopping_list items.""" hass.data[DOMAIN].async_clear_completed() - hass.bus.async_fire(EVENT) + hass.bus.async_fire(EVENT, {"action": "clear"}) connection.send_message(websocket_api.result_message(msg["id"]))