mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Add logbook platforms (#37078)
* Add logbook platforms * Fix logbook describe test
This commit is contained in:
23
homeassistant/components/automation/logbook.py
Normal file
23
homeassistant/components/automation/logbook.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Describe logbook events."""
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import DOMAIN, EVENT_AUTOMATION_TRIGGERED
|
||||
|
||||
|
||||
@callback
|
||||
def async_describe_events(hass, async_describe_event): # type: ignore
|
||||
"""Describe logbook events."""
|
||||
|
||||
@callback
|
||||
def async_describe_logbook_event(event): # type: ignore
|
||||
"""Describe a logbook event."""
|
||||
return {
|
||||
"name": event.data.get(ATTR_NAME),
|
||||
"message": "has been triggered",
|
||||
"entity_id": event.data.get(ATTR_ENTITY_ID),
|
||||
}
|
||||
|
||||
async_describe_event(
|
||||
DOMAIN, EVENT_AUTOMATION_TRIGGERED, async_describe_logbook_event
|
||||
)
|
||||
Reference in New Issue
Block a user